36 bool check_for_resolver)
37 : m_should_resolve_indirect_functions(false), m_is_reexported(false),
38 m_is_indirect(false), m_address(addr), m_owner(owner),
39 m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
40 if (check_for_resolver) {
43 SetShouldResolveIndirectFunctions(
true);
47 SetThreadIDInternal(tid);
51 : m_should_resolve_indirect_functions(false), m_is_reexported(false),
53 m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
90 : eBreakpointEventTypeDisabled);
98 return m_owner.IsAutoContinue();
116 return thread_spec->
GetTID();
142 if (thread_name !=
nullptr)
163 if (queue_name !=
nullptr)
169 m_options_up->GetThreadSpec()->SetQueueName(queue_name);
192 return m_owner.GetOptions().IsCallbackSynchronous();
196 void *baton,
bool is_synchronous) {
200 callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
206 bool is_synchronous) {
249 m_address.CalculateSymbolContextCompileUnit())
250 language = comp_unit->GetLanguage();
254 condition.
GetText(), llvm::StringRef(), language,
258 LLDB_LOGF(log,
"Error getting condition expression: %s.",
269 "Couldn't parse conditional expression:"));
302 if (!result_variable_sp) {
307 result_value_sp = result_variable_sp->GetValueObject();
309 if (result_value_sp) {
310 ret = result_value_sp->IsLogicalTrue(
error);
312 if (
error.Success()) {
313 LLDB_LOGF(log,
"Condition successfully evaluated, result is %s.\n",
314 ret ?
"true" :
"false");
317 "Failed to get an integer result from the expression");
324 "Failed to get any result from the expression");
355 uint32_t loc_ignore = 0;
359 if (loc_ignore != 0 || owner_ignore != 0) {
360 m_owner.DecrementIgnoreCount();
373 m_options_up = std::make_unique<BreakpointOptions>(
false);
379 return thread.MatchesSpec(
381 .GetThreadSpecNoCreate());
389 llvm::dyn_cast<BreakpointResolverScripted>(resolver_sp.get());
391 return shared_from_this();
395 return shared_from_this();
398 scripted->
WasHit(frame_sp, shared_from_this());
405 if (return_loc_sp && return_loc_sp->IsFacade()) {
406 if (return_loc_sp->IsEnabled())
407 return_loc_sp->m_hit_counter.Increment();
411 return return_loc_sp;
421 bool should_stop =
true;
445 if (loc_hit_sp.get() !=
this)
446 facade_loc_sp = loc_hit_sp;
448 facade_loc_sp.reset();
458 should_stop ?
"stopping" :
"continuing");
473 m_owner.m_hit_counter.Increment();
481 m_owner.m_hit_counter.Decrement();
500 return llvm::Error::success();
503 if (process ==
nullptr)
504 return llvm::createStringError(
"no process");
510 return llvm::createStringError(
511 llvm::formatv(
"Failed to add breakpoint site at {0:x}",
515 return llvm::createStringError(
516 "breakpoint site created but location is still unresolved");
518 return llvm::Error::success();
531 return llvm::Error::success();
532 return llvm::createStringError(
"no breakpoint site to clear");
545 return llvm::Error::success();
554 std::optional<std::string> scripted_opt;
557 llvm::dyn_cast<BreakpointResolverScripted>(resolver_sp.get());
561 bool is_scripted_desc = scripted_opt.has_value();
580 if (is_scripted_desc) {
582 }
else if (
m_address.IsSectionOffset()) {
593 bool show_function_info =
true;
600 show_function_info =
false;
603 false,
true,
false, show_function_info,
604 show_function_info, show_function_info);
614 s->
Indent(
"compile unit = ");
624 s->
Indent(
"mangled function = ");
633 preferred->DumpStopContext(s,
true);
643 s->
Indent(
"re-exported target = ");
657 if (!is_scripted_desc) {
667 if (exe_scope ==
nullptr)
681 if (resolved_symbol) {
688 s->
Printf(
"indirect target = %s",
697 bool is_resolved = is_scripted_desc ||
IsResolved();
706 s->
Printf(
"resolved = %s\n", is_resolved ?
"true" :
"false");
708 s->
Printf(
"hardware = %s\n", is_hardware ?
"true" :
"false");
719 s->
Printf(
", %sresolved, %shit count = %u ", (is_resolved ?
"" :
"un"),
732 bool is_hardware = is_resolved &&
m_bp_site_sp->IsHardware();
737 s->
Printf(
"BreakpointLocation %u: tid = %4.4" PRIx64
738 " load addr = 0x%8.8" PRIx64
" state = %s type = %s breakpoint "
739 "hit_count = %-4u ignore_count = %-4u",
745 is_hardware ?
"hardware" :
"software",
GetHitCount(),
751 lldb::BreakpointEventType eventKind) {
752 if (!
m_owner.IsInternal() &&
m_owner.GetTarget().EventTypeHasListeners(
754 auto data_sp = std::make_shared<Breakpoint::BreakpointEventData>(
755 eventKind,
m_owner.shared_from_this());
756 data_sp->GetBreakpointLocationCollection().Add(shared_from_this());
768 if (!
m_address.CalculateSymbolContext(&sc))
785 while (inlined_block) {
809 swap_from->m_should_resolve_indirect_functions;
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
A section + offset based address class.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
@ DumpStyleFileAddress
Display as the file address (if any).
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
@ DumpStyleLoadAddress
Display as the load address (if resolved).
Symbol * CalculateSymbolContextSymbol() const
A class that describes a single lexical block.
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
bool GetStartAddress(Address &addr)
Block * GetInlinedParent()
Get the inlined parent block for this block.
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
Takes a breakpoint ID and the breakpoint location id and returns a string containing the canonical de...
size_t m_condition_hash
Breakpoint location ID.
void SetCondition(StopCondition condition)
Set the breakpoint location's condition.
void DecrementIgnoreCount()
const std::optional< LineEntry > GetPreferredLineEntry()
void SwapLocation(lldb::BreakpointLocationSP swap_from)
BreakpointLocation(lldb::break_id_t loc_id, Breakpoint &owner, const Address &addr, lldb::tid_t tid, bool check_for_resolver=true)
Constructor.
bool IsIndirect()
Returns whether the address set in the breakpoint site for this location was found by resolving an in...
bool ValidForThisThread(Thread &thread)
uint32_t GetHitCount() const
Return the current Hit Count.
std::mutex m_condition_mutex
For testing whether the condition source code changed.
StoppointHitCounter m_hit_counter
lldb::BreakpointSiteSP m_bp_site_sp
The compiled expression to use in testing our condition.
llvm::Error ClearBreakpointSite()
Clear this breakpoint location's breakpoint site - for instance when disabling the breakpoint.
Breakpoint & m_owner
Breakpoint options pointer, nullptr if we're using our breakpoint's options.
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp)
Set the breakpoint site for this location to bp_site_sp.
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
void SetThreadIDInternal(lldb::tid_t thread_id)
Updates the thread ID internally.
void SetQueueName(const char *queue_name)
lldb::tid_t GetThreadID()
llvm::Error SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
bool IsReExported()
Returns whether the address set in the breakpoint location was re-routed to the target of a re-export...
lldb::addr_t GetLoadAddress() const
Gets the load address for this breakpoint location.
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
bool InvokeCallback(StoppointCallbackContext *context)
Invoke the callback action when the breakpoint is hit.
void GetDescription(Stream *s, lldb::DescriptionLevel level)
Print a description of this breakpoint location to the stream s.
uint32_t GetThreadIndex() const
Address m_address
The breakpoint that produced this object.
const char * GetQueueName() const
bool IsEnabled() const
Check the Enable/Disable state.
bool IgnoreCountShouldStop()
BreakpointLocation::IgnoreCountShouldStop can only be called once per stop.
const char * GetThreadName() const
const StopCondition & GetCondition() const
Return the breakpoint condition.
bool IsResolved() const
Return whether this breakpoint location has a breakpoint site.
lldb::break_id_t GetID() const
Returns the breakpoint location ID.
void Dump(Stream *s) const
Standard "Dump" method. At present it does nothing.
bool IsCallbackSynchronous()
Report whether the callback for this location is synchronous or not.
void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind)
void SetAutoContinue(bool auto_continue)
If auto_continue is true, set the breakpoint to continue when hit.
void SetThreadID(lldb::tid_t thread_id)
Set the valid thread to be checked when the breakpoint is hit.
lldb::UserExpressionSP m_user_expression_sp
Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
void SetThreadIndex(uint32_t index)
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous)
Set the callback action invoked when the breakpoint is hit.
uint32_t GetIgnoreCount() const
Return the current Ignore Count.
bool m_is_indirect
The address defining this location.
bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error)
std::unique_ptr< BreakpointOptions > m_options_up
Our breakpoint site (it may be shared by more than one location.)
Address & GetAddress()
Gets the Address for this breakpoint location.
bool IsAutoContinue() const
Check the AutoContinue state.
std::optional< uint32_t > GetSuggestedStackFrameIndex()
If this location knows that the virtual stack frame it represents is not frame 0, return the suggeste...
bool m_should_resolve_indirect_functions
void SetThreadName(const char *thread_name)
Breakpoint & GetBreakpoint()
Gets the Breakpoint that created this breakpoint location.
const BreakpointOptions & GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind) const
Use this to access breakpoint options from this breakpoint location.
llvm::Error ResolveBreakpointSite()
Try to resolve the breakpoint site for this location.
lldb::BreakpointLocationSP WasHit(StoppointCallbackContext *context)
This is a programmatic version of a breakpoint "condition".
lldb::BreakpointSiteSP GetBreakpointSite() const
bool ShouldStop(StoppointCallbackContext *context, lldb::BreakpointLocationSP &facade_loc_sp)
Determines whether we should stop due to a hit at this breakpoint location.
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
void ClearCallback()
Remove the callback from this option set.
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
void SetCondition(StopCondition condition)
Set the breakpoint stop condition.
void SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
const StopCondition & GetCondition() const
Return the breakpoint condition.
uint32_t GetIgnoreCount() const
Return the current Ignore Count.
ThreadSpec * GetThreadSpec()
Returns a pointer to the ThreadSpec for this option, creating it.
const ThreadSpec * GetThreadSpecNoCreate() const
Return the current thread spec for this option.
void SetAutoContinue(bool auto_continue)
Set the auto-continue state.
void SetThreadID(lldb::tid_t thread_id)
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
Adds a callback to the breakpoint option set.
"lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints on a given Address.
std::optional< std::string > GetLocationDescription(lldb::BreakpointLocationSP bp_loc_sp, lldb::DescriptionLevel level)
lldb::BreakpointLocationSP WasHit(lldb::StackFrameSP frame_sp, lldb::BreakpointLocationSP bp_loc_sp)
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
uint32_t GetIgnoreCount() const
Return the current ignore count/.
lldb::BreakpointResolverSP GetResolver()
A class that describes a compilation unit.
const FileSpec & GetPrimaryFile() const
Return the primary source spec associated with this compile unit.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
void Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
const char * GetCString() const
Get the string value as a C string.
A class that describes the declaration location of a lldb object.
llvm::Error GetAsError(lldb::ExpressionResults result, llvm::Twine message={}) const
Returns an ExpressionError with arg as error code.
void SetUnwindOnError(bool unwind=false)
void SetTryAllThreads(bool try_others=true)
void SetSuppressPersistentResult(bool b)
void SetIgnoreBreakpoints(bool ignore=false)
lldb::StackFrameSP GetFrameSP() const
Get accessor that creates a strong reference from the weak frame reference contained in this object.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const ConstString & GetFilename() const
Filename string const get accessor.
Declaration & GetDeclaration()
Get accessor for the declaration information.
ConstString GetName() const
const Mangled & GetMangled() const
A class that describes information for an inlined function.
Declaration & GetCallSite()
Get accessor for the call site declaration information.
ConstString GetMangledName() const
Mangled name get accessor.
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
static Status FromErrorString(const char *str)
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
lldb::LanguageType GetLanguage() const
llvm::StringRef GetText() const
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
ExecutionContextRef exe_ctx_ref
const char * GetData() const
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Defines a symbol context baton that can be handed other debug core functions.
Function * function
The Function for a given query.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
CompileUnit * comp_unit
The CompileUnit for a given query.
bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name, bool show_function_display_name=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump the stop context in this object to a Stream.
Symbol * symbol
The Symbol for a given query.
LineEntry line_entry
The LineEntry for a given query.
ConstString GetName() const
Symbol * CalculateSymbolContextSymbol() override
@ eBroadcastBitBreakpointChanged
const lldb::ProcessSP & GetProcessSP() const
void SetIndex(uint32_t index)
void SetName(llvm::StringRef name)
uint32_t GetIndex() const
const char * GetName() const
void SetQueueName(llvm::StringRef queue_name)
const char * GetQueueName() const
lldb::tid_t GetTID() 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.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
@ eExecutionPolicyOnlyWhenNeeded
std::function< bool(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)> BreakpointHitCallback
std::shared_ptr< lldb_private::StackFrame > StackFrameSP
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelInitial
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
ExpressionResults
The results of expression evaluation.
std::shared_ptr< lldb_private::Process > ProcessSP
std::shared_ptr< lldb_private::Baton > BatonSP
A line table entry class.
uint16_t column
The column number of the source line, or zero if there is no column information.
static int Compare(const LineEntry &lhs, const LineEntry &rhs)
Compare two LineEntry objects.
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
bool DumpStopContext(Stream *s, bool show_fullpaths) const
Dumps information specific to a process that stops at this line entry to the supplied stream s.
const FileSpec & GetFile() const
Helper to access the file.