34 bool hardware,
bool check_for_resolver)
35 : m_should_resolve_indirect_functions(false), m_is_reexported(false),
36 m_is_indirect(false), m_address(addr), m_owner(owner),
37 m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
38 if (check_for_resolver) {
41 SetShouldResolveIndirectFunctions(
true);
45 SetThreadIDInternal(tid);
85 : eBreakpointEventTypeDisabled);
111 return thread_spec->
GetTID();
139 if (thread_name !=
nullptr)
161 if (queue_name !=
nullptr)
167 m_options_up->GetThreadSpec()->SetQueueName(queue_name);
197 void *baton,
bool is_synchronous) {
201 callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
207 bool is_synchronous) {
232 size_t condition_hash;
235 if (!condition_text) {
258 LLDB_LOGF(log,
"Error getting condition expression: %s.",
267 error.SetErrorStringWithFormat(
268 "Couldn't parse conditional expression:\n%s",
301 if (!result_variable_sp) {
302 error.SetErrorString(
"Expression did not return a result");
306 result_value_sp = result_variable_sp->GetValueObject();
308 if (result_value_sp) {
309 ret = result_value_sp->IsLogicalTrue(
error);
311 if (
error.Success()) {
312 LLDB_LOGF(log,
"Condition successfully evaluated, result is %s.\n",
313 ret ?
"true" :
"false");
315 error.SetErrorString(
316 "Failed to get an integer result from the expression");
322 error.SetErrorString(
"Failed to get any result from the expression");
326 error.SetErrorStringWithFormat(
"Couldn't execute expression:\n%s",
353 uint32_t loc_ignore = 0;
357 if (loc_ignore != 0 || owner_ignore != 0) {
371 m_options_up = std::make_unique<BreakpointOptions>(
false);
379 .GetThreadSpecNoCreate());
388 bool should_stop =
true;
404 should_stop ?
"stopping" :
"continuing");
439 if (process ==
nullptr)
448 log->
Warning(
"Failed to add breakpoint site at 0x%" PRIx64,
510 false,
true,
false,
true,
true,
true);
520 s->
Indent(
"compile unit = ");
530 s->
Indent(
"mangled function = ");
546 s->
Indent(
"re-exported target = ");
569 if (exe_scope ==
nullptr)
583 if (resolved_symbol) {
590 s->
Printf(
"indirect target = %s",
596 bool is_hardware = is_resolved &&
m_bp_site_sp->IsHardware();
601 s->
Printf(
"resolved = %s\n", is_resolved ?
"true" :
"false");
603 s->
Printf(
"hardware = %s\n", is_hardware ?
"true" :
"false");
614 s->
Printf(
", %sresolved, %shit count = %u ", (is_resolved ?
"" :
"un"),
627 bool is_hardware = is_resolved &&
m_bp_site_sp->IsHardware();
632 s->
Printf(
"BreakpointLocation %u: tid = %4.4" PRIx64
633 " load addr = 0x%8.8" PRIx64
" state = %s type = %s breakpoint "
634 "hit_count = %-4u ignore_count = %-4u",
640 is_hardware ?
"hardware" :
"software",
GetHitCount(),
646 lldb::BreakpointEventType eventKind) {
649 auto data_sp = std::make_shared<Breakpoint::BreakpointEventData>(
650 eventKind,
m_owner.shared_from_this());
651 data_sp->GetBreakpointLocationCollection().Add(shared_from_this());
660 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.
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
@ 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).
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 IsSectionOffset() const
Check if an address is section offset.
CompileUnit * CalculateSymbolContextCompileUnit() const
Symbol * CalculateSymbolContextSymbol() const
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
For testing whether the condition source code changed.
void DecrementIgnoreCount()
void SwapLocation(lldb::BreakpointLocationSP swap_from)
bool IsIndirect()
Returns whether the address set in the breakpoint site for this location was found by resolving an in...
bool ValidForThisThread(Thread &thread)
void SetCondition(const char *condition)
Set the breakpoint location's condition.
uint32_t GetHitCount() const
Return the current Hit Count.
std::mutex m_condition_mutex
Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
StoppointHitCounter m_hit_counter
Number of times this breakpoint location has been hit.
lldb::BreakpointSiteSP m_bp_site_sp
Our breakpoint site (it may be shared by more than one location.)
Breakpoint & m_owner
The breakpoint that produced this object.
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()
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.
bool ShouldStop(StoppointCallbackContext *context)
Determines whether we should stop due to a hit at this breakpoint location.
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 address defining this location.
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
bool ResolveBreakpointSite()
Try to resolve the breakpoint site for this location.
bool IsResolved() const
Return whether this breakpoint location has a breakpoint site.
lldb::break_id_t GetID() const
Returns the breakpoint location ID.
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
void SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
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.
bool ClearBreakpointSite()
Clear this breakpoint location's breakpoint site - for instance when disabling the breakpoint.
BreakpointLocation(lldb::break_id_t bid, Breakpoint &owner, const Address &addr, lldb::tid_t tid, bool hardware, bool check_for_resolver=true)
Constructor.
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
The compiled expression to use in testing our condition.
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 ConditionSaysStop(ExecutionContext &exe_ctx, Status &error)
std::unique_ptr< BreakpointOptions > m_options_up
Breakpoint options pointer, nullptr if we're using our breakpoint's options.
Address & GetAddress()
Gets the Address for this breakpoint location.
bool IsAutoContinue() const
Check the AutoContinue state.
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.
lldb::BreakpointSiteSP GetBreakpointSite() const
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
bool IsCallbackSynchronous() const
Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
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 SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
void SetCondition(const char *condition)
Set the breakpoint option's 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)
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
Adds a callback to the breakpoint option set.
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
bool IsAutoContinue() const
Check the AutoContinue state.
bool InvokeCallback(StoppointCallbackContext *context, lldb::break_id_t bp_loc_id)
Invoke the callback action when the breakpoint is hit.
StoppointHitCounter m_hit_counter
Number of times this breakpoint has been hit.
uint32_t GetIgnoreCount() const
Return the current ignore count/.
bool IsEnabled() override
Check the Enable/Disable state.
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
void DecrementIgnoreCount()
Target & GetTarget()
Accessor for the breakpoint Target.
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
bool EventTypeHasListeners(uint32_t event_type)
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
A class that describes a compilation unit.
const FileSpec & GetPrimaryFile() const
Return the primary source spec associated with this compile unit.
lldb::LanguageType GetLanguage()
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.
std::string GetString(char separator='\n')
void SetUnwindOnError(bool unwind=false)
void SetTryAllThreads(bool try_others=true)
void SetSuppressPersistentResult(bool b)
void SetIgnoreBreakpoints(bool ignore=false)
"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.
ConstString GetName() const
const Mangled & GetMangled() const
void void void void void Warning(const char *fmt,...) __attribute__((format(printf
ConstString & GetMangledName()
Mangled name get accessor.
A plug-in interface definition class for debugging a process.
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
void Decrement(uint32_t difference=1)
void Increment(uint32_t difference=1)
lldb::break_id_t GetID() const
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.
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
const lldb::ProcessSP & GetProcessSP() const
@ eBroadcastBitBreakpointChanged
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
virtual bool MatchesSpec(const ThreadSpec *spec)
#define LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_THREAD_ID
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::BreakpointSite > BreakpointSiteSP
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
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.