42#include "llvm/ADT/STLExtras.h"
85 return SBTarget(bkpt_sp->GetTargetSP());
96 break_id = bkpt_sp->GetID();
103 return this->
operator bool();
105SBBreakpoint::operator
bool()
const {
111 else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
123 std::lock_guard<TargetAPIMutex> guard(api_lock);
124 bkpt_sp->ClearAllBreakpointSites();
137 std::lock_guard<TargetAPIMutex> guard(api_lock);
139 Target &target = bkpt_sp->GetTarget();
143 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByAddress(address));
146 return sb_bp_location;
157 std::lock_guard<TargetAPIMutex> guard(api_lock);
159 Target &target = bkpt_sp->GetTarget();
163 break_id = bkpt_sp->FindLocationIDByAddress(address);
177 std::lock_guard<TargetAPIMutex> guard(api_lock);
178 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
181 return sb_bp_location;
192 std::lock_guard<TargetAPIMutex> guard(api_lock);
193 sb_bp_location.
SetLocation(bkpt_sp->GetLocationAtIndex(index));
196 return sb_bp_location;
206 std::lock_guard<TargetAPIMutex> guard(api_lock);
207 bkpt_sp->SetEnabled(enable);
217 std::lock_guard<TargetAPIMutex> guard(api_lock);
218 return bkpt_sp->IsEnabled();
230 std::lock_guard<TargetAPIMutex> guard(api_lock);
231 bkpt_sp->SetOneShot(one_shot);
241 std::lock_guard<TargetAPIMutex> guard(api_lock);
242 return bkpt_sp->IsOneShot();
253 std::lock_guard<TargetAPIMutex> guard(api_lock);
254 return bkpt_sp->IsInternal();
266 std::lock_guard<TargetAPIMutex> guard(api_lock);
267 bkpt_sp->SetIgnoreCount(count);
277 std::lock_guard<TargetAPIMutex> guard(api_lock);
294 std::lock_guard<TargetAPIMutex> guard(api_lock);
307 std::lock_guard<TargetAPIMutex> guard(api_lock);
308 bkpt_sp->SetAutoContinue(auto_continue);
318 std::lock_guard<TargetAPIMutex> guard(api_lock);
319 return bkpt_sp->IsAutoContinue();
331 std::lock_guard<TargetAPIMutex> guard(api_lock);
332 count = bkpt_sp->GetHitCount();
345 std::lock_guard<TargetAPIMutex> guard(api_lock);
346 count = bkpt_sp->GetIgnoreCount();
358 std::lock_guard<TargetAPIMutex> guard(api_lock);
359 bkpt_sp->SetThreadID(tid);
370 std::lock_guard<TargetAPIMutex> guard(api_lock);
371 tid = bkpt_sp->GetThreadID();
383 std::lock_guard<TargetAPIMutex> guard(api_lock);
384 bkpt_sp->GetOptions().GetThreadSpec()->SetIndex(index);
395 std::lock_guard<TargetAPIMutex> guard(api_lock);
397 bkpt_sp->GetOptions().GetThreadSpecNoCreate();
398 if (thread_spec !=
nullptr)
399 thread_idx = thread_spec->
GetIndex();
412 std::lock_guard<TargetAPIMutex> guard(api_lock);
413 bkpt_sp->GetOptions().GetThreadSpec()->SetName(thread_name);
425 std::lock_guard<TargetAPIMutex> guard(api_lock);
427 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
439 std::lock_guard<TargetAPIMutex> guard(api_lock);
440 bkpt_sp->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
452 std::lock_guard<TargetAPIMutex> guard(api_lock);
454 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
463 size_t num_resolved = 0;
467 std::lock_guard<TargetAPIMutex> guard(api_lock);
468 num_resolved = bkpt_sp->GetNumResolvedLocations();
480 std::lock_guard<TargetAPIMutex> guard(api_lock);
481 num_locs = bkpt_sp->GetNumLocations();
496 std::lock_guard<TargetAPIMutex> guard(api_lock);
497 std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
500 bkpt_sp->GetOptions().SetCommandDataCallback(cmd_data_up);
511 bkpt_sp->GetOptions().GetCommandLineCallbacks(command_list);
529 std::lock_guard<TargetAPIMutex> guard(api_lock);
530 s.Printf(
"SBBreakpoint: id = %i, ", bkpt_sp->GetID());
531 bkpt_sp->GetResolverDescription(s.
get());
532 bkpt_sp->GetFilterDescription(s.
get());
533 if (include_locations) {
534 const size_t num_locations = bkpt_sp->GetNumLocations();
535 s.Printf(
", locations = %" PRIu64, (uint64_t)num_locations);
539 s.Printf(
"No value");
559 if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
565 if (bkpt_sp->GetSearchFilter()->AddressPasses(address.
ref()))
566 bkpt_sp->AddLocation(address.
ref());
569 address.
get()->
Dump(&s, &bkpt_sp->GetTarget(),
572 "Address: %s didn't pass the filter.", s.
GetData());
607 std::lock_guard<TargetAPIMutex> guard(api_lock);
610 ::PrivateBreakpointHitCallback, baton_sp,
616 const char *callback_function_name) {
623 const char *callback_function_name,
632 std::lock_guard<TargetAPIMutex> guard(api_lock);
634 error = bkpt_sp->GetTarget()
636 .GetScriptInterpreter()
637 ->SetBreakpointCommandCallbackFunction(bp_options,
638 callback_function_name,
656 std::lock_guard<TargetAPIMutex> guard(api_lock);
661 .GetScriptInterpreter()
662 ->SetBreakpointCommandCallback(bp_options, callback_body_text,
671bool SBBreakpoint::AddName(
const char *new_name) {
686 std::lock_guard<TargetAPIMutex> guard(api_lock);
688 bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name,
error);
704 std::lock_guard<TargetAPIMutex> guard(api_lock);
705 bkpt_sp->GetTarget().RemoveNameFromBreakpoint(
706 bkpt_sp, llvm::StringRef(name_to_remove));
717 std::lock_guard<TargetAPIMutex> guard(api_lock);
718 return bkpt_sp->MatchesName(name);
731 std::lock_guard<TargetAPIMutex> guard(api_lock);
732 std::vector<std::string> names_vec;
733 bkpt_sp->GetNames(names_vec);
734 for (
const std::string &name : names_vec) {
754 return eBreakpointEventTypeInvalidType;
775 event.
GetSP(), loc_idx));
776 return sb_breakpoint_loc;
783 uint32_t num_locations = 0;
788 return num_locations;
796 return bkpt_sp->IsHardware();
806 std::lock_guard<TargetAPIMutex> guard(api_lock);
818 if (target_sp && target_sp->IsValid())
833 return target_sp->GetBreakpointList().FindBreakpointByID(bp_id);
842 if (break_id == desired_id)
843 return target_sp->GetBreakpointList().FindBreakpointByID(break_id);
850 if (!target_sp || !bkpt)
852 if (bkpt->GetTargetSP() != target_sp)
860 if (!target_sp || !bkpt)
862 if (bkpt->GetTargetSP() != target_sp)
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_INSTRUMENT_VA(...)
BreakpointSP GetBreakpointAtIndex(size_t idx)
SBBreakpointListImpl(lldb::TargetSP target_sp)
bool Append(BreakpointSP bkpt)
bool AppendIfUnique(BreakpointSP bkpt)
BreakpointSP FindBreakpointByID(lldb::break_id_t desired_id)
std::vector< lldb::break_id_t > m_break_ids
~SBBreakpointListImpl()=default
bool AppendByID(lldb::break_id_t id)
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_list)
lldb_private::Address * get()
lldb_private::Address & ref()
std::shared_ptr< SBBreakpointListImpl > m_opaque_sp
SBBreakpoint GetBreakpointAtIndex(size_t idx)
bool AppendIfUnique(const SBBreakpoint &sb_bkpt)
SBBreakpoint FindBreakpointByID(lldb::break_id_t)
SBBreakpointList(SBTarget &target)
void CopyToBreakpointIDList(lldb_private::BreakpointIDList &bp_id_list)
void Append(const SBBreakpoint &sb_bkpt)
void AppendByID(lldb::break_id_t id)
void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp)
void SetOneShot(bool one_shot)
SBError SetScriptCallbackBody(const char *script_body_text)
SBBreakpointLocation AddFacadeLocation()
Add a "Facade location" to the breakpoint.
uint32_t GetThreadIndex() const
lldb::SBBreakpointLocation FindLocationByID(lldb::break_id_t bp_loc_id)
void ClearAllBreakpointSites()
SBError AddLocation(SBAddress &address)
Adds a location to the breakpoint at the address passed in.
void SetThreadID(lldb::tid_t sb_thread_id)
lldb::BreakpointWP m_opaque_wp
bool GetCommandLineCommands(SBStringList &commands)
void SetAutoContinue(bool auto_continue)
void SetEnabled(bool enable)
void SetThreadName(const char *thread_name)
void SetThreadIndex(uint32_t index)
const char * GetThreadName() const
static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent(const lldb::SBEvent &event)
uint32_t GetHitCount() const
lldb::SBError SetIsHardware(bool is_hardware)
Make this breakpoint a hardware breakpoint.
static lldb::SBBreakpointLocation GetBreakpointLocationAtIndexFromEvent(const lldb::SBEvent &event, uint32_t loc_idx)
lldb::tid_t GetThreadID()
bool MatchesName(const char *name)
bool operator!=(const lldb::SBBreakpoint &rhs)
void SetIgnoreCount(uint32_t count)
lldb::break_id_t FindLocationIDByAddress(lldb::addr_t vm_addr)
size_t GetNumLocations() const
SBStructuredData SerializeToStructuredData()
const lldb::SBBreakpoint & operator=(const lldb::SBBreakpoint &rhs)
lldb::SBTarget GetTarget() const
void SetScriptCallbackFunction(const char *callback_function_name)
lldb::BreakpointSP GetSP() const
static lldb::SBBreakpoint GetBreakpointFromEvent(const lldb::SBEvent &event)
bool GetDescription(lldb::SBStream &description)
static bool EventIsBreakpointEvent(const lldb::SBEvent &event)
void SetCommandLineCommands(SBStringList &commands)
size_t GetNumResolvedLocations() const
void SetCondition(const char *condition)
void SetQueueName(const char *queue_name)
lldb::SBBreakpointLocation FindLocationByAddress(lldb::addr_t vm_addr)
const char * GetCondition()
const char * GetQueueName() const
void GetNames(SBStringList &names)
friend class SBBreakpointLocation
void RemoveName(const char *name_to_remove)
uint32_t GetIgnoreCount() const
static uint32_t GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp)
SBError AddNameWithErrorHandling(const char *new_name)
lldb::SBBreakpointLocation GetLocationAtIndex(uint32_t index)
bool operator==(const lldb::SBBreakpoint &rhs)
void SetCallback(SBBreakpointHitCallback callback, void *baton)
void SetError(uint32_t err, lldb::ErrorType type)
lldb_private::Event * get() const
lldb::EventSP & GetSP() const
lldb_private::Stream * get()
void AppendString(const char *str)
void AppendList(const char **strv, int strc)
StructuredDataImplUP m_impl_up
A section + offset based address class.
void SetRawAddress(lldb::addr_t addr)
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump a description of this object to a Stream.
bool AddBreakpointID(BreakpointID bp_id)
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
static lldb::BreakpointEventType GetBreakpointEventTypeFromEvent(const lldb::EventSP &event_sp)
static lldb::BreakpointLocationSP GetBreakpointLocationAtIndexFromEvent(const lldb::EventSP &event_sp, uint32_t loc_idx)
static lldb::BreakpointSP GetBreakpointFromEvent(const lldb::EventSP &event_sp)
static const BreakpointEventData * GetEventDataFromEvent(const Event *event_sp)
static size_t GetNumBreakpointLocationsFromEvent(const lldb::EventSP &event_sp)
A uniqued constant string class.
const char * GetCString() const
Get the string value as a C string.
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
llvm::StringRef GetText() const
const char * GetData() const
std::shared_ptr< Object > ObjectSP
A Lockable handle over a Target's API mutex, returned by Target::GetAPIMutex() and backing the public...
bool ResolveLoadAddress(lldb::addr_t load_addr, Address &so_addr, uint32_t stop_id=SectionLoadHistory::eStopIDNow, bool allow_section_end=false)
uint32_t GetIndex() const
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Baton > BatonSP
bool(* SBBreakpointHitCallback)(void *baton, lldb::SBProcess &process, lldb::SBThread &thread, lldb::SBBreakpointLocation &location)
std::weak_ptr< lldb_private::Target > TargetWP
std::shared_ptr< lldb_private::Target > TargetSP
class LLDB_API SBBreakpoint