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) {
41 SetShouldResolveIndirectFunctions(
true);
46 m_being_created =
false;
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);
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",
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",
360 uint32_t loc_ignore = 0;
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;
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) 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...
void Add(const lldb::BreakpointLocationSP &bp_loc_sp)
Add the breakpoint bp_loc_sp to the list.
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 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.
BreakpointLocationCollection & GetBreakpointLocationCollection()
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 file associated with this compile unit.
lldb::LanguageType GetLanguage()
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
void void void void void Warning(const char *fmt,...) __attribute__((format(printf
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.
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.
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.
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
#define LLDB_INVALID_INDEX32
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
bool(* BreakpointHitCallback)(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
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 zero 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.