Go to the documentation of this file.
34 bool hardware,
bool check_for_resolver)
35 : m_being_created(true), m_should_resolve_indirect_functions(false),
36 m_is_reexported(false), m_is_indirect(false), m_address(addr),
37 m_owner(owner), m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
38 if (check_for_resolver) {
86 : eBreakpointEventTypeDisabled);
119 return thread_spec->
GetTID();
147 if (thread_name !=
nullptr)
169 if (queue_name !=
nullptr)
175 m_options_up->GetThreadSpec()->SetQueueName(queue_name);
205 void *baton,
bool is_synchronous) {
209 callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
214 const BatonSP &baton_sp,
215 bool is_synchronous) {
240 size_t condition_hash;
243 if (!condition_text) {
265 LLDB_LOGF(log,
"Error getting condition expression: %s.",
274 error.SetErrorStringWithFormat(
275 "Couldn't parse conditional expression:\n%s",
287 ValueObjectSP result_value_sp;
300 ExpressionVariableSP result_variable_sp;
308 if (!result_variable_sp) {
309 error.SetErrorString(
"Expression did not return a result");
313 result_value_sp = result_variable_sp->GetValueObject();
315 if (result_value_sp) {
316 ret = result_value_sp->IsLogicalTrue(
error);
318 if (
error.Success()) {
319 LLDB_LOGF(log,
"Condition successfully evaluated, result is %s.\n",
320 ret ?
"true" :
"false");
322 error.SetErrorString(
323 "Failed to get an integer result from the expression");
329 error.SetErrorString(
"Failed to get any result from the expression");
333 error.SetErrorStringWithFormat(
"Couldn't execute expression:\n%s",
364 if (loc_ignore != 0 || owner_ignore != 0) {
378 m_options_up = std::make_unique<BreakpointOptions>(
false);
386 .GetThreadSpecNoCreate());
395 bool should_stop =
true;
411 should_stop ?
"stopping" :
"continuing");
446 if (process ==
nullptr)
455 log->
Warning(
"Failed to add breakpoint site at 0x%" PRIx64,
517 false,
true,
false,
true,
true);
527 s->
Indent(
"compile unit = ");
547 s->
Indent(
"re-exported target = ");
570 if (exe_scope ==
nullptr)
584 if (resolved_symbol) {
591 s->
Printf(
"indirect target = %s",
597 bool is_hardware = is_resolved &&
m_bp_site_sp->IsHardware();
602 s->
Printf(
"resolved = %s\n", is_resolved ?
"true" :
"false");
604 s->
Printf(
"hardware = %s\n", is_hardware ?
"true" :
"false");
615 s->
Printf(
", %sresolved, %shit count = %u ", (is_resolved ?
"" :
"un"),
628 bool is_hardware = is_resolved &&
m_bp_site_sp->IsHardware();
629 auto hardware_index = is_resolved ?
635 s->
Printf(
"BreakpointLocation %u: tid = %4.4" PRIx64
636 " load addr = 0x%8.8" PRIx64
" state = %s type = %s breakpoint "
637 "hw_index = %i hit_count = %-4u ignore_count = %-4u",
643 is_hardware ?
"hardware" :
"software", hardware_index,
650 lldb::BreakpointEventType eventKind) {
655 eventKind,
m_owner.shared_from_this());
665 swap_from->m_should_resolve_indirect_functions;
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
CompileUnit * CalculateSymbolContextCompileUnit() const
void SetThreadID(lldb::tid_t thread_id)
Set the valid thread to be checked when the breakpoint is hit.
CompileUnit * comp_unit
The CompileUnit for a given query.
ThreadSpec * GetThreadSpec()
Returns a pointer to the ThreadSpec for this option, creating it.
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
lldb::BreakpointSiteSP m_bp_site_sp
Our breakpoint site (it may be shared by more than one location.)
lldb::break_id_t GetID() const
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.
bool InvokeCallback(StoppointCallbackContext *context)
Invoke the callback action when the breakpoint is hit.
bool IsCallbackSynchronous()
Report whether the callback for this location is synchronous or not.
lldb::addr_t GetLoadAddress() const
Gets the load address for this breakpoint location.
uint32_t GetThreadIndex() const
uint32_t GetIgnoreCount() const
Return the current ignore count/.
void SetCondition(const char *condition)
Set the breakpoint option's condition.
void DecrementIgnoreCount()
@ DumpStyleFileAddress
Display as the file address (if any).
ExpressionResults
The results of expression evaluation.
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
#define LLDB_LOGF(log,...)
void SwapLocation(lldb::BreakpointLocationSP swap_from)
void SetThreadID(lldb::tid_t thread_id)
bool ClearBreakpointSite()
Clear this breakpoint location's breakpoint site - for instance when disabling the breakpoint.
void SetThreadName(const char *thread_name)
void SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
LanguageType
Programming language type.
void void void void Warning(const char *fmt,...) __attribute__((format(printf
void SetCondition(const char *condition)
Set the breakpoint location's condition.
size_t m_condition_hash
For testing whether the condition source code changed.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind)
void SetShouldResolveIndirectFunctions(bool do_resolve)
const BreakpointOptions & GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind) const
Use this to access breakpoint options from this breakpoint location.
BreakpointLocationCollection & GetBreakpointLocationCollection()
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
void SetResultIsInternal(bool b)
void SetAutoContinue(bool auto_continue)
If auto_continue is true, set the breakpoint to continue when hit.
std::string GetString(char separator='\n')
void SetAutoContinue(bool auto_continue)
Set the auto-continue state.
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp)
Set the breakpoint site for this location to bp_site_sp.
const ThreadSpec * GetThreadSpecNoCreate() const
Return the current thread spec for this option.
void Increment(uint32_t difference=1)
static llvm::raw_ostream & error(Stream &strm)
Symbol * symbol
The Symbol for a given query.
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
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) const
Dump the stop context in this object to a Stream.
Address & GetAddress()
Gets the Address for this breakpoint location.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
lldb::UserExpressionSP m_user_expression_sp
The compiled expression to use in testing our condition.
void SetThreadIndex(uint32_t index)
@ DumpStyleLoadAddress
Display as the load address (if resolved).
ConstString GetName() const
StoppointHitCounter m_hit_counter
Number of times this breakpoint location has been hit.
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...
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
lldb::break_id_t GetID() const
Returns the breakpoint location ID.
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
Adds a callback to the breakpoint option set.
const char * GetData() const
lldb::tid_t GetThreadID()
Function * function
The Function for a given query.
bool IsAutoContinue() const
Check the AutoContinue state.
void Decrement(uint32_t difference=1)
void SetQueueName(llvm::StringRef queue_name)
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
bool m_should_resolve_indirect_functions
void SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
bool IsEnabled() const
Check the Enable/Disable state.
void SetTryAllThreads(bool try_others=true)
void SetIndex(uint32_t index)
bool InvokeCallback(StoppointCallbackContext *context, lldb::break_id_t bp_loc_id)
Invoke the callback action when the breakpoint is hit.
const FileSpec & GetPrimaryFile() const
Return the primary source file associated with this compile unit.
bool EventTypeHasListeners(uint32_t event_type)
bool ValidForThisThread(Thread &thread)
Breakpoint & m_owner
The breakpoint that produced this object.
bool IsIndirect()
Returns whether the address set in the breakpoint site for this location was found by resolving an in...
void SetUnwindOnError(bool unwind=false)
lldb::LanguageType GetLanguage()
Symbol * CalculateSymbolContextSymbol() const
void Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous)
Set the callback action invoked when the breakpoint is hit.
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
uint32_t line
The source line number, or zero if there is no line number information.
lldb::BreakpointSiteSP GetBreakpointSite() const
#define LLDB_INVALID_BREAK_ID
void SetQueueName(const char *queue_name)
uint32_t GetHitCount() const
Return the current Hit Count.
void SetIgnoreBreakpoints(bool ignore=false)
ConstString GetName() const
bool ShouldStop(StoppointCallbackContext *context)
Determines whether we should stop due to a hit at this breakpoint location.
const char * GetName() const
const lldb::ProcessSP & GetProcessSP() const
bool IgnoreCountShouldStop()
BreakpointLocation::IgnoreCountShouldStop can only be called once per stop.
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
uint32_t GetIndex() const
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false) const
Dump a description of this object to a Stream.
@ eLanguageTypeUnknown
Unknown or invalid language value.
const char * GetQueueName() const
Breakpoint & GetBreakpoint()
Gets the Breakpoint that created this breakpoint location.
bool IsResolved() const
Return whether this breakpoint location has a breakpoint site.
bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error)
void GetDescription(Stream *s, lldb::DescriptionLevel level)
Print a description of this breakpoint location to the stream s.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
void SetName(llvm::StringRef name)
size_t EOL()
Output and End of Line character to the stream.
@ eBroadcastBitBreakpointChanged
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
lldb::ModuleSP module_sp
The Module for a given query.
void Add(const lldb::BreakpointLocationSP &bp_loc_sp)
Add the breakpoint bp_loc_sp to the list.
bool IsCallbackSynchronous() const
Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
virtual bool MatchesSpec(const ThreadSpec *spec)
const char * GetCString() const
Get the string value as a C string.
@ eExecutionPolicyOnlyWhenNeeded
void Dump(Stream *s) const
Standard "Dump" method. At present it does nothing.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
uint32_t GetIgnoreCount() const
Return the current Ignore Count.
const char * GetThreadName() const
A class that represents a running process on the host machine.
@ eDescriptionLevelVerbose
StoppointHitCounter m_hit_counter
Number of times this breakpoint has been hit.
bool IsSectionOffset() const
Check if an address is section offset.
bool IsReExported()
Returns whether the address set in the breakpoint location was re-routed to the target of a re-export...
Target & GetTarget()
Accessor for the breakpoint Target.
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
#define LLDB_INVALID_INDEX32
lldb::tid_t GetTID() const
#define LLDB_INVALID_THREAD_ID
bool ResolveBreakpointSite()
Try to resolve the breakpoint site for this location.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
std::unique_ptr< BreakpointOptions > m_options_up
Breakpoint options pointer, nullptr if we're using our breakpoint's options.
void DecrementIgnoreCount()
LineEntry line_entry
The LineEntry for a given query.
Address m_address
The address defining this location.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
void ClearCallback()
Remove the callback from this option set.
bool IsEnabled() override
Check the Enable/Disable state.
ConstString & GetFilename()
Filename string get accessor.
const char * GetQueueName() const
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
std::mutex m_condition_mutex
Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
@ eDescriptionLevelInitial
bool IsAutoContinue() const
Check the AutoContinue state.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
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.