43#include "llvm/ADT/STLExtras.h"
86 return SBTarget(bkpt_sp->GetTargetSP());
97 break_id = bkpt_sp->GetID();
104 return this->
operator bool();
106SBBreakpoint::operator
bool()
const {
112 else if (bkpt_sp->GetTarget().GetBreakpointByID(bkpt_sp->GetID()))
124 std::lock_guard<TargetAPIMutex> guard(api_lock);
125 bkpt_sp->ClearAllBreakpointSites();
138 std::lock_guard<TargetAPIMutex> guard(api_lock);
140 Target &target = bkpt_sp->GetTarget();
144 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByAddress(address));
147 return sb_bp_location;
158 std::lock_guard<TargetAPIMutex> guard(api_lock);
160 Target &target = bkpt_sp->GetTarget();
164 break_id = bkpt_sp->FindLocationIDByAddress(address);
178 std::lock_guard<TargetAPIMutex> guard(api_lock);
179 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
182 return sb_bp_location;
193 std::lock_guard<TargetAPIMutex> guard(api_lock);
194 sb_bp_location.
SetLocation(bkpt_sp->GetLocationAtIndex(index));
197 return sb_bp_location;
207 std::lock_guard<TargetAPIMutex> guard(api_lock);
208 bkpt_sp->SetEnabled(enable);
218 std::lock_guard<TargetAPIMutex> guard(api_lock);
219 return bkpt_sp->IsEnabled();
231 std::lock_guard<TargetAPIMutex> guard(api_lock);
232 bkpt_sp->SetOneShot(one_shot);
242 std::lock_guard<TargetAPIMutex> guard(api_lock);
243 return bkpt_sp->IsOneShot();
254 std::lock_guard<TargetAPIMutex> guard(api_lock);
255 return bkpt_sp->IsInternal();
267 std::lock_guard<TargetAPIMutex> guard(api_lock);
268 bkpt_sp->SetIgnoreCount(count);
278 std::lock_guard<TargetAPIMutex> guard(api_lock);
295 std::lock_guard<TargetAPIMutex> guard(api_lock);
308 std::lock_guard<TargetAPIMutex> guard(api_lock);
309 bkpt_sp->GetCondition().SetMode(mode);
319 std::lock_guard<TargetAPIMutex> guard(api_lock);
320 return bkpt_sp->GetCondition().GetMode();
331 std::lock_guard<TargetAPIMutex> guard(api_lock);
332 bkpt_sp->SetAutoContinue(auto_continue);
342 std::lock_guard<TargetAPIMutex> guard(api_lock);
343 return bkpt_sp->IsAutoContinue();
355 std::lock_guard<TargetAPIMutex> guard(api_lock);
356 count = bkpt_sp->GetHitCount();
369 std::lock_guard<TargetAPIMutex> guard(api_lock);
370 count = bkpt_sp->GetIgnoreCount();
382 std::lock_guard<TargetAPIMutex> guard(api_lock);
383 bkpt_sp->SetThreadID(tid);
394 std::lock_guard<TargetAPIMutex> guard(api_lock);
395 tid = bkpt_sp->GetThreadID();
407 std::lock_guard<TargetAPIMutex> guard(api_lock);
408 bkpt_sp->GetOptions().GetThreadSpec()->SetIndex(index);
419 std::lock_guard<TargetAPIMutex> guard(api_lock);
421 bkpt_sp->GetOptions().GetThreadSpecNoCreate();
422 if (thread_spec !=
nullptr)
423 thread_idx = thread_spec->
GetIndex();
436 std::lock_guard<TargetAPIMutex> guard(api_lock);
437 bkpt_sp->GetOptions().GetThreadSpec()->SetName(thread_name);
449 std::lock_guard<TargetAPIMutex> guard(api_lock);
451 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
453 .
Intern(thread_spec->GetName());
464 std::lock_guard<TargetAPIMutex> guard(api_lock);
465 bkpt_sp->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
477 std::lock_guard<TargetAPIMutex> guard(api_lock);
479 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
481 .
Intern(thread_spec->GetQueueName());
489 size_t num_resolved = 0;
493 std::lock_guard<TargetAPIMutex> guard(api_lock);
494 num_resolved = bkpt_sp->GetNumResolvedLocations();
506 std::lock_guard<TargetAPIMutex> guard(api_lock);
507 num_locs = bkpt_sp->GetNumLocations();
522 std::lock_guard<TargetAPIMutex> guard(api_lock);
523 std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
526 bkpt_sp->GetOptions().SetCommandDataCallback(cmd_data_up);
537 bkpt_sp->GetOptions().GetCommandLineCallbacks(command_list);
555 std::lock_guard<TargetAPIMutex> guard(api_lock);
556 s.Printf(
"SBBreakpoint: id = %i, ", bkpt_sp->GetID());
557 bkpt_sp->GetResolverDescription(s.
get());
558 bkpt_sp->GetFilterDescription(s.
get());
559 if (include_locations) {
560 const size_t num_locations = bkpt_sp->GetNumLocations();
561 s.Printf(
", locations = %" PRIu64, (uint64_t)num_locations);
565 s.Printf(
"No value");
585 if (!llvm::isa<BreakpointResolverScripted>(bkpt_sp->GetResolver().get())) {
591 if (bkpt_sp->GetSearchFilter()->AddressPasses(address.
ref()))
592 bkpt_sp->AddLocation(address.
ref());
595 address.
get()->
Dump(&s, &bkpt_sp->GetTarget(),
598 "Address: %s didn't pass the filter.", s.
GetData());
633 std::lock_guard<TargetAPIMutex> guard(api_lock);
636 ::PrivateBreakpointHitCallback, baton_sp,
642 const char *callback_function_name) {
649 const char *callback_function_name,
657 std::lock_guard<TargetAPIMutex> guard(api_lock);
659 llvm::Error
error = bkpt_sp->GetTarget()
661 .GetScriptInterpreter()
662 ->SetBreakpointCommandCallbackFunction(
663 bp_options, callback_function_name,
680 std::lock_guard<TargetAPIMutex> guard(api_lock);
685 .GetScriptInterpreter()
686 ->SetBreakpointCommandCallback(bp_options, callback_body_text,
695bool SBBreakpoint::AddName(
const char *new_name) {
710 std::lock_guard<TargetAPIMutex> guard(api_lock);
712 bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name,
error);
728 std::lock_guard<TargetAPIMutex> guard(api_lock);
729 bkpt_sp->GetTarget().RemoveNameFromBreakpoint(
730 bkpt_sp, llvm::StringRef(name_to_remove));
741 std::lock_guard<TargetAPIMutex> guard(api_lock);
742 return bkpt_sp->MatchesName(name);
755 std::lock_guard<TargetAPIMutex> guard(api_lock);
756 std::vector<std::string> names_vec;
757 bkpt_sp->GetNames(names_vec);
758 for (
const std::string &name : names_vec) {
778 return eBreakpointEventTypeInvalidType;
799 event.
GetSP(), loc_idx));
800 return sb_breakpoint_loc;
807 uint32_t num_locations = 0;
812 return num_locations;
820 return bkpt_sp->IsHardware();
830 std::lock_guard<TargetAPIMutex> guard(api_lock);
842 if (target_sp && target_sp->IsValid())
857 return target_sp->GetBreakpointList().FindBreakpointByID(bp_id);
866 if (break_id == desired_id)
867 return target_sp->GetBreakpointList().FindBreakpointByID(break_id);
874 if (!target_sp || !bkpt)
876 if (bkpt->GetTargetSP() != target_sp)
884 if (!target_sp || !bkpt)
886 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
lldb::SBBreakpointList & operator=(const lldb::SBBreakpointList &rhs)
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()
void SetConditionMode(lldb::BreakpointConditionMode mode)
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)
lldb::BreakpointConditionMode GetConditionMode()
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)
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
const char * Intern(llvm::StringRef str) 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.
StringPoolRef GetDebuggerStringPool(const Target &target)
Strings interned here live as long as target's debugger.
BreakpointConditionMode
Modes for evaluating breakpoint conditions.
@ eBreakpointConditionModeDefault
Use the mode specified by the target.breakpoints-condition-mode setting.
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