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()))
122 std::lock_guard<std::recursive_mutex> guard(
123 bkpt_sp->GetTarget().GetAPIMutex());
124 bkpt_sp->ClearAllBreakpointSites();
136 std::lock_guard<std::recursive_mutex> guard(
137 bkpt_sp->GetTarget().GetAPIMutex());
139 Target &target = bkpt_sp->GetTarget();
143 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByAddress(address));
146 return sb_bp_location;
156 std::lock_guard<std::recursive_mutex> guard(
157 bkpt_sp->GetTarget().GetAPIMutex());
159 Target &target = bkpt_sp->GetTarget();
163 break_id = bkpt_sp->FindLocationIDByAddress(address);
176 std::lock_guard<std::recursive_mutex> guard(
177 bkpt_sp->GetTarget().GetAPIMutex());
178 sb_bp_location.
SetLocation(bkpt_sp->FindLocationByID(bp_loc_id));
181 return sb_bp_location;
191 std::lock_guard<std::recursive_mutex> guard(
192 bkpt_sp->GetTarget().GetAPIMutex());
193 sb_bp_location.
SetLocation(bkpt_sp->GetLocationAtIndex(index));
196 return sb_bp_location;
205 std::lock_guard<std::recursive_mutex> guard(
206 bkpt_sp->GetTarget().GetAPIMutex());
207 bkpt_sp->SetEnabled(enable);
216 std::lock_guard<std::recursive_mutex> guard(
217 bkpt_sp->GetTarget().GetAPIMutex());
218 return bkpt_sp->IsEnabled();
229 std::lock_guard<std::recursive_mutex> guard(
230 bkpt_sp->GetTarget().GetAPIMutex());
231 bkpt_sp->SetOneShot(one_shot);
240 std::lock_guard<std::recursive_mutex> guard(
241 bkpt_sp->GetTarget().GetAPIMutex());
242 return bkpt_sp->IsOneShot();
252 std::lock_guard<std::recursive_mutex> guard(
253 bkpt_sp->GetTarget().GetAPIMutex());
254 return bkpt_sp->IsInternal();
265 std::lock_guard<std::recursive_mutex> guard(
266 bkpt_sp->GetTarget().GetAPIMutex());
267 bkpt_sp->SetIgnoreCount(count);
276 std::lock_guard<std::recursive_mutex> guard(
277 bkpt_sp->GetTarget().GetAPIMutex());
293 std::lock_guard<std::recursive_mutex> guard(
294 bkpt_sp->GetTarget().GetAPIMutex());
306 std::lock_guard<std::recursive_mutex> guard(
307 bkpt_sp->GetTarget().GetAPIMutex());
308 bkpt_sp->SetAutoContinue(auto_continue);
317 std::lock_guard<std::recursive_mutex> guard(
318 bkpt_sp->GetTarget().GetAPIMutex());
319 return bkpt_sp->IsAutoContinue();
330 std::lock_guard<std::recursive_mutex> guard(
331 bkpt_sp->GetTarget().GetAPIMutex());
332 count = bkpt_sp->GetHitCount();
344 std::lock_guard<std::recursive_mutex> guard(
345 bkpt_sp->GetTarget().GetAPIMutex());
346 count = bkpt_sp->GetIgnoreCount();
357 std::lock_guard<std::recursive_mutex> guard(
358 bkpt_sp->GetTarget().GetAPIMutex());
359 bkpt_sp->SetThreadID(tid);
369 std::lock_guard<std::recursive_mutex> guard(
370 bkpt_sp->GetTarget().GetAPIMutex());
371 tid = bkpt_sp->GetThreadID();
382 std::lock_guard<std::recursive_mutex> guard(
383 bkpt_sp->GetTarget().GetAPIMutex());
384 bkpt_sp->GetOptions().GetThreadSpec()->SetIndex(index);
394 std::lock_guard<std::recursive_mutex> guard(
395 bkpt_sp->GetTarget().GetAPIMutex());
397 bkpt_sp->GetOptions().GetThreadSpecNoCreate();
398 if (thread_spec !=
nullptr)
399 thread_idx = thread_spec->
GetIndex();
411 std::lock_guard<std::recursive_mutex> guard(
412 bkpt_sp->GetTarget().GetAPIMutex());
413 bkpt_sp->GetOptions().GetThreadSpec()->SetName(thread_name);
424 std::lock_guard<std::recursive_mutex> guard(
425 bkpt_sp->GetTarget().GetAPIMutex());
427 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
438 std::lock_guard<std::recursive_mutex> guard(
439 bkpt_sp->GetTarget().GetAPIMutex());
440 bkpt_sp->GetOptions().GetThreadSpec()->SetQueueName(queue_name);
451 std::lock_guard<std::recursive_mutex> guard(
452 bkpt_sp->GetTarget().GetAPIMutex());
454 bkpt_sp->GetOptions().GetThreadSpecNoCreate())
463 size_t num_resolved = 0;
466 std::lock_guard<std::recursive_mutex> guard(
467 bkpt_sp->GetTarget().GetAPIMutex());
468 num_resolved = bkpt_sp->GetNumResolvedLocations();
479 std::lock_guard<std::recursive_mutex> guard(
480 bkpt_sp->GetTarget().GetAPIMutex());
481 num_locs = bkpt_sp->GetNumLocations();
495 std::lock_guard<std::recursive_mutex> guard(
496 bkpt_sp->GetTarget().GetAPIMutex());
497 std::unique_ptr<BreakpointOptions::CommandData> cmd_data_up(
500 bkpt_sp->GetOptions().SetCommandDataCallback(cmd_data_up);
511 bkpt_sp->GetOptions().GetCommandLineCallbacks(command_list);
528 std::lock_guard<std::recursive_mutex> guard(
529 bkpt_sp->GetTarget().GetAPIMutex());
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());
606 std::lock_guard<std::recursive_mutex> guard(
607 bkpt_sp->GetTarget().GetAPIMutex());
610 ::PrivateBreakpointHitCallback, baton_sp,
616 const char *callback_function_name) {
623 const char *callback_function_name,
631 std::lock_guard<std::recursive_mutex> guard(
632 bkpt_sp->GetTarget().GetAPIMutex());
634 error = bkpt_sp->GetTarget()
636 .GetScriptInterpreter()
637 ->SetBreakpointCommandCallbackFunction(bp_options,
638 callback_function_name,
655 std::lock_guard<std::recursive_mutex> guard(
656 bkpt_sp->GetTarget().GetAPIMutex());
661 .GetScriptInterpreter()
662 ->SetBreakpointCommandCallback(bp_options, callback_body_text,
671bool SBBreakpoint::AddName(
const char *new_name) {
685 std::lock_guard<std::recursive_mutex> guard(
686 bkpt_sp->GetTarget().GetAPIMutex());
688 bkpt_sp->GetTarget().AddNameToBreakpoint(bkpt_sp, new_name,
error);
703 std::lock_guard<std::recursive_mutex> guard(
704 bkpt_sp->GetTarget().GetAPIMutex());
705 bkpt_sp->GetTarget().RemoveNameFromBreakpoint(bkpt_sp,
716 std::lock_guard<std::recursive_mutex> guard(
717 bkpt_sp->GetTarget().GetAPIMutex());
718 return bkpt_sp->MatchesName(name);
730 std::lock_guard<std::recursive_mutex> guard(
731 bkpt_sp->GetTarget().GetAPIMutex());
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();
805 std::lock_guard<std::recursive_mutex> guard(
806 bkpt_sp->GetTarget().GetAPIMutex());
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
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