LLDB  mainline
Block.cpp
Go to the documentation of this file.
1 //===-- Block.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 
9 #include "lldb/Symbol/Block.h"
10 
11 #include "lldb/Core/Module.h"
12 #include "lldb/Core/Section.h"
13 #include "lldb/Symbol/Function.h"
14 #include "lldb/Symbol/SymbolFile.h"
16 #include "lldb/Utility/LLDBLog.h"
17 #include "lldb/Utility/Log.h"
18 
19 #include <memory>
20 
21 using namespace lldb;
22 using namespace lldb_private;
23 
24 Block::Block(lldb::user_id_t uid)
25  : UserID(uid), m_parent_scope(nullptr), m_children(), m_ranges(),
26  m_inlineInfoSP(), m_variable_list_sp(), m_parsed_block_info(false),
27  m_parsed_block_variables(false), m_parsed_child_blocks(false) {}
28 
29 Block::~Block() = default;
30 
32  lldb::DescriptionLevel level, Target *target) const {
33  *s << "id = " << ((const UserID &)*this);
34 
35  size_t num_ranges = m_ranges.GetSize();
36  if (num_ranges > 0) {
37 
38  addr_t base_addr = LLDB_INVALID_ADDRESS;
39  if (target)
40  base_addr =
41  function->GetAddressRange().GetBaseAddress().GetLoadAddress(target);
42  if (base_addr == LLDB_INVALID_ADDRESS)
43  base_addr = function->GetAddressRange().GetBaseAddress().GetFileAddress();
44 
45  s->Printf(", range%s = ", num_ranges > 1 ? "s" : "");
46  for (size_t i = 0; i < num_ranges; ++i) {
47  const Range &range = m_ranges.GetEntryRef(i);
48  DumpAddressRange(s->AsRawOstream(), base_addr + range.GetRangeBase(),
49  base_addr + range.GetRangeEnd(), 4);
50  }
51  }
52 
53  if (m_inlineInfoSP.get() != nullptr) {
54  bool show_fullpaths = (level == eDescriptionLevelVerbose);
55  m_inlineInfoSP->Dump(s, show_fullpaths);
56  }
57 }
58 
59 void Block::Dump(Stream *s, addr_t base_addr, int32_t depth,
60  bool show_context) const {
61  if (depth < 0) {
62  Block *parent = GetParent();
63  if (parent) {
64  // We have a depth that is less than zero, print our parent blocks first
65  parent->Dump(s, base_addr, depth + 1, show_context);
66  }
67  }
68 
69  s->Printf("%p: ", static_cast<const void *>(this));
70  s->Indent();
71  *s << "Block" << static_cast<const UserID &>(*this);
72  const Block *parent_block = GetParent();
73  if (parent_block) {
74  s->Printf(", parent = {0x%8.8" PRIx64 "}", parent_block->GetID());
75  }
76  if (m_inlineInfoSP.get() != nullptr) {
77  bool show_fullpaths = false;
78  m_inlineInfoSP->Dump(s, show_fullpaths);
79  }
80 
81  if (!m_ranges.IsEmpty()) {
82  *s << ", ranges =";
83 
84  size_t num_ranges = m_ranges.GetSize();
85  for (size_t i = 0; i < num_ranges; ++i) {
86  const Range &range = m_ranges.GetEntryRef(i);
87  if (parent_block != nullptr && !parent_block->Contains(range))
88  *s << '!';
89  else
90  *s << ' ';
91  DumpAddressRange(s->AsRawOstream(), base_addr + range.GetRangeBase(),
92  base_addr + range.GetRangeEnd(), 4);
93  }
94  }
95  s->EOL();
96 
97  if (depth > 0) {
98  s->IndentMore();
99 
100  if (m_variable_list_sp.get()) {
101  m_variable_list_sp->Dump(s, show_context);
102  }
103 
104  collection::const_iterator pos, end = m_children.end();
105  for (pos = m_children.begin(); pos != end; ++pos)
106  (*pos)->Dump(s, base_addr, depth - 1, show_context);
107 
108  s->IndentLess();
109  }
110 }
111 
113  if (block_id == GetID())
114  return this;
115 
116  Block *matching_block = nullptr;
117  collection::const_iterator pos, end = m_children.end();
118  for (pos = m_children.begin(); pos != end; ++pos) {
119  matching_block = (*pos)->FindBlockByID(block_id);
120  if (matching_block)
121  break;
122  }
123  return matching_block;
124 }
125 
127  if (!Contains(offset))
128  return nullptr;
129  for (const BlockSP &block_sp : m_children) {
130  if (Block *block = block_sp->FindInnermostBlockByOffset(offset))
131  return block;
132  }
133  return this;
134 }
135 
137  if (m_parent_scope)
139  sc->block = this;
140 }
141 
143  if (m_parent_scope)
145  return lldb::ModuleSP();
146 }
147 
149  if (m_parent_scope)
151  return nullptr;
152 }
153 
155  if (m_parent_scope)
157  return nullptr;
158 }
159 
161 
164  if (function)
165  function->DumpSymbolContext(s);
166  s->Printf(", Block{0x%8.8" PRIx64 "}", GetID());
167 }
168 
170  if (!m_ranges.IsEmpty()) {
171  size_t num_ranges = m_ranges.GetSize();
172  for (size_t i = 0; i < num_ranges; ++i) {
173  const Range &range = m_ranges.GetEntryRef(i);
174  DumpAddressRange(s->AsRawOstream(), base_addr + range.GetRangeBase(),
175  base_addr + range.GetRangeEnd(), 4);
176  }
177  }
178 }
179 
180 bool Block::Contains(addr_t range_offset) const {
181  return m_ranges.FindEntryThatContains(range_offset) != nullptr;
182 }
183 
184 bool Block::Contains(const Block *block) const {
185  if (this == block)
186  return false; // This block doesn't contain itself...
187 
188  // Walk the parent chain for "block" and see if any if them match this block
189  const Block *block_parent;
190  for (block_parent = block->GetParent(); block_parent != nullptr;
191  block_parent = block_parent->GetParent()) {
192  if (this == block_parent)
193  return true; // One of the parents of "block" is this object!
194  }
195  return false;
196 }
197 
198 bool Block::Contains(const Range &range) const {
199  return m_ranges.FindEntryThatContains(range) != nullptr;
200 }
201 
203  if (m_parent_scope)
205  return nullptr;
206 }
207 
210  return this;
211  return GetInlinedParent();
212 }
213 
215  Block *parent_block = GetParent();
216  if (parent_block) {
217  if (parent_block->GetInlinedFunctionInfo())
218  return parent_block;
219  else
220  return parent_block->GetInlinedParent();
221  }
222  return nullptr;
223 }
224 
226  const Declaration &find_call_site) {
227  Block *inlined_block = GetContainingInlinedBlock();
228 
229  while (inlined_block) {
230  const auto *function_info = inlined_block->GetInlinedFunctionInfo();
231 
232  if (function_info &&
233  function_info->GetCallSite().FileAndLineEqual(find_call_site))
234  return inlined_block;
235  inlined_block = inlined_block->GetInlinedParent();
236  }
237  return nullptr;
238 }
239 
240 bool Block::GetRangeContainingOffset(const addr_t offset, Range &range) {
241  const Range *range_ptr = m_ranges.FindEntryThatContains(offset);
242  if (range_ptr) {
243  range = *range_ptr;
244  return true;
245  }
246  range.Clear();
247  return false;
248 }
249 
251  AddressRange &range) {
253  if (function) {
254  const AddressRange &func_range = function->GetAddressRange();
255  if (addr.GetSection() == func_range.GetBaseAddress().GetSection()) {
256  const addr_t addr_offset = addr.GetOffset();
257  const addr_t func_offset = func_range.GetBaseAddress().GetOffset();
258  if (addr_offset >= func_offset &&
259  addr_offset < func_offset + func_range.GetByteSize()) {
260  addr_t offset = addr_offset - func_offset;
261 
262  const Range *range_ptr = m_ranges.FindEntryThatContains(offset);
263 
264  if (range_ptr) {
265  range.GetBaseAddress() = func_range.GetBaseAddress();
266  range.GetBaseAddress().SetOffset(func_offset +
267  range_ptr->GetRangeBase());
268  range.SetByteSize(range_ptr->GetByteSize());
269  return true;
270  }
271  }
272  }
273  }
274  range.Clear();
275  return false;
276 }
277 
279  Target &target, AddressRange &range) {
280  Address load_address;
281  load_address.SetLoadAddress(load_addr, &target);
282  AddressRange containing_range;
283  return GetRangeContainingAddress(load_address, containing_range);
284 }
285 
288  if (function) {
289  const AddressRange &func_range = function->GetAddressRange();
290  if (addr.GetSection() == func_range.GetBaseAddress().GetSection()) {
291  const addr_t addr_offset = addr.GetOffset();
292  const addr_t func_offset = func_range.GetBaseAddress().GetOffset();
293  if (addr_offset >= func_offset &&
294  addr_offset < func_offset + func_range.GetByteSize()) {
295  addr_t offset = addr_offset - func_offset;
296  return m_ranges.FindEntryIndexThatContains(offset);
297  }
298  }
299  }
300  return UINT32_MAX;
301 }
302 
304  if (range_idx < m_ranges.GetSize()) {
306  if (function) {
307  const Range &vm_range = m_ranges.GetEntryRef(range_idx);
308  range.GetBaseAddress() = function->GetAddressRange().GetBaseAddress();
309  range.GetBaseAddress().Slide(vm_range.GetRangeBase());
310  range.SetByteSize(vm_range.GetByteSize());
311  return true;
312  }
313  }
314  return false;
315 }
316 
318  if (m_ranges.IsEmpty())
319  return false;
320 
322  if (function) {
323  addr = function->GetAddressRange().GetBaseAddress();
325  return true;
326  }
327  return false;
328 }
329 
331  m_ranges.Sort();
333 }
334 
335 void Block::AddRange(const Range &range) {
336  Block *parent_block = GetParent();
337  if (parent_block && !parent_block->Contains(range)) {
338  Log *log = GetLog(LLDBLog::Symbols);
339  if (log) {
340  ModuleSP module_sp(m_parent_scope->CalculateSymbolContextModule());
342  const addr_t function_file_addr =
344  const addr_t block_start_addr = function_file_addr + range.GetRangeBase();
345  const addr_t block_end_addr = function_file_addr + range.GetRangeEnd();
346  Type *func_type = function->GetType();
347 
348  const Declaration &func_decl = func_type->GetDeclaration();
349  if (func_decl.GetLine()) {
350  LLDB_LOGF(log,
351  "warning: %s:%u block {0x%8.8" PRIx64
352  "} has range[%u] [0x%" PRIx64 " - 0x%" PRIx64
353  ") which is not contained in parent block {0x%8.8" PRIx64
354  "} in function {0x%8.8" PRIx64 "} from %s",
355  func_decl.GetFile().GetPath().c_str(), func_decl.GetLine(),
356  GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
357  block_end_addr, parent_block->GetID(), function->GetID(),
358  module_sp->GetFileSpec().GetPath().c_str());
359  } else {
360  LLDB_LOGF(log,
361  "warning: block {0x%8.8" PRIx64 "} has range[%u] [0x%" PRIx64
362  " - 0x%" PRIx64
363  ") which is not contained in parent block {0x%8.8" PRIx64
364  "} in function {0x%8.8" PRIx64 "} from %s",
365  GetID(), (uint32_t)m_ranges.GetSize(), block_start_addr,
366  block_end_addr, parent_block->GetID(), function->GetID(),
367  module_sp->GetFileSpec().GetPath().c_str());
368  }
369  }
370  parent_block->AddRange(range);
371  }
372  m_ranges.Append(range);
373 }
374 
375 // Return the current number of bytes that this object occupies in memory
376 size_t Block::MemorySize() const {
377  size_t mem_size = sizeof(Block) + m_ranges.GetSize() * sizeof(Range);
378  if (m_inlineInfoSP.get())
379  mem_size += m_inlineInfoSP->MemorySize();
380  if (m_variable_list_sp.get())
381  mem_size += m_variable_list_sp->MemorySize();
382  return mem_size;
383 }
384 
385 void Block::AddChild(const BlockSP &child_block_sp) {
386  if (child_block_sp) {
387  child_block_sp->SetParentScope(this);
388  m_children.push_back(child_block_sp);
389  }
390 }
391 
392 void Block::SetInlinedFunctionInfo(const char *name, const char *mangled,
393  const Declaration *decl_ptr,
394  const Declaration *call_decl_ptr) {
395  m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
396  call_decl_ptr);
397 }
398 
399 VariableListSP Block::GetBlockVariableList(bool can_create) {
401  if (m_variable_list_sp.get() == nullptr && can_create) {
403  SymbolContext sc;
405  assert(sc.module_sp);
406  sc.module_sp->GetSymbolFile()->ParseVariablesForContext(sc);
407  }
408  }
409  return m_variable_list_sp;
410 }
411 
412 uint32_t
413 Block::AppendBlockVariables(bool can_create, bool get_child_block_variables,
414  bool stop_if_child_block_is_inlined_function,
415  const std::function<bool(Variable *)> &filter,
416  VariableList *variable_list) {
417  uint32_t num_variables_added = 0;
418  VariableList *block_var_list = GetBlockVariableList(can_create).get();
419  if (block_var_list) {
420  for (const VariableSP &var_sp : *block_var_list) {
421  if (filter(var_sp.get())) {
422  num_variables_added++;
423  variable_list->AddVariable(var_sp);
424  }
425  }
426  }
427 
428  if (get_child_block_variables) {
429  collection::const_iterator pos, end = m_children.end();
430  for (pos = m_children.begin(); pos != end; ++pos) {
431  Block *child_block = pos->get();
432  if (!stop_if_child_block_is_inlined_function ||
433  child_block->GetInlinedFunctionInfo() == nullptr) {
434  num_variables_added += child_block->AppendBlockVariables(
435  can_create, get_child_block_variables,
436  stop_if_child_block_is_inlined_function, filter, variable_list);
437  }
438  }
439  }
440  return num_variables_added;
441 }
442 
443 uint32_t Block::AppendVariables(bool can_create, bool get_parent_variables,
444  bool stop_if_block_is_inlined_function,
445  const std::function<bool(Variable *)> &filter,
446  VariableList *variable_list) {
447  uint32_t num_variables_added = 0;
448  VariableListSP variable_list_sp(GetBlockVariableList(can_create));
449 
450  bool is_inlined_function = GetInlinedFunctionInfo() != nullptr;
451  if (variable_list_sp) {
452  for (size_t i = 0; i < variable_list_sp->GetSize(); ++i) {
453  VariableSP variable = variable_list_sp->GetVariableAtIndex(i);
454  if (filter(variable.get())) {
455  num_variables_added++;
456  variable_list->AddVariable(variable);
457  }
458  }
459  }
460 
461  if (get_parent_variables) {
462  if (stop_if_block_is_inlined_function && is_inlined_function)
463  return num_variables_added;
464 
465  Block *parent_block = GetParent();
466  if (parent_block)
467  num_variables_added += parent_block->AppendVariables(
468  can_create, get_parent_variables, stop_if_block_is_inlined_function,
469  filter, variable_list);
470  }
471  return num_variables_added;
472 }
473 
475  if (ModuleSP module_sp = CalculateSymbolContextModule())
476  return module_sp->GetSymbolFile();
477  return nullptr;
478 }
479 
481  if (SymbolFile *sym_file = GetSymbolFile())
482  return sym_file->GetDeclContextForUID(GetID());
483  return CompilerDeclContext();
484 }
485 
486 void Block::SetBlockInfoHasBeenParsed(bool b, bool set_children) {
488  if (set_children) {
489  m_parsed_child_blocks = true;
490  collection::const_iterator pos, end = m_children.end();
491  for (pos = m_children.begin(); pos != end; ++pos)
492  (*pos)->SetBlockInfoHasBeenParsed(b, true);
493  }
494 }
495 
496 void Block::SetDidParseVariables(bool b, bool set_children) {
498  if (set_children) {
499  collection::const_iterator pos, end = m_children.end();
500  for (pos = m_children.begin(); pos != end; ++pos)
501  (*pos)->SetDidParseVariables(b, true);
502  }
503 }
504 
506  if (m_parent_scope) {
507  Block *parent_block = GetParent();
508  if (parent_block)
509  return parent_block->GetSiblingForChild(this);
510  }
511  return nullptr;
512 }
513 // A parent of child blocks can be asked to find a sibling block given
514 // one of its child blocks
515 Block *Block::GetSiblingForChild(const Block *child_block) const {
516  if (!m_children.empty()) {
517  collection::const_iterator pos, end = m_children.end();
518  for (pos = m_children.begin(); pos != end; ++pos) {
519  if (pos->get() == child_block) {
520  if (++pos != end)
521  return pos->get();
522  break;
523  }
524  }
525  }
526  return nullptr;
527 }
lldb_private::Block::FindInnermostBlockByOffset
Block * FindInnermostBlockByOffset(const lldb::addr_t offset)
Definition: Block.cpp:126
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:1040
lldb_private::AddressRange::GetBaseAddress
Address & GetBaseAddress()
Get accessor for the base address of the range.
Definition: AddressRange.h:209
Block.h
lldb_private::Stream::IndentLess
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
Definition: Stream.cpp:171
lldb_private::Block::GetRangeContainingAddress
bool GetRangeContainingAddress(const Address &addr, AddressRange &range)
Definition: Block.cpp:250
lldb_private::SymbolFile
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:46
lldb_private::SymbolContext::block
Block * block
The Block for a given query.
Definition: SymbolContext.h:321
lldb_private::DumpAddressRange
void DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix=nullptr, const char *suffix=nullptr)
Output an address range to this stream.
Definition: Stream.cpp:93
lldb_private::Range::GetRangeBase
BaseType GetRangeBase() const
Definition: RangeMap.h:46
lldb_private::Block::m_variable_list_sp
lldb::VariableListSP m_variable_list_sp
The variable list for all local, static and parameter variables scoped to this block.
Definition: Block.h:369
lldb_private::Block::m_children
collection m_children
Definition: Block.h:366
lldb_private::Block::GetBlockVariableList
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Definition: Block.cpp:399
lldb_private::Block::SetBlockInfoHasBeenParsed
void SetBlockInfoHasBeenParsed(bool b, bool set_children)
Definition: Block.cpp:486
lldb_private::RangeVector::FindEntryIndexThatContains
uint32_t FindEntryIndexThatContains(B addr) const
Definition: RangeMap.h:316
lldb_private::LLDBLog::Symbols
@ Symbols
lldb_private::Function::GetAddressRange
const AddressRange & GetAddressRange()
Definition: Function.h:457
lldb_private::SymbolContextScope::CalculateSymbolContextModule
virtual lldb::ModuleSP CalculateSymbolContextModule()
Definition: SymbolContextScope.h:78
lldb_private::RangeVector::Sort
void Sort()
Definition: RangeMap.h:217
lldb_private::Block::GetSibling
Block * GetSibling() const
Get the sibling block for this block.
Definition: Block.cpp:505
lldb_private::VariableList::AddVariable
void AddVariable(const lldb::VariableSP &var_sp)
Definition: VariableList.cpp:25
lldb_private::SymbolContextScope::CalculateSymbolContextFunction
virtual Function * CalculateSymbolContextFunction()
Definition: SymbolContextScope.h:84
lldb_private::UserID
Definition: UserID.h:31
lldb_private::Block::GetParent
Block * GetParent() const
Get the parent block.
Definition: Block.cpp:202
LLDB_LOGF
#define LLDB_LOGF(log,...)
Definition: Log.h:344
lldb_private::Block::Block
Block(lldb::user_id_t uid)
Construct with a User ID uid, depth.
Definition: Block.cpp:24
lldb_private::AddressRange::GetByteSize
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
Definition: AddressRange.h:221
lldb_private::Block::m_parsed_child_blocks
bool m_parsed_child_blocks
Definition: Block.h:374
Module.h
lldb_private::RangeVector::GetEntryRef
Entry & GetEntryRef(size_t i)
Definition: RangeMap.h:303
lldb_private::Block::GetSiblingForChild
Block * GetSiblingForChild(const Block *child_block) const
Definition: Block.cpp:515
lldb_private::Block::CalculateSymbolContextCompileUnit
CompileUnit * CalculateSymbolContextCompileUnit() override
Definition: Block.cpp:148
lldb_private::Block::GetSymbolFile
SymbolFile * GetSymbolFile()
Get the symbol file which contains debug info for this block's symbol context module.
Definition: Block.cpp:474
lldb_private::Declaration::GetFile
FileSpec & GetFile()
Get accessor for file specification.
Definition: Declaration.h:107
lldb_private::Block::Range
RangeList::Entry Range
Definition: Block.h:44
lldb_private::Stream
Definition: Stream.h:28
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::RangeVector::CombineConsecutiveRanges
void CombineConsecutiveRanges()
Definition: RangeMap.h:236
lldb_private::SymbolContext
Definition: SymbolContext.h:33
lldb_private::Target
Definition: Target.h:469
Section.h
lldb_private::VariableList
Definition: VariableList.h:18
lldb_private::RangeVector::Append
void Append(const Entry &entry)
Definition: RangeMap.h:179
lldb_private::Block::CalculateSymbolContextBlock
Block * CalculateSymbolContextBlock() override
Definition: Block.cpp:160
lldb_private::CompileUnit
Definition: CompileUnit.h:38
lldb_private::Block::m_parsed_block_info
bool m_parsed_block_info
Set to true if this block and it's children have all been parsed.
Definition: Block.h:373
lldb_private::Block::AddRange
void AddRange(const Range &range)
Add a new offset range to this block.
Definition: Block.cpp:335
lldb_private::Function
Definition: Function.h:409
lldb_private::Stream::Indent
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
Log.h
lldb_private::SymbolContextScope::CalculateSymbolContextCompileUnit
virtual CompileUnit * CalculateSymbolContextCompileUnit()
Definition: SymbolContextScope.h:82
lldb_private::Block::AddChild
void AddChild(const lldb::BlockSP &child_block_sp)
Add a child to this object.
Definition: Block.cpp:385
lldb_private::SymbolContextScope::CalculateSymbolContext
virtual void CalculateSymbolContext(SymbolContext *sc)=0
Reconstruct the object's symbol context into sc.
lldb_private::Address::GetFileAddress
lldb::addr_t GetFileAddress() const
Get the file address.
Definition: Address.cpp:291
lldb_private::Block::CalculateSymbolContextFunction
Function * CalculateSymbolContextFunction() override
Definition: Block.cpp:154
lldb_private::Block::GetInlinedParent
Block * GetInlinedParent()
Get the inlined parent block for this block.
Definition: Block.cpp:214
lldb_private::Block::CalculateSymbolContextModule
lldb::ModuleSP CalculateSymbolContextModule() override
Definition: Block.cpp:142
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::Type::GetDeclaration
const lldb_private::Declaration & GetDeclaration() const
Definition: Type.cpp:470
lldb_private::Block::m_inlineInfoSP
lldb::InlineFunctionInfoSP m_inlineInfoSP
Inlined function information.
Definition: Block.h:368
lldb_private::Block::MemorySize
size_t MemorySize() const
Get the memory cost of this object.
Definition: Block.cpp:376
lldb_private::Block::m_parsed_block_variables
bool m_parsed_block_variables
Definition: Block.h:374
lldb_private::Block::AppendBlockVariables
uint32_t AppendBlockVariables(bool can_create, bool get_child_block_variables, bool stop_if_child_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Get the variable list for this block and optionally all child blocks if get_child_variables is true.
Definition: Block.cpp:413
lldb_private::Block::SetInlinedFunctionInfo
void SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr)
Set accessor for any inlined function information.
Definition: Block.cpp:392
lldb_private::Address::GetSection
lldb::SectionSP GetSection() const
Get const accessor for the section.
Definition: Address.h:429
lldb_private::RangeVector::IsEmpty
bool IsEmpty() const
Definition: RangeMap.h:293
lldb_private::SymbolContextScope::CalculateSymbolContextBlock
virtual Block * CalculateSymbolContextBlock()
Definition: SymbolContextScope.h:86
lldb_private::Block::GetContainingInlinedBlockWithCallSite
Block * GetContainingInlinedBlockWithCallSite(const Declaration &find_call_site)
Get the inlined block at the given call site that contains this block.
Definition: Block.cpp:225
VariableList.h
lldb_private::CompilerDeclContext
Represents a generic declaration context in a program.
Definition: CompilerDeclContext.h:30
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::Block::AppendVariables
uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function< bool(Variable *)> &filter, VariableList *variable_list)
Appends the variables from this block, and optionally from all parent blocks, to variable_list.
Definition: Block.cpp:443
lldb_private::Declaration::GetLine
uint32_t GetLine() const
Get accessor for the declaration line number.
Definition: Declaration.h:120
lldb_private::Block
Definition: Block.h:41
lldb_private::AddressRange::Clear
void Clear()
Clear the object's state.
Definition: AddressRange.cpp:143
uint32_t
lldb_private::Block::Contains
bool Contains(lldb::addr_t range_offset) const
Check if an offset is in one of the block offset ranges.
Definition: Block.cpp:180
lldb_private::Stream::IndentMore
void IndentMore(unsigned amount=2)
Increment the current indentation level.
Definition: Stream.cpp:168
lldb_private::Block::GetDeclContext
CompilerDeclContext GetDeclContext()
Definition: Block.cpp:480
lldb_private::Block::m_ranges
RangeList m_ranges
Definition: Block.h:367
lldb_private::Address
Definition: Address.h:59
lldb_private::Stream::EOL
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb_private::Block::GetRangeContainingOffset
bool GetRangeContainingOffset(const lldb::addr_t offset, Range &range)
Definition: Block.cpp:240
lldb_private::Block::GetRangeAtIndex
bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range)
Definition: Block.cpp:303
lldb_private::Block::FinalizeRanges
void FinalizeRanges()
Definition: Block.cpp:330
lldb_private::Type
Definition: Type.h:66
lldb_private::Stream::AsRawOstream
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
Definition: Stream.h:357
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:19
lldb_private::Block::m_parent_scope
SymbolContextScope * m_parent_scope
Definition: Block.h:365
lldb_private::SymbolContext::module_sp
lldb::ModuleSP module_sp
The Module for a given query.
Definition: SymbolContext.h:318
lldb_private::Address::SetOffset
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
Definition: Address.h:438
lldb_private::Block::SetDidParseVariables
void SetDidParseVariables(bool b, bool set_children)
Definition: Block.cpp:496
lldb_private::AddressRange::SetByteSize
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
Definition: AddressRange.h:237
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
Function.h
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::Block::GetRangeContainingLoadAddress
bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target, AddressRange &range)
Definition: Block.cpp:278
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb_private::Block::GetRangeIndexContainingAddress
uint32_t GetRangeIndexContainingAddress(const Address &addr)
Definition: Block.cpp:286
lldb_private::Block::GetDescription
void GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Target *target) const
Definition: Block.cpp:31
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::Block::FindBlockByID
Block * FindBlockByID(lldb::user_id_t block_id)
Definition: Block.cpp:112
lldb_private::Address::GetOffset
lldb::addr_t GetOffset() const
Get the section relative offset value.
Definition: Address.h:319
lldb_private::RangeVector::FindEntryThatContains
const Entry * FindEntryThatContains(B addr) const
Definition: RangeMap.h:338
lldb_private::Block::GetStartAddress
bool GetStartAddress(Address &addr)
Definition: Block.cpp:317
lldb_private::Block::DumpSymbolContext
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
Definition: Block.cpp:162
lldb_private::Log
Definition: Log.h:115
lldb_private::Variable
Definition: Variable.h:25
lldb_private::Block::GetInlinedFunctionInfo
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
Definition: Block.h:276
lldb_private::Block::DumpAddressRanges
void DumpAddressRanges(Stream *s, lldb::addr_t base_addr)
Definition: Block.cpp:169
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:309
lldb_private::FileSpec::GetPath
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
Definition: FileSpec.cpp:364
lldb_private::Declaration
Definition: Declaration.h:24
lldb_private::Address::Slide
bool Slide(int64_t offset)
Definition: Address.h:449
lldb
Definition: SBAddress.h:15
lldb_private::Block::CalculateSymbolContext
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Definition: Block.cpp:136
LLDBLog.h
SymbolFile.h
lldb_private::Block::GetContainingInlinedBlock
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
Definition: Block.cpp:208
lldb_private::Block::~Block
~Block() override
Destructor.
lldb_private::Range::Clear
void Clear(BaseType b=0)
Definition: RangeMap.h:40
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::Block::Dump
void Dump(Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const
Dump the block contents.
Definition: Block.cpp:59
lldb_private::RangeVector::GetSize
size_t GetSize() const
Definition: RangeMap.h:295