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"
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  : m_being_created(true), m_should_resolve_indirect_functions(false),
35  m_is_reexported(false), m_is_indirect(false), m_address(addr),
36  m_owner(owner), m_options_up(), m_bp_site_sp(), m_condition_mutex(),
37  m_condition_hash(0), m_loc_id(loc_id), m_hit_counter() {
38  if (check_for_resolver) {
40  if (symbol && symbol->IsIndirect()) {
42  }
43  }
44 
45  SetThreadID(tid);
46  m_being_created = false;
47 }
48 
50 
53 }
54 
56  BreakpointOptions::OptionKind kind) const {
57  if (m_options_up && m_options_up->IsOptionSet(kind))
58  return *m_options_up;
59  else
60  return m_owner.GetOptions();
61 }
62 
64 
66 
68 
70  if (!m_owner.IsEnabled())
71  return false;
72  else if (m_options_up != nullptr)
73  return m_options_up->IsEnabled();
74  else
75  return true;
76 }
77 
78 void BreakpointLocation::SetEnabled(bool enabled) {
79  GetLocationOptions().SetEnabled(enabled);
80  if (enabled) {
82  } else {
84  }
85  SendBreakpointLocationChangedEvent(enabled ? eBreakpointEventTypeEnabled
86  : eBreakpointEventTypeDisabled);
87 }
88 
90  if (m_options_up &&
92  return m_options_up->IsAutoContinue();
93  else
94  return m_owner.IsAutoContinue();
95 }
96 
97 void BreakpointLocation::SetAutoContinue(bool auto_continue) {
98  GetLocationOptions().SetAutoContinue(auto_continue);
99  SendBreakpointLocationChangedEvent(eBreakpointEventTypeAutoContinueChanged);
100 }
101 
103  if (thread_id != LLDB_INVALID_THREAD_ID)
104  GetLocationOptions().SetThreadID(thread_id);
105  else {
106  // If we're resetting this to an invalid thread id, then don't make an
107  // options pointer just to do that.
108  if (m_options_up != nullptr)
109  m_options_up->SetThreadID(thread_id);
110  }
111  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
112 }
113 
115  const ThreadSpec *thread_spec =
118  if (thread_spec)
119  return thread_spec->GetTID();
120  else
121  return LLDB_INVALID_THREAD_ID;
122 }
123 
125  if (index != 0)
127  else {
128  // If we're resetting this to an invalid thread id, then don't make an
129  // options pointer just to do that.
130  if (m_options_up != nullptr)
131  m_options_up->GetThreadSpec()->SetIndex(index);
132  }
133  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
134 }
135 
137  const ThreadSpec *thread_spec =
140  if (thread_spec)
141  return thread_spec->GetIndex();
142  else
143  return 0;
144 }
145 
146 void BreakpointLocation::SetThreadName(const char *thread_name) {
147  if (thread_name != nullptr)
148  GetLocationOptions().GetThreadSpec()->SetName(thread_name);
149  else {
150  // If we're resetting this to an invalid thread id, then don't make an
151  // options pointer just to do that.
152  if (m_options_up != nullptr)
153  m_options_up->GetThreadSpec()->SetName(thread_name);
154  }
155  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
156 }
157 
159  const ThreadSpec *thread_spec =
162  if (thread_spec)
163  return thread_spec->GetName();
164  else
165  return nullptr;
166 }
167 
168 void BreakpointLocation::SetQueueName(const char *queue_name) {
169  if (queue_name != nullptr)
171  else {
172  // If we're resetting this to an invalid thread id, then don't make an
173  // options pointer just to do that.
174  if (m_options_up != nullptr)
175  m_options_up->GetThreadSpec()->SetQueueName(queue_name);
176  }
177  SendBreakpointLocationChangedEvent(eBreakpointEventTypeThreadChanged);
178 }
179 
180 const char *BreakpointLocation::GetQueueName() const {
181  const ThreadSpec *thread_spec =
184  if (thread_spec)
185  return thread_spec->GetQueueName();
186  else
187  return nullptr;
188 }
189 
191  if (m_options_up != nullptr && m_options_up->HasCallback())
192  return m_options_up->InvokeCallback(context, m_owner.GetID(), GetID());
193  else
194  return m_owner.InvokeCallback(context, GetID());
195 }
196 
198  if (m_options_up != nullptr && m_options_up->HasCallback())
199  return m_options_up->IsCallbackSynchronous();
200  else
202 }
203 
204 void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
205  void *baton, bool is_synchronous) {
206  // The default "Baton" class will keep a copy of "baton" and won't free or
207  // delete it when it goes goes out of scope.
209  callback, std::make_shared<UntypedBaton>(baton), is_synchronous);
210  SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
211 }
212 
213 void BreakpointLocation::SetCallback(BreakpointHitCallback callback,
214  const BatonSP &baton_sp,
215  bool is_synchronous) {
216  GetLocationOptions().SetCallback(callback, baton_sp, is_synchronous);
217  SendBreakpointLocationChangedEvent(eBreakpointEventTypeCommandChanged);
218 }
219 
222 }
223 
224 void BreakpointLocation::SetCondition(const char *condition) {
225  GetLocationOptions().SetCondition(condition);
226  SendBreakpointLocationChangedEvent(eBreakpointEventTypeConditionChanged);
227 }
228 
229 const char *BreakpointLocation::GetConditionText(size_t *hash) const {
231  .GetConditionText(hash);
232 }
233 
235  Status &error) {
237 
238  std::lock_guard<std::mutex> guard(m_condition_mutex);
239 
240  size_t condition_hash;
241  const char *condition_text = GetConditionText(&condition_hash);
242 
243  if (!condition_text) {
244  m_user_expression_sp.reset();
245  return false;
246  }
247 
248  error.Clear();
249 
250  DiagnosticManager diagnostics;
251 
252  if (condition_hash != m_condition_hash || !m_user_expression_sp ||
253  !m_user_expression_sp->MatchesContext(exe_ctx)) {
255  // See if we can figure out the language from the frame, otherwise use the
256  // default language:
258  if (comp_unit)
259  language = comp_unit->GetLanguage();
260 
261  m_user_expression_sp.reset(GetTarget().GetUserExpressionForLanguage(
262  condition_text, llvm::StringRef(), language, Expression::eResultTypeAny,
263  EvaluateExpressionOptions(), nullptr, error));
264  if (error.Fail()) {
265  LLDB_LOGF(log, "Error getting condition expression: %s.",
266  error.AsCString());
267  m_user_expression_sp.reset();
268  return true;
269  }
270 
271  if (!m_user_expression_sp->Parse(diagnostics, exe_ctx,
273  false)) {
274  error.SetErrorStringWithFormat(
275  "Couldn't parse conditional expression:\n%s",
276  diagnostics.GetString().c_str());
277  m_user_expression_sp.reset();
278  return true;
279  }
280 
281  m_condition_hash = condition_hash;
282  }
283 
284  // We need to make sure the user sees any parse errors in their condition, so
285  // we'll hook the constructor errors up to the debugger's Async I/O.
286 
287  ValueObjectSP result_value_sp;
288 
290  options.SetUnwindOnError(true);
291  options.SetIgnoreBreakpoints(true);
292  options.SetTryAllThreads(true);
293  options.SetResultIsInternal(
294  true); // Don't generate a user variable for condition expressions.
295 
296  Status expr_error;
297 
298  diagnostics.Clear();
299 
300  ExpressionVariableSP result_variable_sp;
301 
302  ExpressionResults result_code = m_user_expression_sp->Execute(
303  diagnostics, exe_ctx, options, m_user_expression_sp, result_variable_sp);
304 
305  bool ret;
306 
307  if (result_code == eExpressionCompleted) {
308  if (!result_variable_sp) {
309  error.SetErrorString("Expression did not return a result");
310  return false;
311  }
312 
313  result_value_sp = result_variable_sp->GetValueObject();
314 
315  if (result_value_sp) {
316  ret = result_value_sp->IsLogicalTrue(error);
317  if (log) {
318  if (error.Success()) {
319  LLDB_LOGF(log, "Condition successfully evaluated, result is %s.\n",
320  ret ? "true" : "false");
321  } else {
322  error.SetErrorString(
323  "Failed to get an integer result from the expression");
324  ret = false;
325  }
326  }
327  } else {
328  ret = false;
329  error.SetErrorString("Failed to get any result from the expression");
330  }
331  } else {
332  ret = false;
333  error.SetErrorStringWithFormat("Couldn't execute expression:\n%s",
334  diagnostics.GetString().c_str());
335  }
336 
337  return ret;
338 }
339 
342  .GetIgnoreCount();
343 }
344 
347  SendBreakpointLocationChangedEvent(eBreakpointEventTypeIgnoreChanged);
348 }
349 
351  if (m_options_up != nullptr) {
352  uint32_t loc_ignore = m_options_up->GetIgnoreCount();
353  if (loc_ignore != 0)
354  m_options_up->SetIgnoreCount(loc_ignore - 1);
355  }
356 }
357 
359  uint32_t owner_ignore = GetBreakpoint().GetIgnoreCount();
360  uint32_t loc_ignore = 0;
361  if (m_options_up != nullptr)
362  loc_ignore = m_options_up->GetIgnoreCount();
363 
364  if (loc_ignore != 0 || owner_ignore != 0) {
366  DecrementIgnoreCount(); // Have to decrement our owners' ignore count,
367  // since it won't get a chance to.
368  return false;
369  }
370  return true;
371 }
372 
374  // If we make the copy we don't copy the callbacks because that is
375  // potentially expensive and we don't want to do that for the simple case
376  // where someone is just disabling the location.
377  if (m_options_up == nullptr)
378  m_options_up = std::make_unique<BreakpointOptions>(false);
379 
380  return *m_options_up;
381 }
382 
384  return thread.MatchesSpec(
386  .GetThreadSpecNoCreate());
387 }
388 
389 // RETURNS - true if we should stop at this breakpoint, false if we
390 // should continue. Note, we don't check the thread spec for the breakpoint
391 // here, since if the breakpoint is not for this thread, then the event won't
392 // even get reported, so the check is redundant.
393 
395  bool should_stop = true;
397 
398  // Do this first, if a location is disabled, it shouldn't increment its hit
399  // count.
400  if (!IsEnabled())
401  return false;
402 
403  // We only run synchronous callbacks in ShouldStop:
404  context->is_synchronous = true;
405  should_stop = InvokeCallback(context);
406 
407  if (log) {
408  StreamString s;
410  LLDB_LOGF(log, "Hit breakpoint location: %s, %s.\n", s.GetData(),
411  should_stop ? "stopping" : "continuing");
412  }
413 
414  return should_stop;
415 }
416 
418  if (IsEnabled()) {
419  // Step our hit count, and also step the hit count of the owner.
422  }
423 }
424 
426  if (IsEnabled()) {
427  // Step our hit count, and also step the hit count of the owner.
430  }
431 }
432 
434  return m_bp_site_sp.get() != nullptr;
435 }
436 
437 lldb::BreakpointSiteSP BreakpointLocation::GetBreakpointSite() const {
438  return m_bp_site_sp;
439 }
440 
442  if (m_bp_site_sp)
443  return true;
444 
445  Process *process = m_owner.GetTarget().GetProcessSP().get();
446  if (process == nullptr)
447  return false;
448 
449  lldb::break_id_t new_id =
450  process->CreateBreakpointSite(shared_from_this(), m_owner.IsHardware());
451 
452  if (new_id == LLDB_INVALID_BREAK_ID) {
454  if (log)
455  log->Warning("Failed to add breakpoint site at 0x%" PRIx64,
457  }
458 
459  return IsResolved();
460 }
461 
462 bool BreakpointLocation::SetBreakpointSite(BreakpointSiteSP &bp_site_sp) {
463  m_bp_site_sp = bp_site_sp;
464  SendBreakpointLocationChangedEvent(eBreakpointEventTypeLocationsResolved);
465  return true;
466 }
467 
469  if (m_bp_site_sp.get()) {
470  ProcessSP process_sp(m_owner.GetTarget().GetProcessSP());
471  // If the process exists, get it to remove the owner, it will remove the
472  // physical implementation of the breakpoint as well if there are no more
473  // owners. Otherwise just remove this owner.
474  if (process_sp)
475  process_sp->RemoveOwnerFromBreakpointSite(GetBreakpoint().GetID(),
476  GetID(), m_bp_site_sp);
477  else
478  m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
479 
480  m_bp_site_sp.reset();
481  return true;
482  }
483  return false;
484 }
485 
487  lldb::DescriptionLevel level) {
488  SymbolContext sc;
489 
490  // If the description level is "initial" then the breakpoint is printing out
491  // our initial state, and we should let it decide how it wants to print our
492  // label.
493  if (level != eDescriptionLevelInitial) {
494  s->Indent();
496  }
497 
498  if (level == lldb::eDescriptionLevelBrief)
499  return;
500 
501  if (level != eDescriptionLevelInitial)
502  s->PutCString(": ");
503 
504  if (level == lldb::eDescriptionLevelVerbose)
505  s->IndentMore();
506 
507  if (m_address.IsSectionOffset()) {
509 
510  if (level == lldb::eDescriptionLevelFull ||
511  level == eDescriptionLevelInitial) {
512  if (IsReExported())
513  s->PutCString("re-exported target = ");
514  else
515  s->PutCString("where = ");
517  false, true, false, true, true);
518  } else {
519  if (sc.module_sp) {
520  s->EOL();
521  s->Indent("module = ");
522  sc.module_sp->GetFileSpec().Dump(s->AsRawOstream());
523  }
524 
525  if (sc.comp_unit != nullptr) {
526  s->EOL();
527  s->Indent("compile unit = ");
529 
530  if (sc.function != nullptr) {
531  s->EOL();
532  s->Indent("function = ");
533  s->PutCString(sc.function->GetName().AsCString("<unknown>"));
534  }
535 
536  if (sc.line_entry.line > 0) {
537  s->EOL();
538  s->Indent("location = ");
539  sc.line_entry.DumpStopContext(s, true);
540  }
541 
542  } else {
543  // If we don't have a comp unit, see if we have a symbol we can print.
544  if (sc.symbol) {
545  s->EOL();
546  if (IsReExported())
547  s->Indent("re-exported target = ");
548  else
549  s->Indent("symbol = ");
550  s->PutCString(sc.symbol->GetName().AsCString("<unknown>"));
551  }
552  }
553  }
554  }
555 
556  if (level == lldb::eDescriptionLevelVerbose) {
557  s->EOL();
558  s->Indent();
559  }
560 
561  if (m_address.IsSectionOffset() &&
562  (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
563  s->Printf(", ");
564  s->Printf("address = ");
565 
566  ExecutionContextScope *exe_scope = nullptr;
567  Target *target = &m_owner.GetTarget();
568  if (target)
569  exe_scope = target->GetProcessSP().get();
570  if (exe_scope == nullptr)
571  exe_scope = target;
572 
573  if (level == eDescriptionLevelInitial)
576  else
579 
580  if (IsIndirect() && m_bp_site_sp) {
581  Address resolved_address;
582  resolved_address.SetLoadAddress(m_bp_site_sp->GetLoadAddress(), target);
583  Symbol *resolved_symbol = resolved_address.CalculateSymbolContextSymbol();
584  if (resolved_symbol) {
585  if (level == eDescriptionLevelFull || level == eDescriptionLevelInitial)
586  s->Printf(", ");
587  else if (level == lldb::eDescriptionLevelVerbose) {
588  s->EOL();
589  s->Indent();
590  }
591  s->Printf("indirect target = %s",
592  resolved_symbol->GetName().GetCString());
593  }
594  }
595 
596  bool is_resolved = IsResolved();
597  bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
598 
599  if (level == lldb::eDescriptionLevelVerbose) {
600  s->EOL();
601  s->Indent();
602  s->Printf("resolved = %s\n", is_resolved ? "true" : "false");
603  s->Indent();
604  s->Printf("hardware = %s\n", is_hardware ? "true" : "false");
605  s->Indent();
606  s->Printf("hit count = %-4u\n", GetHitCount());
607 
608  if (m_options_up) {
609  s->Indent();
610  m_options_up->GetDescription(s, level);
611  s->EOL();
612  }
613  s->IndentLess();
614  } else if (level != eDescriptionLevelInitial) {
615  s->Printf(", %sresolved, %shit count = %u ", (is_resolved ? "" : "un"),
616  (is_hardware ? "hardware, " : ""), GetHitCount());
617  if (m_options_up) {
618  m_options_up->GetDescription(s, level);
619  }
620  }
621 }
622 
624  if (s == nullptr)
625  return;
626 
627  bool is_resolved = IsResolved();
628  bool is_hardware = is_resolved && m_bp_site_sp->IsHardware();
629  auto hardware_index = is_resolved ?
630  m_bp_site_sp->GetHardwareIndex() : LLDB_INVALID_INDEX32;
631 
634  ->GetTID();
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",
638  GetID(), tid,
640  (m_options_up ? m_options_up->IsEnabled() : m_owner.IsEnabled())
641  ? "enabled "
642  : "disabled",
643  is_hardware ? "hardware" : "software", hardware_index,
644  GetHitCount(),
646  .GetIgnoreCount());
647 }
648 
650  lldb::BreakpointEventType eventKind) {
651  if (!m_being_created && !m_owner.IsInternal() &&
655  eventKind, m_owner.shared_from_this());
656  data->GetBreakpointLocationCollection().Add(shared_from_this());
658  data);
659  }
660 }
661 
662 void BreakpointLocation::SwapLocation(BreakpointLocationSP swap_from) {
663  m_address = swap_from->m_address;
665  swap_from->m_should_resolve_indirect_functions;
666  m_is_reexported = swap_from->m_is_reexported;
667  m_is_indirect = swap_from->m_is_indirect;
668  m_user_expression_sp.reset();
669 }
lldb_private::Breakpoint::GetOptions
BreakpointOptions & GetOptions()
Returns the BreakpointOptions structure set at the breakpoint level.
Definition: Breakpoint.cpp:437
lldb_private::BreakpointLocation::GetConditionText
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
Definition: BreakpointLocation.cpp:229
lldb_private::Address::SetLoadAddress
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
Definition: Address.cpp:1023
lldb_private::Stream::IndentLess
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:171
lldb_private::Address::CalculateSymbolContextCompileUnit
CompileUnit * CalculateSymbolContextCompileUnit() const
Definition: Address.cpp:834
lldb_private::BreakpointLocation::SetThreadID
void SetThreadID(lldb::tid_t thread_id)
Set the valid thread to be checked when the breakpoint is hit.
Definition: BreakpointLocation.cpp:102
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::SymbolContext::comp_unit
CompileUnit * comp_unit
The CompileUnit for a given query.
Definition: SymbolContext.h:319
lldb_private::BreakpointOptions::GetThreadSpec
ThreadSpec * GetThreadSpec()
Returns a pointer to the ThreadSpec for this option, creating it.
Definition: BreakpointOptions.cpp:508
ExpressionVariable.h
lldb_private::BreakpointLocation::~BreakpointLocation
~BreakpointLocation()
Definition: BreakpointLocation.cpp:49
lldb_private::StoppointCallbackContext
General Outline: When we hit a breakpoint we need to package up whatever information is needed to eva...
Definition: StoppointCallbackContext.h:26
lldb_private::BreakpointOptions::SetIgnoreCount
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
Definition: BreakpointOptions.h:300
lldb_private::BreakpointLocation::m_bp_site_sp
lldb::BreakpointSiteSP m_bp_site_sp
Our breakpoint site (it may be shared by more than one location.)
Definition: BreakpointLocation.h:347
lldb_private::Stoppoint::GetID
lldb::break_id_t GetID() const
Definition: Stoppoint.cpp:22
lldb_private::LineEntry::DumpStopContext
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:50
lldb_private::BreakpointLocation::InvokeCallback
bool InvokeCallback(StoppointCallbackContext *context)
Invoke the callback action when the breakpoint is hit.
Definition: BreakpointLocation.cpp:190
CompileUnit.h
lldb_private::BreakpointLocation::IsCallbackSynchronous
bool IsCallbackSynchronous()
Report whether the callback for this location is synchronous or not.
Definition: BreakpointLocation.cpp:197
lldb_private::Symbol
Definition: Symbol.h:20
lldb_private::BreakpointLocation::GetLoadAddress
lldb::addr_t GetLoadAddress() const
Gets the load address for this breakpoint location.
Definition: BreakpointLocation.cpp:51
lldb_private::BreakpointLocation::GetThreadIndex
uint32_t GetThreadIndex() const
Definition: BreakpointLocation.cpp:136
lldb_private::Breakpoint::GetIgnoreCount
uint32_t GetIgnoreCount() const
Return the current ignore count/.
Definition: Breakpoint.cpp:324
lldb_private::BreakpointOptions::SetCondition
void SetCondition(const char *condition)
Set the breakpoint option's condition.
Definition: BreakpointOptions.cpp:480
lldb_private::BreakpointOptions::eCondition
@ eCondition
Definition: BreakpointOptions.h:40
lldb_private::BreakpointLocation::DecrementIgnoreCount
void DecrementIgnoreCount()
Definition: BreakpointLocation.cpp:350
lldb_private::Address::DumpStyleFileAddress
@ DumpStyleFileAddress
Display as the file address (if any).
Definition: Address.h:84
lldb::ExpressionResults
ExpressionResults
The results of expression evaluation.
Definition: lldb-enumerations.h:270
lldb_private::BreakpointOptions::GetConditionText
const char * GetConditionText(size_t *hash=nullptr) const
Return a pointer to the text of the condition expression.
Definition: BreakpointOptions.cpp:493
lldb_private::BreakpointLocation::m_is_reexported
bool m_is_reexported
Definition: BreakpointLocation.h:339
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:249
lldb_private::BreakpointLocation::SwapLocation
void SwapLocation(lldb::BreakpointLocationSP swap_from)
Definition: BreakpointLocation.cpp:662
lldb_private::Process
Definition: Process.h:342
lldb_private::BreakpointOptions::SetThreadID
void SetThreadID(lldb::tid_t thread_id)
Definition: BreakpointOptions.cpp:517
lldb_private::BreakpointLocation::ClearBreakpointSite
bool ClearBreakpointSite()
Clear this breakpoint location's breakpoint site - for instance when disabling the breakpoint.
Definition: BreakpointLocation.cpp:468
Module.h
lldb_private::BreakpointLocation::SetThreadName
void SetThreadName(const char *thread_name)
Definition: BreakpointLocation.cpp:146
BreakpointLocation.h
lldb_private::EvaluateExpressionOptions
Definition: Target.h:262
StoppointCallbackContext.h
lldb_private::BreakpointOptions::SetEnabled
void SetEnabled(bool enabled)
If enable is true, enable the breakpoint, if false disable it.
Definition: BreakpointOptions.h:270
lldb::LanguageType
LanguageType
Programming language type.
Definition: lldb-enumerations.h:436
lldb_private::Log::Warning
void void void void Warning(const char *fmt,...) __attribute__((format(printf
Definition: Log.cpp:172
lldb_private::BreakpointLocation::SetCondition
void SetCondition(const char *condition)
Set the breakpoint location's condition.
Definition: BreakpointLocation.cpp:224
lldb_private::BreakpointLocation::m_condition_hash
size_t m_condition_hash
For testing whether the condition source code changed.
Definition: BreakpointLocation.h:354
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
UserExpression.h
lldb_private::BreakpointLocation::SendBreakpointLocationChangedEvent
void SendBreakpointLocationChangedEvent(lldb::BreakpointEventType eventKind)
Definition: BreakpointLocation.cpp:649
lldb_private::BreakpointLocation::SetShouldResolveIndirectFunctions
void SetShouldResolveIndirectFunctions(bool do_resolve)
Definition: BreakpointLocation.h:360
lldb_private::BreakpointLocation::ClearCallback
void ClearCallback()
Definition: BreakpointLocation.cpp:220
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::BreakpointLocation::GetOptionsSpecifyingKind
const BreakpointOptions & GetOptionsSpecifyingKind(BreakpointOptions::OptionKind kind) const
Use this to access breakpoint options from this breakpoint location.
Definition: BreakpointLocation.cpp:55
lldb_private::Breakpoint::BreakpointEventData::GetBreakpointLocationCollection
BreakpointLocationCollection & GetBreakpointLocationCollection()
Definition: Breakpoint.h:114
lldb_private::Breakpoint::BreakpointEventData
Definition: Breakpoint.h:99
Debugger.h
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:454
lldb_private::Address::GetOpcodeLoadAddress
lldb::addr_t GetOpcodeLoadAddress(Target *target, AddressClass addr_class=AddressClass::eInvalid) const
Get the load address as an opcode load address.
Definition: Address.cpp:367
lldb_private::EvaluateExpressionOptions::SetResultIsInternal
void SetResultIsInternal(bool b)
Definition: Target.h:401
lldb_private::BreakpointLocation::SetAutoContinue
void SetAutoContinue(bool auto_continue)
If auto_continue is true, set the breakpoint to continue when hit.
Definition: BreakpointLocation.cpp:97
lldb_private::DiagnosticManager::GetString
std::string GetString(char separator='\n')
Definition: DiagnosticManager.cpp:47
lldb_private::BreakpointOptions::SetAutoContinue
void SetAutoContinue(bool auto_continue)
Set the auto-continue state.
Definition: BreakpointOptions.h:281
Process.h
lldb_private::CompileUnit
Definition: CompileUnit.h:38
lldb_private::BreakpointLocation::SetBreakpointSite
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp)
Set the breakpoint site for this location to bp_site_sp.
Definition: BreakpointLocation.cpp:462
lldb_private::BreakpointOptions::GetThreadSpecNoCreate
const ThreadSpec * GetThreadSpecNoCreate() const
Return the current thread spec for this option.
Definition: BreakpointOptions.cpp:504
lldb_private::BreakpointLocation::GetTarget
Target & GetTarget()
Definition: BreakpointLocation.cpp:67
Target.h
lldb_private::StoppointCallbackContext::is_synchronous
bool is_synchronous
Definition: StoppointCallbackContext.h:44
lldb_private::StoppointHitCounter::Increment
void Increment(uint32_t difference=1)
Definition: StoppointHitCounter.h:24
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::SymbolContext::symbol
Symbol * symbol
The Symbol for a given query.
Definition: SymbolContext.h:323
lldb_private::BreakpointLocation::GetLocationOptions
BreakpointOptions & GetLocationOptions()
Use this to set location specific breakpoint options.
Definition: BreakpointLocation.cpp:373
lldb_private::BreakpointLocation::UndoBumpHitCount
void UndoBumpHitCount()
Definition: BreakpointLocation.cpp:425
lldb_private::SymbolContext::DumpStopContext
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.
Definition: SymbolContext.cpp:67
lldb_private::BreakpointLocation::GetAddress
Address & GetAddress()
Gets the Address for this breakpoint location.
Definition: BreakpointLocation.cpp:63
lldb_private::Stream::Indent
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
lldb_private::BreakpointLocation::m_user_expression_sp
lldb::UserExpressionSP m_user_expression_sp
The compiled expression to use in testing our condition.
Definition: BreakpointLocation.h:349
lldb_private::BreakpointLocation::SetThreadIndex
void SetThreadIndex(uint32_t index)
Definition: BreakpointLocation.cpp:124
lldb_private::Address::DumpStyleLoadAddress
@ DumpStyleLoadAddress
Display as the load address (if resolved).
Definition: Address.h:96
lldb_private::Function::GetName
ConstString GetName() const
Definition: Function.cpp:655
lldb_private::BreakpointLocation::m_hit_counter
StoppointHitCounter m_hit_counter
Number of times this breakpoint location has been hit.
Definition: BreakpointLocation.h:357
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::BreakpointID::GetCanonicalReference
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...
Definition: BreakpointID.cpp:60
lldb_private::Thread
Definition: Thread.h:62
lldb_private::Breakpoint::IsInternal
bool IsInternal() const
Tell whether this breakpoint is an "internal" breakpoint.
Definition: Breakpoint.cpp:258
ThreadSpec.h
lldb_private::BreakpointLocation::BumpHitCount
void BumpHitCount()
Definition: BreakpointLocation.cpp:417
lldb_private::BreakpointLocation::GetID
lldb::break_id_t GetID() const
Returns the breakpoint location ID.
Definition: BreakpointLocation.h:280
lldb_private::BreakpointOptions::SetCallback
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &baton_sp, bool synchronous=false)
Adds a callback to the breakpoint option set.
Definition: BreakpointOptions.cpp:402
lldb_private::StreamString::GetData
const char * GetData() const
Definition: StreamString.h:43
lldb::eExpressionCompleted
@ eExpressionCompleted
Definition: lldb-enumerations.h:271
lldb_private::BreakpointLocation::GetThreadID
lldb::tid_t GetThreadID()
Definition: BreakpointLocation.cpp:114
lldb_private::SymbolContext::function
Function * function
The Function for a given query.
Definition: SymbolContext.h:320
StreamString.h
lldb_private::BreakpointLocation::IsAutoContinue
bool IsAutoContinue() const
Check the AutoContinue state.
Definition: BreakpointLocation.cpp:89
lldb_private::StoppointHitCounter::Decrement
void Decrement(uint32_t difference=1)
Definition: StoppointHitCounter.h:29
lldb_private::ThreadSpec::SetQueueName
void SetQueueName(llvm::StringRef queue_name)
Definition: ThreadSpec.h:51
lldb_private::BreakpointLocation::SetIgnoreCount
void SetIgnoreCount(uint32_t n)
Set the breakpoint to ignore the next count breakpoint hits.
Definition: BreakpointLocation.cpp:345
lldb_private::BreakpointLocation::m_should_resolve_indirect_functions
bool m_should_resolve_indirect_functions
Definition: BreakpointLocation.h:338
lldb::break_id_t
int32_t break_id_t
Definition: lldb-types.h:88
lldb_private::StreamString
Definition: StreamString.h:23
lldb_private::BreakpointOptions
Definition: BreakpointOptions.h:27
lldb_private::BreakpointLocation::SetEnabled
void SetEnabled(bool enabled)
If enabled is true, enable the breakpoint, if false disable it.
Definition: BreakpointLocation.cpp:78
lldb_private::BreakpointLocation::IsEnabled
bool IsEnabled() const
Check the Enable/Disable state.
Definition: BreakpointLocation.cpp:69
lldb::eDescriptionLevelFull
@ eDescriptionLevelFull
Definition: lldb-enumerations.h:209
lldb_private::EvaluateExpressionOptions::SetTryAllThreads
void SetTryAllThreads(bool try_others=true)
Definition: Target.h:342
lldb_private::GetLogIfAllCategoriesSet
Log * GetLogIfAllCategoriesSet(uint32_t mask)
Definition: Logging.cpp:58
lldb_private::ThreadSpec::SetIndex
void SetIndex(uint32_t index)
Definition: ThreadSpec.h:45
lldb_private::Breakpoint::InvokeCallback
bool InvokeCallback(StoppointCallbackContext *context, lldb::break_id_t bp_loc_id)
Invoke the callback action when the breakpoint is hit.
Definition: Breakpoint.cpp:432
lldb_private::CompileUnit::GetPrimaryFile
const FileSpec & GetPrimaryFile() const
Return the primary source file associated with this compile unit.
Definition: CompileUnit.h:227
lldb_private::Broadcaster::EventTypeHasListeners
bool EventTypeHasListeners(uint32_t event_type)
Definition: Broadcaster.h:345
lldb_private::BreakpointOptions::OptionKind
OptionKind
Definition: BreakpointOptions.h:34
lldb_private::BreakpointLocation::ValidForThisThread
bool ValidForThisThread(Thread &thread)
Definition: BreakpointLocation.cpp:383
lldb_private::BreakpointLocation::m_owner
Breakpoint & m_owner
The breakpoint that produced this object.
Definition: BreakpointLocation.h:342
lldb_private::BreakpointLocation::IsIndirect
bool IsIndirect()
Returns whether the address set in the breakpoint site for this location was found by resolving an in...
Definition: BreakpointLocation.h:255
lldb_private::EvaluateExpressionOptions::SetUnwindOnError
void SetUnwindOnError(bool unwind=false)
Definition: Target.h:309
lldb_private::CompileUnit::GetLanguage
lldb::LanguageType GetLanguage()
Definition: CompileUnit.cpp:150
Thread.h
TypeSystem.h
lldb_private::Address::CalculateSymbolContextSymbol
Symbol * CalculateSymbolContextSymbol() const
Definition: Address.cpp:876
lldb_private::ConstString::Dump
void Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
Definition: ConstString.cpp:283
lldb_private::BreakpointLocation::SetCallback
void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous)
Set the callback action invoked when the breakpoint is hit.
lldb_private::ThreadSpec
Definition: ThreadSpec.h:33
lldb_private::Address::DumpStyleModuleWithFileAddress
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
Definition: Address.h:90
ValueObject.h
lldb_private::LineEntry::line
uint32_t line
The source line number, or zero if there is no line number information.
Definition: LineEntry.h:143
lldb_private::BreakpointLocation::GetBreakpointSite
lldb::BreakpointSiteSP GetBreakpointSite() const
Definition: BreakpointLocation.cpp:437
LLDB_INVALID_BREAK_ID
#define LLDB_INVALID_BREAK_ID
Definition: lldb-defines.h:49
lldb_private::BreakpointLocation::SetQueueName
void SetQueueName(const char *queue_name)
Definition: BreakpointLocation.cpp:168
lldb_private::BreakpointLocation::GetHitCount
uint32_t GetHitCount() const
Return the current Hit Count.
Definition: BreakpointLocation.h:88
lldb_private::EvaluateExpressionOptions::SetIgnoreBreakpoints
void SetIgnoreBreakpoints(bool ignore=false)
Definition: Target.h:313
Symbol.h
lldb_private::Symbol::GetName
ConstString GetName() const
Definition: Symbol.cpp:500
lldb_private::BreakpointLocation::ShouldStop
bool ShouldStop(StoppointCallbackContext *context)
Determines whether we should stop due to a hit at this breakpoint location.
Definition: BreakpointLocation.cpp:394
lldb_private::ThreadSpec::GetName
const char * GetName() const
Definition: ThreadSpec.cpp:68
lldb_private::Target::GetProcessSP
const lldb::ProcessSP & GetProcessSP() const
Definition: Target.cpp:214
lldb_private::BreakpointLocation::IgnoreCountShouldStop
bool IgnoreCountShouldStop()
BreakpointLocation::IgnoreCountShouldStop can only be called once per stop.
Definition: BreakpointLocation.cpp:358
lldb_private::Broadcaster::BroadcastEvent
void BroadcastEvent(lldb::EventSP &event_sp)
Broadcast an event which has no associated data.
Definition: Broadcaster.h:262
lldb_private::ThreadSpec::GetIndex
uint32_t GetIndex() const
Definition: ThreadSpec.h:55
lldb_private::Status
Definition: Status.h:44
lldb::eLanguageTypeUnknown
@ eLanguageTypeUnknown
Unknown or invalid language value.
Definition: lldb-enumerations.h:437
lldb_private::ThreadSpec::GetQueueName
const char * GetQueueName() const
Definition: ThreadSpec.cpp:72
lldb_private::BreakpointLocation::GetBreakpoint
Breakpoint & GetBreakpoint()
Gets the Breakpoint that created this breakpoint location.
Definition: BreakpointLocation.cpp:65
lldb_private::BreakpointLocation::IsResolved
bool IsResolved() const
Return whether this breakpoint location has a breakpoint site.
Definition: BreakpointLocation.cpp:433
uint32_t
lldb_private::BreakpointOptions::eAutoContinue
@ eAutoContinue
Definition: BreakpointOptions.h:41
lldb_private::BreakpointLocation::ConditionSaysStop
bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error)
Definition: BreakpointLocation.cpp:234
lldb_private::BreakpointLocation::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level)
Print a description of this breakpoint location to the stream s.
Definition: BreakpointLocation.cpp:486
LIBLLDB_LOG_BREAKPOINTS
#define LIBLLDB_LOG_BREAKPOINTS
Definition: Logging.h:19
lldb_private::Stream::IndentMore
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:168
lldb_private::Address
Definition: Address.h:59
lldb_private::ThreadSpec::SetName
void SetName(llvm::StringRef name)
Definition: ThreadSpec.h:49
lldb_private::Stream::EOL
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb_private::Target::eBroadcastBitBreakpointChanged
@ eBroadcastBitBreakpointChanged
Definition: Target.h:465
lldb_private::DiagnosticManager
Definition: DiagnosticManager.h:93
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
lldb_private::Expression::eResultTypeAny
@ eResultTypeAny
Definition: Expression.h:35
lldb_private::Address::Dump
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX) const
Dump a description of this object to a Stream.
Definition: Address.cpp:405
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
lldb_private::BreakpointLocationCollection::Add
void Add(const lldb::BreakpointLocationSP &bp_loc_sp)
Add the breakpoint bp_loc_sp to the list.
Definition: BreakpointLocationCollection.cpp:26
lldb_private::BreakpointOptions::IsCallbackSynchronous
bool IsCallbackSynchronous() const
Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
Definition: BreakpointOptions.h:234
lldb_private::Thread::MatchesSpec
virtual bool MatchesSpec(const ThreadSpec *spec)
Definition: Thread.cpp:1049
lldb_private::ConstString::GetCString
const char * GetCString() const
Get the string value as a C string.
Definition: ConstString.h:216
BreakpointID.h
lldb_private::eExecutionPolicyOnlyWhenNeeded
@ eExecutionPolicyOnlyWhenNeeded
Definition: lldb-private-enumerations.h:145
lldb_private::BreakpointLocation::Dump
void Dump(Stream *s) const
Standard "Dump" method. At present it does nothing.
Definition: BreakpointLocation.cpp:623
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
DiagnosticManager.h
lldb_private::DiagnosticManager::Clear
void Clear()
Definition: DiagnosticManager.h:95
lldb_private::BreakpointOptions::eThreadSpec
@ eThreadSpec
Definition: BreakpointOptions.h:39
lldb_private::BreakpointOptions::GetIgnoreCount
uint32_t GetIgnoreCount() const
Return the current Ignore Count.
Definition: BreakpointOptions.h:308
lldb_private::BreakpointLocation::GetThreadName
const char * GetThreadName() const
Definition: BreakpointLocation.cpp:158
lldb_private::BreakpointLocation::m_is_indirect
bool m_is_indirect
Definition: BreakpointLocation.h:340
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb::eDescriptionLevelVerbose
@ eDescriptionLevelVerbose
Definition: lldb-enumerations.h:210
lldb_private::Breakpoint::IsHardware
bool IsHardware() const
Definition: Breakpoint.h:510
lldb_private::Breakpoint::m_hit_counter
StoppointHitCounter m_hit_counter
Number of times this breakpoint has been hit.
Definition: Breakpoint.h:652
lldb_private::Address::IsSectionOffset
bool IsSectionOffset() const
Check if an address is section offset.
Definition: Address.h:323
lldb_private::BreakpointLocation::IsReExported
bool IsReExported()
Returns whether the address set in the breakpoint location was re-routed to the target of a re-export...
Definition: BreakpointLocation.h:264
lldb_private::Breakpoint::GetTarget
Target & GetTarget()
Accessor for the breakpoint Target.
Definition: Breakpoint.h:453
lldb_private::BreakpointOptions::eIgnoreCount
@ eIgnoreCount
Definition: BreakpointOptions.h:38
lldb_private::Process::CreateBreakpointSite
lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware)
Definition: Process.cpp:1606
LLDB_INVALID_INDEX32
#define LLDB_INVALID_INDEX32
Definition: lldb-defines.h:87
lldb_private::ThreadSpec::GetTID
lldb::tid_t GetTID() const
Definition: ThreadSpec.h:57
LLDB_INVALID_THREAD_ID
#define LLDB_INVALID_THREAD_ID
Definition: lldb-defines.h:94
lldb_private::BreakpointLocation::ResolveBreakpointSite
bool ResolveBreakpointSite()
Try to resolve the breakpoint site for this location.
Definition: BreakpointLocation.cpp:441
lldb_private::Log
Definition: Log.h:49
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::BreakpointLocation::m_options_up
std::unique_ptr< BreakpointOptions > m_options_up
Breakpoint options pointer, nullptr if we're using our breakpoint's options.
Definition: BreakpointLocation.h:343
lldb_private::Breakpoint::DecrementIgnoreCount
void DecrementIgnoreCount()
Definition: Breakpoint.cpp:318
lldb_private::Symbol::IsIndirect
bool IsIndirect() const
Definition: Symbol.cpp:175
lldb_private::BreakpointLocation::m_being_created
bool m_being_created
Definition: BreakpointLocation.h:337
lldb_private::SymbolContext::line_entry
LineEntry line_entry
The LineEntry for a given query.
Definition: SymbolContext.h:322
lldb_private::BreakpointLocation::m_address
Address m_address
The address defining this location.
Definition: BreakpointLocation.h:341
lldb
Definition: SBAddress.h:15
lldb_private::BreakpointOptions::ClearCallback
void ClearCallback()
Remove the callback from this option set.
Definition: BreakpointOptions.cpp:433
lldb_private::Breakpoint::IsEnabled
bool IsEnabled() override
Check the Enable/Disable state.
Definition: Breakpoint.cpp:308
lldb_private::FileSpec::GetFilename
ConstString & GetFilename()
Filename string get accessor.
Definition: FileSpec.cpp:341
lldb_private::BreakpointLocation::GetQueueName
const char * GetQueueName() const
Definition: BreakpointLocation.cpp:180
lldb_private::Address::CalculateSymbolContext
uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope=lldb::eSymbolContextEverything) const
Reconstruct a symbol context from an address.
Definition: Address.cpp:808
lldb_private::BreakpointLocation::m_condition_mutex
std::mutex m_condition_mutex
Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
Definition: BreakpointLocation.h:351
lldb::eDescriptionLevelInitial
@ eDescriptionLevelInitial
Definition: lldb-enumerations.h:211
lldb::eDescriptionLevelBrief
@ eDescriptionLevelBrief
Definition: lldb-enumerations.h:208
lldb_private::Breakpoint::IsAutoContinue
bool IsAutoContinue() const
Check the AutoContinue state.
Definition: Breakpoint.cpp:334
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Breakpoint
General Outline: A breakpoint has four main parts, a filter, a resolver, the list of breakpoint locat...
Definition: Breakpoint.h:79
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86
lldb_private::BreakpointLocation::GetIgnoreCount
uint32_t GetIgnoreCount() const
Return the current Ignore Count.
Definition: BreakpointLocation.cpp:340