LLDB mainline
BreakpointLocation.cpp
Go to the documentation of this file.
1//===-- BreakpointLocation.cpp --------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
12#include "lldb/Core/Debugger.h"
13#include "lldb/Core/Module.h"
18#include "lldb/Symbol/Symbol.h"
20#include "lldb/Target/Process.h"
21#include "lldb/Target/Target.h"
22#include "lldb/Target/Thread.h"
25#include "lldb/Utility/Log.h"
28
29using namespace lldb;
30using namespace lldb_private;
31
33 const Address &addr, lldb::tid_t tid,
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) {
39 Symbol *symbol = m_address.CalculateSymbolContextSymbol();
40 if (symbol && symbol->IsIndirect()) {
41 SetShouldResolveIndirectFunctions(true);
42 }
43 }
44
45 SetThreadIDInternal(tid);
46}
47
49
52}
53
56 if (m_options_up && m_options_up->IsOptionSet(kind))
57 return *m_options_up;
58 else
59 return m_owner.GetOptions();
60}
61
63
65
67
69 if (!m_owner.IsEnabled())
70 return false;
71 else if (m_options_up != nullptr)
72 return m_options_up->IsEnabled();
73 else
74 return true;
75}
76
79 if (enabled) {
81 } else {
83 }
84 SendBreakpointLocationChangedEvent(enabled ? eBreakpointEventTypeEnabled
85 : eBreakpointEventTypeDisabled);
86}
87
89 if (m_options_up &&
91 return m_options_up->IsAutoContinue();
92 else
93 return m_owner.IsAutoContinue();
94}
95
96void BreakpointLocation::SetAutoContinue(bool auto_continue) {
97 GetLocationOptions().SetAutoContinue(auto_continue);
98 SendBreakpointLocationChangedEvent(eBreakpointEventTypeAutoContinueChanged);
99}
100
102 SetThreadIDInternal(thread_id);
103 SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
104}
105
107 const ThreadSpec *thread_spec =
110 if (thread_spec)
111 return thread_spec->GetTID();
112 else
114}
115
117 if (index != 0)
119 else {
120 // If we're resetting this to an invalid thread id, then don't make an
121 // options pointer just to do that.
122 if (m_options_up != nullptr)
123 m_options_up->GetThreadSpec()->SetIndex(index);
124 }
125 SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
126}
127
129 const ThreadSpec *thread_spec =
132 if (thread_spec)
133 return thread_spec->GetIndex();
134 else
135 return 0;
136}
137
138void BreakpointLocation::SetThreadName(const char *thread_name) {
139 if (thread_name != nullptr)
140 GetLocationOptions().GetThreadSpec()->SetName(thread_name);
141 else {
142 // If we're resetting this to an invalid thread id, then don't make an
143 // options pointer just to do that.
144 if (m_options_up != nullptr)
145 m_options_up->GetThreadSpec()->SetName(thread_name);
146 }
147 SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
148}
149
151 const ThreadSpec *thread_spec =
154 if (thread_spec)
155 return thread_spec->GetName();
156 else
157 return nullptr;
158}
159
160void BreakpointLocation::SetQueueName(const char *queue_name) {
161 if (queue_name != nullptr)
163 else {
164 // If we're resetting this to an invalid thread id, then don't make an
165 // options pointer just to do that.
166 if (m_options_up != nullptr)
167 m_options_up->GetThreadSpec()->SetQueueName(queue_name);
168 }
169 SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
170}
171
173 const ThreadSpec *thread_spec =
176 if (thread_spec)
177 return thread_spec->GetQueueName();
178 else
179 return nullptr;
180}
181
183 if (m_options_up != nullptr && m_options_up->HasCallback())
184 return m_options_up->InvokeCallback(context, m_owner.GetID(), GetID());
185 else
186 return m_owner.InvokeCallback(context, GetID());
187}
188
190 if (m_options_up != nullptr && m_options_up->HasCallback())
191 return m_options_up->IsCallbackSynchronous();
192 else
194}
195
197 void *baton, bool is_synchronous) {
198 // The default "Baton" class will keep a copy of "baton" and won't free or
199 // delete it when it goes out of scope.
201 callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
202 SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
203}
204
206 const BatonSP &baton_sp,
207 bool is_synchronous) {
208 GetLocationOptions().SetCallback(callback, baton_sp, is_synchronous);
209 SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
210}
211
214}
215
216void BreakpointLocation::SetCondition(const char *condition) {
217 GetLocationOptions().SetCondition(condition);
218 SendBreakpointLocationChangedEvent(eBreakpointEventTypeConditionChanged);
219}
220
221const char *BreakpointLocation::GetConditionText(size_t *hash) const {
223 .GetConditionText(hash);
224}
225
227 Status &error) {
229
230 std::lock_guard<std::mutex> guard(m_condition_mutex);
231
232 size_t condition_hash;
233 const char *condition_text = GetConditionText(&condition_hash);
234
235 if (!condition_text) {
236 m_user_expression_sp.reset();
237 return false;
238 }
239
240 error.Clear();
241
242 DiagnosticManager diagnostics;
243
244 if (condition_hash != m_condition_hash || !m_user_expression_sp ||
245 !m_user_expression_sp->IsParseCacheable() ||
246 !m_user_expression_sp->MatchesContext(exe_ctx)) {
248 // See if we can figure out the language from the frame, otherwise use the
249 // default language:
251 if (comp_unit)
252 language = comp_unit->GetLanguage();
253
254 m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
255 condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
256 EvaluateExpressionOptions(), nullptr, error));
257 if (error.Fail()) {
258 LLDB_LOGF(log, "Error getting condition expression: %s.",
259 error.AsCString());
260 m_user_expression_sp.reset();
261 return true;
262 }
263
264 if (!m_user_expression_sp->Parse(diagnostics, exe_ctx,
266 false)) {
269 "Couldn't parse conditional expression:"));
270
271 m_user_expression_sp.reset();
272 return true;
273 }
274
275 m_condition_hash = condition_hash;
276 }
277
278 // We need to make sure the user sees any parse errors in their condition, so
279 // we'll hook the constructor errors up to the debugger's Async I/O.
280
281 ValueObjectSP result_value_sp;
282
284 options.SetUnwindOnError(true);
285 options.SetIgnoreBreakpoints(true);
286 options.SetTryAllThreads(true);
288 true); // Don't generate a user variable for condition expressions.
289
290 Status expr_error;
291
292 diagnostics.Clear();
293
294 ExpressionVariableSP result_variable_sp;
295
296 ExpressionResults result_code = m_user_expression_sp->Execute(
297 diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
298
299 bool ret;
300
301 if (result_code == eExpressionCompleted) {
302 if (!result_variable_sp) {
303 error = Status::FromErrorString("Expression did not return a result");
304 return false;
305 }
306
307 result_value_sp = result_variable_sp->GetValueObject();
308
309 if (result_value_sp) {
310 ret = result_value_sp->IsLogicalTrue(error);
311 if (log) {
312 if (error.Success()) {
313 LLDB_LOGF(log, "Condition successfully evaluated, result is %s.\n",
314 ret ? "true" : "false");
315 } else {
317 "Failed to get an integer result from the expression");
318 ret = false;
319 }
320 }
321 } else {
322 ret = false;
324 "Failed to get any result from the expression");
325 }
326 } else {
327 ret = false;
328 error = Status::FromError(diagnostics.GetAsError(
329 lldb::eExpressionParseError, "Couldn't execute expression:"));
330 }
331
332 return ret;
333}
334
338}
339
342 SendBreakpointLocationChangedEvent(eBreakpointEventTypeIgnoreChanged);
343}
344
346 if (m_options_up != nullptr) {
347 uint32_t loc_ignore = m_options_up->GetIgnoreCount();
348 if (loc_ignore != 0)
349 m_options_up->SetIgnoreCount(loc_ignore - 1);
350 }
351}
352
354 uint32_t owner_ignore = GetBreakpoint().GetIgnoreCount();
355 uint32_t loc_ignore = 0;
356 if (m_options_up != nullptr)
357 loc_ignore = m_options_up->GetIgnoreCount();
358
359 if (loc_ignore != 0 || owner_ignore != 0) {
361 DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
362 // since it won't get a chance to.
363 return false;
364 }
365 return true;
366}
367
369 // If we make the copy we don't copy the callbacks because that is
370 // potentially expensive and we don't want to do that for the simple case
371 // where someone is just disabling the location.
372 if (m_options_up == nullptr)
373 m_options_up = std::make_unique<BreakpointOptions>(false);
374
375 return *m_options_up;
376}
377
379 return thread.MatchesSpec(
381 .GetThreadSpecNoCreate());
382}
383
384// RETURNS - true if we should stop at this breakpoint, false if we
385// should continue. Note, we don't check the thread spec for the breakpoint
386// here, since if the breakpoint is not for this thread, then the event won't
387// even get reported, so the check is redundant.
388
390 bool should_stop = true;
392
393 // Do this first, if a location is disabled, it shouldn't increment its hit
394 // count.
395 if (!IsEnabled())
396 return false;
397
398 // We only run synchronous callbacks in ShouldStop:
399 context->is_synchronous = true;
400 should_stop = InvokeCallback(context);
401
402 if (log) {
403 StreamString s;
405 LLDB_LOGF(log, "Hit breakpoint location: %s, %s.\n", s.GetData(),
406 should_stop ? "stopping" : "continuing");
407 }
408
409 return should_stop;
410}
411
413 if (IsEnabled()) {
414 // Step our hit count, and also step the hit count of the owner.
417 }
418}
419
421 if (IsEnabled()) {
422 // Step our hit count, and also step the hit count of the owner.
425 }
426}
427
429 return m_bp_site_sp.get() != nullptr;
430}
431
433 return m_bp_site_sp;
434}
435
437 if (m_bp_site_sp)
438 return true;
439
440 Process *process = m_owner.GetTarget().GetProcessSP().get();
441 if (process == nullptr)
442 return false;
443
444 lldb::break_id_t new_id =
445 process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware());
446
447 if (new_id == LLDB_INVALID_BREAK_ID) {
449 if (log)
450 log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
452 }
453
454 return IsResolved();
455}
456
458 m_bp_site_sp = bp_site_sp;
459 SendBreakpointLocationChangedEvent(eBreakpointEventTypeLocationsResolved);
460 return true;
461}
462
464 if (m_bp_site_sp.get()) {
465 ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
466 // If the process exists, get it to remove the owner, it will remove the
467 // physical implementation of the breakpoint as well if there are no more
468 // owners. Otherwise just remove this owner.
469 if (process_sp)
470 process_sp->RemoveConstituentFromBreakpointSite(GetBreakpoint().GetID(),
472 else
473 m_bp_site_sp->RemoveConstituent(GetBreakpoint().GetID(), GetID());
474
475 m_bp_site_sp.reset();
476 return true;
477 }
478 return false;
479}
480
483 SymbolContext sc;
484
485 // If the description level is "initial" then the breakpoint is printing out
486 // our initial state, and we should let it decide how it wants to print our
487 // label.
488 if (level != eDescriptionLevelInitial) {
489 s->Indent();
491 }
492
493 if (level == lldb::eDescriptionLevelBrief)
494 return;
495
496 if (level != eDescriptionLevelInitial)
497 s->PutCString(": ");
498
500 s->IndentMore();
501
504
505 if (level == lldb::eDescriptionLevelFull ||
506 level == eDescriptionLevelInitial) {
507 if (IsReExported())
508 s->PutCString("re-exported target = ");
509 else
510 s->PutCString("where = ");
511
512 // If there's a preferred line entry for printing, use that.
513 bool show_function_info = true;
514 if (auto preferred = GetPreferredLineEntry()) {
515 sc.line_entry = *preferred;
516 // FIXME: We're going to get the function name wrong when the preferred
517 // line entry is not the lowest one. For now, just leave the function
518 // out in this case, but we really should also figure out how to easily
519 // fake the function name here.
520 show_function_info = false;
521 }
523 false, true, false, show_function_info,
524 show_function_info, show_function_info);
525 } else {
526 if (sc.module_sp) {
527 s->EOL();
528 s->Indent("module = ");
529 sc.module_sp->GetFileSpec().Dump(s->AsRawOstream());
530 }
531
532 if (sc.comp_unit != nullptr) {
533 s->EOL();
534 s->Indent("compile unit = ");
536
537 if (sc.function != nullptr) {
538 s->EOL();
539 s->Indent("function = ");
540 s->PutCString(sc.function->GetName().AsCString("<unknown>"));
541 if (ConstString mangled_name =
543 s->EOL();
544 s->Indent("mangled function = ");
545 s->PutCString(mangled_name.AsCString());
546 }
547 }
548
549 if (sc.line_entry.line > 0) {
550 s->EOL();
551 s->Indent("location = ");
552 if (auto preferred = GetPreferredLineEntry())
553 preferred->DumpStopContext(s, true);
554 else
555 sc.line_entry.DumpStopContext(s, true);
556 }
557
558 } else {
559 // If we don't have a comp unit, see if we have a symbol we can print.
560 if (sc.symbol) {
561 s->EOL();
562 if (IsReExported())
563 s->Indent("re-exported target = ");
564 else
565 s->Indent("symbol = ");
566 s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
567 }
568 }
569 }
570 }
571
572 if (level == lldb::eDescriptionLevelVerbose) {
573 s->EOL();
574 s->Indent();
575 }
576
578 (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
579 s->Printf(", ");
580 s->Printf("address = ");
581
582 ExecutionContextScope *exe_scope = nullptr;
583 Target *target = &m_owner.GetTarget();
584 if (target)
585 exe_scope = target->GetProcessSP().get();
586 if (exe_scope == nullptr)
587 exe_scope = target;
588
589 if (level == eDescriptionLevelInitial)
592 else
595
596 if (IsIndirect() && m_bp_site_sp) {
597 Address resolved_address;
598 resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target);
599 Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol();
600 if (resolved_symbol) {
601 if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)
602 s->Printf(", ");
603 else if (level == lldb::eDescriptionLevelVerbose) {
604 s->EOL();
605 s->Indent();
606 }
607 s->Printf("indirect target = %s",
608 resolved_symbol->GetName().GetCString());
609 }
610 }
611
612 bool is_resolved = IsResolved();
613 bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
614
615 if (level == lldb::eDescriptionLevelVerbose) {
616 s->EOL();
617 s->Indent();
618 s->Printf("resolved = %s\n", is_resolved ? "true" : "false");
619 s->Indent();
620 s->Printf("hardware = %s\n", is_hardware ? "true" : "false");
621 s->Indent();
622 s->Printf("hit count = %-4u\n", GetHitCount());
623
624 if (m_options_up) {
625 s->Indent();
626 m_options_up->GetDescription(s, level);
627 s->EOL();
628 }
629 s->IndentLess();
630 } else if (level != eDescriptionLevelInitial) {
631 s->Printf(", %sresolved, %shit count = %u ", (is_resolved ? "" : "un"),
632 (is_hardware ? "hardware, " : ""), GetHitCount());
633 if (m_options_up) {
634 m_options_up->GetDescription(s, level);
635 }
636 }
637}
638
640 if (s == nullptr)
641 return;
642
643 bool is_resolved = IsResolved();
644 bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
645
648 ->GetTID();
649 s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64
650 " load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint "
651 "hit_count = %-4u ignore_count = %-4u",
652 GetID(), tid,
654 (m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled())
655 ? "enabled "
656 : "disabled",
657 is_hardware ? "hardware" : "software", GetHitCount(),
659 .GetIgnoreCount());
660}
661
663 lldb::BreakpointEventType eventKind) {
666 auto data_sp = std::make_shared<Breakpoint::BreakpointEventData>(
667 eventKind, m_owner.shared_from_this());
668 data_sp->GetBreakpointLocationCollection().Add(shared_from_this());
670 data_sp);
671 }
672}
673
675 auto preferred_opt = GetPreferredLineEntry();
676 if (!preferred_opt)
677 return {};
678 LineEntry preferred = *preferred_opt;
679 SymbolContext sc;
681 return {};
682 // Don't return anything special if frame 0 is the preferred line entry.
683 // We not really telling the stack frame list to do anything special in that
684 // case.
685 if (!LineEntry::Compare(sc.line_entry, preferred))
686 return {};
687
688 if (!sc.block)
689 return {};
690
691 // Blocks have their line info in Declaration form, so make one here:
692 Declaration preferred_decl(preferred.GetFile(), preferred.line,
693 preferred.column);
694
695 uint32_t depth = 0;
696 Block *inlined_block = sc.block->GetContainingInlinedBlock();
697 while (inlined_block) {
698 // If we've moved to a block that this isn't the start of, that's not
699 // our inlining info or call site, so we can stop here.
700 Address start_address;
701 if (!inlined_block->GetStartAddress(start_address) ||
702 start_address != m_address)
703 return {};
704
705 const InlineFunctionInfo *info = inlined_block->GetInlinedFunctionInfo();
706 if (info) {
707 if (preferred_decl == info->GetDeclaration())
708 return depth;
709 if (preferred_decl == info->GetCallSite())
710 return depth + 1;
711 }
712 inlined_block = inlined_block->GetInlinedParent();
713 depth++;
714 }
715 return {};
716}
717
719 m_address = swap_from->m_address;
721 swap_from->m_should_resolve_indirect_functions;
722 m_is_reexported = swap_from->m_is_reexported;
723 m_is_indirect = swap_from->m_is_indirect;
724 m_user_expression_sp.reset();
725}
726
728 if (thread_id != LLDB_INVALID_THREAD_ID)
729 GetLocationOptions().SetThreadID(thread_id);
730 else {
731 // If we're resetting this to an invalid thread id, then don't make an
732 // options pointer just to do that.
733 if (m_options_up != nullptr)
734 m_options_up->SetThreadID(thread_id);
735 }
736}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
Definition: Log.h:376
A section + offset based address class.
Definition: Address.h:62
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Definition: Address.cpp:1047
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
Definition: Address.cpp:832
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
Definition: Address.cpp:370
@ DumpStyleFileAddress
Display as the file address (if any).
Definition: Address.h:87
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
Definition: Address.h:93
@ DumpStyleLoadAddress
Display as the load address (if resolved).
Definition: Address.h:99
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.
Definition: Address.cpp:408
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:342
CompileUnit * CalculateSymbolContextCompileUnit() const
Definition: Address.cpp:858
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:900
A class that describes a single lexical block.
Definition: Block.h:41
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Definition: Block.cpp:201
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
Definition: Block.h:266
bool GetStartAddress(Address &addr)
Definition: Block.cpp:327
Block * GetInlinedParent()
Get the inlined parent block for this block.
Definition: Block.cpp:207
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.
const std::optional< LineEntry > GetPreferredLineEntry()
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...
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)
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.
Address m_address
The address defining this location.
bool IsEnabled() const
Check the Enable/Disable state.
bool IgnoreCountShouldStop()
BreakpointLocation::IgnoreCountShouldStop can only be called once per stop.
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 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.
std::optional< uint32_t > GetSuggestedStackFrameIndex()
If this location knows that the virtual stack frame it represents is not frame 0, return the suggeste...
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...
Definition: Breakpoint.h:81
bool IsAutoContinue() const
Check the AutoContinue state.
Definition: Breakpoint.cpp:331
bool InvokeCallback(StoppointCallbackContext *context, lldb::break_id_t bp_loc_id)
Invoke the callback action when the breakpoint is hit.
Definition: Breakpoint.cpp:429
StoppointHitCounter m_hit_counter
Number of times this breakpoint has been hit.
Definition: Breakpoint.h:668
uint32_t GetIgnoreCount() const
Return the current ignore count/.
Definition: Breakpoint.cpp:316
bool IsEnabled() override
Check the Enable/Disable state.
Definition: Breakpoint.cpp:300
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
Definition: Breakpoint.cpp:434
bool IsHardware() const
Definition: Breakpoint.h:520
Target & GetTarget()
Accessor for the breakpoint Target.
Definition: Breakpoint.h:463
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
Definition: Breakpoint.cpp:250
bool EventTypeHasListeners(uint32_t event_type)
Definition: Broadcaster.h:251
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
Definition: Broadcaster.h:168
A class that describes a compilation unit.
Definition: CompileUnit.h:43
const FileSpec & GetPrimaryFile() const
Return the primary source spec associated with this compile unit.
Definition: CompileUnit.h:232
lldb::LanguageType GetLanguage()
A uniqued constant string class.
Definition: ConstString.h:40
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:188
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.
Definition: ConstString.h:216
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
llvm::Error GetAsError(lldb::ExpressionResults result, llvm::Twine message={}) const
Returns an ExpressionError with arg as error code.
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:359
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:392
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:363
"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.
Definition: FileSpec.h:240
Declaration & GetDeclaration()
Get accessor for the declaration information.
Definition: Function.cpp:53
ConstString GetName() const
Definition: Function.cpp:720
const Mangled & GetMangled() const
Definition: Function.h:532
A class that describes information for an inlined function.
Definition: Function.h:125
Declaration & GetCallSite()
Get accessor for the call site declaration information.
Definition: Function.cpp:108
void void void void void Warning(const char *fmt,...) __attribute__((format(printf
Definition: Log.cpp:211
ConstString & GetMangledName()
Mangled name get accessor.
Definition: Mangled.h:145
A plug-in interface definition class for debugging a process.
Definition: Process.h:343
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
Definition: Process.cpp:1636
An error handling class.
Definition: Status.h:115
static Status FromErrorString(const char *str)
Definition: Status.h:138
static Status FromError(llvm::Error error)
Avoid using this in new code. Migrate APIs to llvm::Expected instead.
Definition: Status.cpp:137
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
Definition: Stoppoint.cpp:22
const char * GetData() const
Definition: StreamString.h:45
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:401
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:65
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:155
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:198
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:195
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:34
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.
bool IsIndirect() const
Definition: Symbol.cpp:223
ConstString GetName() const
Definition: Symbol.cpp:548
Symbol * CalculateSymbolContextSymbol() override
Definition: Symbol.cpp:451
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:297
@ eBroadcastBitBreakpointChanged
Definition: Target.h:517
void SetIndex(uint32_t index)
Definition: ThreadSpec.h:45
void SetName(llvm::StringRef name)
Definition: ThreadSpec.h:49
uint32_t GetIndex() const
Definition: ThreadSpec.h:55
const char * GetName() const
Definition: ThreadSpec.cpp:68
void SetQueueName(llvm::StringRef queue_name)
Definition: ThreadSpec.h:51
const char * GetQueueName() const
Definition: ThreadSpec.cpp:72
lldb::tid_t GetTID() const
Definition: ThreadSpec.h:57
virtual bool MatchesSpec(const ThreadSpec *spec)
Definition: Thread.cpp:1074
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:37
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:90
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.
Definition: Log.h:332
std::function< bool(void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)> BreakpointHitCallback
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::BreakpointSite > BreakpointSiteSP
Definition: lldb-forward.h:323
std::shared_ptr< lldb_private::BreakpointLocation > BreakpointLocationSP
Definition: lldb-forward.h:324
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelBrief
@ eDescriptionLevelInitial
@ eDescriptionLevelFull
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
std::shared_ptr< lldb_private::ExpressionVariable > ExpressionVariableSP
Definition: lldb-forward.h:351
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
ExpressionResults
The results of expression evaluation.
@ eExpressionCompleted
@ eExpressionParseError
int32_t break_id_t
Definition: lldb-types.h:86
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:389
std::shared_ptr< lldb_private::Baton > BatonSP
Definition: lldb-forward.h:319
uint64_t addr_t
Definition: lldb-types.h:80
uint64_t tid_t
Definition: lldb-types.h:84
A line table entry class.
Definition: LineEntry.h:21
uint16_t column
The column number of the source line, or zero if there is no column information.
Definition: LineEntry.h:151
static int Compare(const LineEntry &lhs, const LineEntry &rhs)
Compare two LineEntry objects.
Definition: LineEntry.cpp:147
uint32_t line
The source line number, or LLDB_INVALID_LINE_NUMBER if there is no line number information.
Definition: LineEntry.h:147
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.
Definition: LineEntry.cpp:39
const FileSpec & GetFile() const
Helper to access the file.
Definition: LineEntry.h:134