LLDB  mainline
BreakpointLocation.cpp
Go to the documentation of this file.
1 //===-- BreakpointLocation.cpp ----------------------------------*- C++ -*-===//
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"
14 #include "lldb/Core/ValueObject.h"
19 #include "lldb/Symbol/Symbol.h"
20 #include "lldb/Symbol/TypeSystem.h"
21 #include "lldb/Target/Process.h"
22 #include "lldb/Target/Target.h"
23 #include "lldb/Target/Thread.h"
24 #include "lldb/Target/ThreadSpec.h"
25 #include "lldb/Utility/Log.h"
27 
28 using namespace lldb;
29 using namespace lldb_private;
30 
31 BreakpointLocation::BreakpointLocation(break_id_t loc_id, Breakpoint &owner,
32  const Address &addr, lldb::tid_t tid,
33  bool hardware, bool check_for_resolver)
34  : StoppointLocation(loc_id, addr.GetOpcodeLoadAddress(&owner.GetTarget()),
35  hardware),
36  m_being_created(true), m_should_resolve_indirect_functions(false),
37  m_is_reexported(false), m_is_indirect(false), m_address(addr),
38  m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex() {
39  if (check_for_resolver) {
40  Symbol *symbol = m_address.CalculateSymbolContextSymbol();
41  if (symbol && symbol->IsIndirect()) {
42  SetShouldResolveIndirectFunctions(true);
43  }
44  }
45 
46  SetThreadID(tid);
47  m_being_created = false;
48 }
49 
50 BreakpointLocation::~BreakpointLocation() { ClearBreakpointSite(); }
51 
53  return m_address.GetOpcodeLoadAddress(&m_owner.GetTarget());
54 }
55 
56 const BreakpointOptions *
58 const {
59  if (m_options_up && m_options_up->IsOptionSet(kind))
60  return m_options_up.get();
61  else
62  return m_owner.GetOptions();
63 }
64 
65 Address &BreakpointLocation::GetAddress() { return m_address; }
66 
68 
69 Target &BreakpointLocation::GetTarget() { return m_owner.GetTarget(); }
70 
72  if (!m_owner.IsEnabled())
73  return false;
74  else if (m_options_up != nullptr)
75  return m_options_up->IsEnabled();
76  else
77  return true;
78 }
79 
80 void BreakpointLocation::SetEnabled(bool enabled) {
81  GetLocationOptions()->SetEnabled(enabled);
82  if (enabled) {
83  ResolveBreakpointSite();
84  } else {
85  ClearBreakpointSite();
86  }
87  SendBreakpointLocationChangedEvent(enabled ? eBreakpointEventTypeEnabled
88  : eBreakpointEventTypeDisabled);
89 }
90 
92  if (m_options_up &&
93  m_options_up->IsOptionSet(BreakpointOptions::eAutoContinue))
94  return m_options_up->IsAutoContinue();
95  else
96  return m_owner.IsAutoContinue();
97 }
98 
99 void BreakpointLocation::SetAutoContinue(bool auto_continue) {
100  GetLocationOptions()->SetAutoContinue(auto_continue);
101  SendBreakpointLocationChangedEvent(eBreakpointEventTypeAutoContinueChanged);
102 }
103 
105  if (thread_id != LLDB_INVALID_THREAD_ID)
106  GetLocationOptions()->SetThreadID(thread_id);
107  else {
108  // If we're resetting this to an invalid thread id, then don't make an
109  // options pointer just to do that.
110  if (m_options_up != nullptr)
111  m_options_up->SetThreadID(thread_id);
112  }
113  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
114 }
115 
117  const ThreadSpec *thread_spec =
118  GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
119  ->GetThreadSpecNoCreate();
120  if (thread_spec)
121  return thread_spec->GetTID();
122  else
123  return LLDB_INVALID_THREAD_ID;
124 }
125 
127  if (index != 0)
128  GetLocationOptions()->GetThreadSpec()->SetIndex(index);
129  else {
130  // If we're resetting this to an invalid thread id, then don't make an
131  // options pointer just to do that.
132  if (m_options_up != nullptr)
133  m_options_up->GetThreadSpec()->SetIndex(index);
134  }
135  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
136 }
137 
139  const ThreadSpec *thread_spec =
140  GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
141  ->GetThreadSpecNoCreate();
142  if (thread_spec)
143  return thread_spec->GetIndex();
144  else
145  return 0;
146 }
147 
148 void BreakpointLocation::SetThreadName(const char *thread_name) {
149  if (thread_name != nullptr)
150  GetLocationOptions()->GetThreadSpec()->SetName(thread_name);
151  else {
152  // If we're resetting this to an invalid thread id, then don't make an
153  // options pointer just to do that.
154  if (m_options_up != nullptr)
155  m_options_up->GetThreadSpec()->SetName(thread_name);
156  }
157  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
158 }
159 
161  const ThreadSpec *thread_spec =
162  GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
163  ->GetThreadSpecNoCreate();
164  if (thread_spec)
165  return thread_spec->GetName();
166  else
167  return nullptr;
168 }
169 
170 void BreakpointLocation::SetQueueName(const char *queue_name) {
171  if (queue_name != nullptr)
172  GetLocationOptions()->GetThreadSpec()->SetQueueName(queue_name);
173  else {
174  // If we're resetting this to an invalid thread id, then don't make an
175  // options pointer just to do that.
176  if (m_options_up != nullptr)
177  m_options_up->GetThreadSpec()->SetQueueName(queue_name);
178  }
179  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
180 }
181 
182 const char *BreakpointLocation::GetQueueName() const {
183  const ThreadSpec *thread_spec =
184  GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
185  ->GetThreadSpecNoCreate();
186  if (thread_spec)
187  return thread_spec->GetQueueName();
188  else
189  return nullptr;
190 }
191 
193  if (m_options_up != nullptr && m_options_up->HasCallback())
194  return m_options_up->InvokeCallback(context, m_owner.GetID(), GetID());
195  else
196  return m_owner.InvokeCallback(context, GetID());
197 }
198 
199 void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
200  void *baton, bool is_synchronous) {
201  // The default "Baton" class will keep a copy of "baton" and won't free or
202  // delete it when it goes goes out of scope.
203  GetLocationOptions()->SetCallback(
204  callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
205  SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
206 }
207 
208 void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
209  const BatonSP &baton_sp,
210  bool is_synchronous) {
211  GetLocationOptions()->SetCallback(callback, baton_sp, is_synchronous);
212  SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
213 }
214 
216  GetLocationOptions()->ClearCallback();
217 }
218 
219 void BreakpointLocation::SetCondition(const char *condition) {
220  GetLocationOptions()->SetCondition(condition);
221  SendBreakpointLocationChangedEvent(eBreakpointEventTypeConditionChanged);
222 }
223 
224 const char *BreakpointLocation::GetConditionText(size_t *hash) const {
225  return GetOptionsSpecifyingKind(BreakpointOptions::eCondition)
226  ->GetConditionText(hash);
227 }
228 
230  Status &error) {
232 
233  std::lock_guard<std::mutex> guard(m_condition_mutex);
234 
235  size_t condition_hash;
236  const char *condition_text = GetConditionText(&condition_hash);
237 
238  if (!condition_text) {
239  m_user_expression_sp.reset();
240  return false;
241  }
242 
243  error.Clear();
244 
245  DiagnosticManager diagnostics;
246 
247  if (condition_hash != m_condition_hash || !m_user_expression_sp ||
248  !m_user_expression_sp->MatchesContext(exe_ctx)) {
250  // See if we can figure out the language from the frame, otherwise use the
251  // default language:
252  CompileUnit *comp_unit = m_address.CalculateSymbolContextCompileUnit();
253  if (comp_unit)
254  language = comp_unit->GetLanguage();
255 
256  m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
257  condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
258  EvaluateExpressionOptions(), nullptr, error));
259  if (error.Fail()) {
260  if (log)
261  log->Printf("Error getting condition expression: %s.",
262  error.AsCString());
263  m_user_expression_sp.reset();
264  return true;
265  }
266 
267  if (!m_user_expression_sp->Parse(diagnostics, exe_ctx,
269  false)) {
271  "Couldn't parse conditional expression:\n%s",
272  diagnostics.GetString().c_str());
273  m_user_expression_sp.reset();
274  return true;
275  }
276 
277  m_condition_hash = condition_hash;
278  }
279 
280  // We need to make sure the user sees any parse errors in their condition, so
281  // we'll hook the constructor errors up to the debugger's Async I/O.
282 
283  ValueObjectSP result_value_sp;
284 
286  options.SetUnwindOnError(true);
287  options.SetIgnoreBreakpoints(true);
288  options.SetTryAllThreads(true);
289  options.SetResultIsInternal(
290  true); // Don't generate a user variable for condition expressions.
291 
292  Status expr_error;
293 
294  diagnostics.Clear();
295 
296  ExpressionVariableSP result_variable_sp;
297 
298  ExpressionResults result_code = m_user_expression_sp->Execute(
299  diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
300 
301  bool ret;
302 
303  if (result_code == eExpressionCompleted) {
304  if (!result_variable_sp) {
305  error.SetErrorString("Expression did not return a result");
306  return false;
307  }
308 
309  result_value_sp = result_variable_sp->GetValueObject();
310 
311  if (result_value_sp) {
312  ret = result_value_sp->IsLogicalTrue(error);
313  if (log) {
314  if (error.Success()) {
315  log->Printf("Condition successfully evaluated, result is %s.\n",
316  ret ? "true" : "false");
317  } else {
318  error.SetErrorString(
319  "Failed to get an integer result from the expression");
320  ret = false;
321  }
322  }
323  } else {
324  ret = false;
325  error.SetErrorString("Failed to get any result from the expression");
326  }
327  } else {
328  ret = false;
329  error.SetErrorStringWithFormat("Couldn't execute expression:\n%s",
330  diagnostics.GetString().c_str());
331  }
332 
333  return ret;
334 }
335 
337  return GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
338  ->GetIgnoreCount();
339 }
340 
342  GetLocationOptions()->SetIgnoreCount(n);
343  SendBreakpointLocationChangedEvent(eBreakpointEventTypeIgnoreChanged);
344 }
345 
347  if (m_options_up != nullptr) {
348  uint32_t loc_ignore = m_options_up->GetIgnoreCount();
349  if (loc_ignore != 0)
350  m_options_up->SetIgnoreCount(loc_ignore - 1);
351  }
352 }
353 
355  if (m_options_up != nullptr) {
356  uint32_t loc_ignore = m_options_up->GetIgnoreCount();
357  if (loc_ignore != 0) {
358  m_owner.DecrementIgnoreCount();
359  DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
360  // since it won't get a
361  // chance to.
362  return false;
363  }
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.reset(new BreakpointOptions(false));
374 
375  return m_options_up.get();
376 }
377 
379  return thread
380  ->MatchesSpec(GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
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  if (!IgnoreCountShouldStop())
399  return false;
400 
401  if (!m_owner.IgnoreCountShouldStop())
402  return false;
403 
404  // We only run synchronous callbacks in ShouldStop:
405  context->is_synchronous = true;
406  should_stop = InvokeCallback(context);
407 
408  if (log) {
409  StreamString s;
410  GetDescription(&s, lldb::eDescriptionLevelVerbose);
411  log->Printf("Hit breakpoint location: %s, %s.\n", s.GetData(),
412  should_stop ? "stopping" : "continuing");
413  }
414 
415  return should_stop;
416 }
417 
418 void BreakpointLocation::BumpHitCount() {
419  if (IsEnabled()) {
420  // Step our hit count, and also step the hit count of the owner.
421  IncrementHitCount();
422  m_owner.IncrementHitCount();
423  }
424 }
425 
426 void BreakpointLocation::UndoBumpHitCount() {
427  if (IsEnabled()) {
428  // Step our hit count, and also step the hit count of the owner.
429  DecrementHitCount();
430  m_owner.DecrementHitCount();
431  }
432 }
433 
435  return m_bp_site_sp.get() != nullptr;
436 }
437 
438 lldb::BreakpointSiteSP BreakpointLocation::GetBreakpointSite() const {
439  return m_bp_site_sp;
440 }
441 
443  if (m_bp_site_sp)
444  return true;
445 
446  Process *process = m_owner.GetTarget().GetProcessSP().get();
447  if (process == nullptr)
448  return false;
449 
450  lldb::break_id_t new_id =
451  process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware());
452 
453  if (new_id == LLDB_INVALID_BREAK_ID) {
455  if (log)
456  log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
457  m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()));
458  }
459 
460  return IsResolved();
461 }
462 
463 bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) {
464  m_bp_site_sp = bp_site_sp;
465  SendBreakpointLocationChangedEvent(eBreakpointEventTypeLocationsResolved);
466  return true;
467 }
468 
470  if (m_bp_site_sp.get()) {
471  ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
472  // If the process exists, get it to remove the owner, it will remove the
473  // physical implementation of the breakpoint as well if there are no more
474  // owners. Otherwise just remove this owner.
475  if (process_sp)
476  process_sp->RemoveOwnerFromBreakpointSite(GetBreakpoint().GetID(),
477  GetID(), m_bp_site_sp);
478  else
479  m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
480 
481  m_bp_site_sp.reset();
482  return true;
483  }
484  return false;
485 }
486 
488  lldb::DescriptionLevel level) {
489  SymbolContext sc;
490 
491  // If the description level is "initial" then the breakpoint is printing out
492  // our initial state, and we should let it decide how it wants to print our
493  // label.
494  if (level != eDescriptionLevelInitial) {
495  s->Indent();
496  BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
497  }
498 
499  if (level == lldb::eDescriptionLevelBrief)
500  return;
501 
502  if (level != eDescriptionLevelInitial)
503  s->PutCString(": ");
504 
505  if (level == lldb::eDescriptionLevelVerbose)
506  s->IndentMore();
507 
508  if (m_address.IsSectionOffset()) {
509  m_address.CalculateSymbolContext(&sc);
510 
511  if (level == lldb::eDescriptionLevelFull ||
512  level == eDescriptionLevelInitial) {
513  if (IsReExported())
514  s->PutCString("re-exported target = ");
515  else
516  s->PutCString("where = ");
517  sc.DumpStopContext(s, m_owner.GetTarget().GetProcessSP().get(), m_address,
518  false, true, false, true, true);
519  } else {
520  if (sc.module_sp) {
521  s->EOL();
522  s->Indent("module = ");
523  sc.module_sp->GetFileSpec().Dump(s);
524  }
525 
526  if (sc.comp_unit != nullptr) {
527  s->EOL();
528  s->Indent("compile unit = ");
529  static_cast<FileSpec *>(sc.comp_unit)->GetFilename().Dump(s);
530 
531  if (sc.function != nullptr) {
532  s->EOL();
533  s->Indent("function = ");
534  s->PutCString(sc.function->GetName().AsCString("<unknown>"));
535  }
536 
537  if (sc.line_entry.line > 0) {
538  s->EOL();
539  s->Indent("location = ");
540  sc.line_entry.DumpStopContext(s, true);
541  }
542 
543  } else {
544  // If we don't have a comp unit, see if we have a symbol we can print.
545  if (sc.symbol) {
546  s->EOL();
547  if (IsReExported())
548  s->Indent("re-exported target = ");
549  else
550  s->Indent("symbol = ");
551  s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
552  }
553  }
554  }
555  }
556 
557  if (level == lldb::eDescriptionLevelVerbose) {
558  s->EOL();
559  s->Indent();
560  }
561 
562  if (m_address.IsSectionOffset() &&
563  (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
564  s->Printf(", ");
565  s->Printf("address = ");
566 
567  ExecutionContextScope *exe_scope = nullptr;
568  Target *target = &m_owner.GetTarget();
569  if (target)
570  exe_scope = target->GetProcessSP().get();
571  if (exe_scope == nullptr)
572  exe_scope = target;
573 
574  if (level == eDescriptionLevelInitial)
575  m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress,
577  else
578  m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress,
580 
581  if (IsIndirect() && m_bp_site_sp) {
582  Address resolved_address;
583  resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target);
584  Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol();
585  if (resolved_symbol) {
586  if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)
587  s->Printf(", ");
588  else if (level == lldb::eDescriptionLevelVerbose) {
589  s->EOL();
590  s->Indent();
591  }
592  s->Printf("indirect target = %s",
593  resolved_symbol->GetName().GetCString());
594  }
595  }
596 
597  if (level == lldb::eDescriptionLevelVerbose) {
598  s->EOL();
599  s->Indent();
600  s->Printf("resolved = %s\n", IsResolved() ? "true" : "false");
601 
602  s->Indent();
603  s->Printf("hit count = %-4u\n", GetHitCount());
604 
605  if (m_options_up) {
606  s->Indent();
607  m_options_up->GetDescription(s, level);
608  s->EOL();
609  }
610  s->IndentLess();
611  } else if (level != eDescriptionLevelInitial) {
612  s->Printf(", %sresolved, hit count = %u ", (IsResolved() ? "" : "un"),
613  GetHitCount());
614  if (m_options_up) {
615  m_options_up->GetDescription(s, level);
616  }
617  }
618 }
619 
621  if (s == nullptr)
622  return;
623 
624  lldb::tid_t tid = GetOptionsSpecifyingKind(BreakpointOptions::eThreadSpec)
625  ->GetThreadSpecNoCreate()->GetTID();
626  s->Printf("BreakpointLocation %u: tid = %4.4" PRIx64
627  " load addr = 0x%8.8" PRIx64 " state = %s type = %s breakpoint "
628  "hw_index = %i hit_count = %-4u ignore_count = %-4u",
629  GetID(), tid,
630  (uint64_t)m_address.GetOpcodeLoadAddress(&m_owner.GetTarget()),
631  (m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled())
632  ? "enabled "
633  : "disabled",
634  IsHardware() ? "hardware" : "software", GetHardwareIndex(),
635  GetHitCount(),
636  GetOptionsSpecifyingKind(BreakpointOptions::eIgnoreCount)
637  ->GetIgnoreCount());
638 }
639 
640 void BreakpointLocation::SendBreakpointLocationChangedEvent(
641  lldb::BreakpointEventType eventKind) {
642  if (!m_being_created && !m_owner.IsInternal() &&
643  m_owner.GetTarget().EventTypeHasListeners(
646  eventKind, m_owner.shared_from_this());
647  data->GetBreakpointLocationCollection().Add(shared_from_this());
648  m_owner.GetTarget().BroadcastEvent(Target::eBroadcastBitBreakpointChanged,
649  data);
650  }
651 }
652 
653 void BreakpointLocation::SwapLocation(BreakpointLocationSP swap_from) {
654  m_address = swap_from->m_address;
655  m_should_resolve_indirect_functions =
656  swap_from->m_should_resolve_indirect_functions;
657  m_is_reexported = swap_from->m_is_reexported;
658  m_is_indirect = swap_from->m_is_indirect;
659  m_user_expression_sp.reset();
660 }
void Add(const lldb::BreakpointLocationSP &bp_loc_sp)
Add the breakpoint bp_loc_sp to the list.
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:289
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:61
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
void SetQueueName(const char *queue_name)
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:224
int32_t break_id_t
Definition: lldb-types.h:88
const BreakpointOptions * GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind) const
Use this to access breakpoint options from this breakpoint location.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool ClearBreakpointSite()
Clear this breakpoint location&#39;s breakpoint site - for instance when disabling the breakpoint...
Defines a symbol context baton that can be handed other debug core functions.
Definition: SymbolContext.h:33
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:78
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.
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
void SetThreadName(const char *thread_name)
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:285
bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error)
A file utility class.
Definition: FileSpec.h:55
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp)
Set the breakpoint site for this location to bp_site_sp.
void Dump(Stream *s, lldb::DescriptionLevel description_level)
Dump a description of this object to a Stream.
Definition: Target.cpp:148
void SetAutoContinue(bool auto_continue)
If auto_continue is true, set the breakpoint to continue when hit.
lldb::LanguageType GetLanguage()
void SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
void GetDescription(Stream *s, lldb::DescriptionLevel level)
Print a description of this breakpoint location to the stream s.
bool ShouldStop(StoppointCallbackContext *context) override
Determines whether we should stop due to a hit at this breakpoint location.
CompileUnit * comp_unit
The CompileUnit for a given query.
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous)
Set the callback action invoked when the breakpoint is hit.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void Dump(Stream *s) const
Dump this object to a Stream.
Definition: FileSpec.cpp:350
const char * GetData() const
Definition: StreamString.h:43
Breakpoint & GetBreakpoint()
Gets the Breakpoint that created this breakpoint location.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Definition: Address.cpp:998
Symbol * symbol
The Symbol for a given query.
A class that describes a compilation unit.
Definition: CompileUnit.h:35
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:51
const char * GetName() const
Definition: ThreadSpec.cpp:82
Function * function
The Function for a given query.
const char * GetQueueName() const
Definition: ThreadSpec.cpp:86
lldb::tid_t GetTID() const
Definition: ThreadSpec.h:59
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...
LanguageType
Programming language type.
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:206
bool IsAutoContinue() const
Check the AutoContinue state.
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:57
bool IsIndirect() const
Definition: Symbol.cpp:172
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:127
BreakpointOptions * GetLocationOptions()
Use this to set location specific breakpoint options.
#define LIBLLDB_LOG_BREAKPOINTS
Definition: Logging.h:19
void Clear()
Clear the object state.
Definition: Status.cpp:167
ConstString GetName() const
Definition: Function.cpp:598
uint64_t tid_t
Definition: lldb-types.h:86
std::string GetString(char separator='\n')
void SetErrorString(llvm::StringRef err_str)
Set the current error string to err_str.
Definition: Status.cpp:241
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:154
A plug-in interface definition class for debugging a process.
Definition: Process.h:353
void IndentLess(int amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:221
Symbol * CalculateSymbolContextSymbol() override
Definition: Symbol.cpp:391
virtual bool MatchesSpec(const ThreadSpec *spec)
Definition: Thread.cpp:1030
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:106
void SetCondition(const char *condition)
Set the breakpoint location&#39;s condition.
bool Success() const
Test for success condition.
Definition: Status.cpp:287
A section + offset based address class.
Definition: Address.h:80
Address & GetAddress()
Gets the Address for this breakpoint location.
void void Warning(const char *fmt,...) __attribute__((format(printf
Definition: Log.cpp:163
bool IsResolved() const
Return whether this breakpoint location has a breakpoint site.
BreakpointLocationCollection & GetBreakpointLocationCollection()
Definition: Breakpoint.h:113
Target & GetTarget()
Get the target object pointer for this module.
Definition: Process.h:1194
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:93
uint64_t addr_t
Definition: lldb-types.h:83
Display as the load address (if resolved).
Definition: Address.h:104
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
Definition: Process.cpp:1658
Unknown or invalid language value.
bool Fail() const
Test for error condition.
Definition: Status.cpp:181
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:247
"lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a breakpoint or breakpoint lo...
lldb::ModuleSP module_sp
The Module for a given query.
LineEntry line_entry
The LineEntry for a given query.
Definition: SBAddress.h:15
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:318
ConstString GetName() const
Definition: Symbol.cpp:494
uint32_t GetIndex() const
Definition: ThreadSpec.h:57
bool InvokeCallback(StoppointCallbackContext *context)
Invoke the callback action when the breakpoint is hit.
size_t Indent(const char *s=nullptr)
Indent the current line in the stream.
Definition: Stream.cpp:131
lldb::BreakpointSiteSP GetBreakpointSite() const
lldb::addr_t GetLoadAddress() const override
Gets the load address for this breakpoint location.
void Dump(Stream *s) const override
Standard "Dump" method. At present it does nothing.
bool ResolveBreakpointSite()
Try to resolve the breakpoint site for this location.
Display as the file address with the module name prepended (if any).
Definition: Address.h:99
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
int SetErrorStringWithFormat(const char *format,...) __attribute__((format(printf
Set the current error string to a formatted error string.
Definition: Status.cpp:255
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
void IndentMore(int amount=2)
Increment the current indentation level.
Definition: Stream.cpp:218
bool IsEnabled() const
Check the Enable/Disable state.
const char * AsCString(const char *default_error_str="unknown error") const
Get the error string associated with the current error.
Definition: Status.cpp:130
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:850
CompileUnit * CalculateSymbolContextCompileUnit() override
Definition: CompileUnit.cpp:54
void Printf(const char *format,...) __attribute__((format(printf
Definition: Log.cpp:113
uint32_t GetIgnoreCount()
Return the current Ignore Count.
void SetThreadID(lldb::tid_t thread_id)
Set the valid thread to be checked when the breakpoint is hit.
An error handling class.
Definition: Status.h:44
Display as the file address (if any).
Definition: Address.h:95