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) {}
33 *s <<
"id = " << ((
const UserID &)*
this);
45 s->
Printf(
", range%s = ", num_ranges > 1 ?
"s" :
"");
46 for (
size_t i = 0; i < num_ranges; ++i) {
60 bool show_context)
const {
65 parent->
Dump(s, base_addr, depth + 1, show_context);
69 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
71 *s <<
"Block" <<
static_cast<const UserID &
>(*this);
74 s->
Printf(
", parent = {0x%8.8" PRIx64
"}", parent_block->
GetID());
77 bool show_fullpaths =
false;
85 for (
size_t i = 0; i < num_ranges; ++i) {
87 if (parent_block !=
nullptr && !parent_block->
Contains(range))
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);
113 if (block_id ==
GetID())
116 Block *matching_block =
nullptr;
117 collection::const_iterator pos, end =
m_children.end();
118 for (pos =
m_children.begin(); pos != end; ++pos) {
123 return matching_block;
172 for (
size_t i = 0; i < num_ranges; ++i) {
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)
229 while (inlined_block) {
233 function_info->GetCallSite().FileAndLineEqual(find_call_site))
234 return inlined_block;
258 if (addr_offset >= func_offset &&
259 addr_offset < func_offset + func_range.
GetByteSize()) {
260 addr_t offset = addr_offset - func_offset;
293 if (addr_offset >= func_offset &&
294 addr_offset < func_offset + func_range.
GetByteSize()) {
295 addr_t offset = addr_offset - func_offset;
323 ranges.emplace_back();
324 auto &range = ranges.back();
353 if (parent_block && !parent_block->
Contains(range)) {
358 const addr_t function_file_addr =
367 "warning: %s:%u block {0x%8.8" PRIx64
368 "} has range[%u] [0x%" PRIx64
" - 0x%" PRIx64
369 ") which is not contained in parent block {0x%8.8" PRIx64
370 "} in function {0x%8.8" PRIx64
"} from %s",
373 block_end_addr, parent_block->
GetID(), function->
GetID(),
374 module_sp->GetFileSpec().GetPath().c_str());
377 "warning: block {0x%8.8" PRIx64
"} has range[%u] [0x%" PRIx64
379 ") which is not contained in parent block {0x%8.8" PRIx64
380 "} in function {0x%8.8" PRIx64
"} from %s",
382 block_end_addr, parent_block->
GetID(), function->
GetID(),
383 module_sp->GetFileSpec().GetPath().c_str());
402 if (child_block_sp) {
403 child_block_sp->SetParentScope(
this);
411 m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
422 sc.
module_sp->GetSymbolFile()->ParseVariablesForContext(sc);
430 bool stop_if_child_block_is_inlined_function,
431 const std::function<
bool(
Variable *)> &filter,
433 uint32_t num_variables_added = 0;
435 if (block_var_list) {
436 for (
const VariableSP &var_sp : *block_var_list) {
437 if (filter(var_sp.get())) {
438 num_variables_added++;
444 if (get_child_block_variables) {
445 collection::const_iterator pos, end =
m_children.end();
446 for (pos =
m_children.begin(); pos != end; ++pos) {
447 Block *child_block = pos->get();
448 if (!stop_if_child_block_is_inlined_function ||
451 can_create, get_child_block_variables,
452 stop_if_child_block_is_inlined_function, filter, variable_list);
456 return num_variables_added;
460 bool stop_if_block_is_inlined_function,
461 const std::function<
bool(
Variable *)> &filter,
463 uint32_t num_variables_added = 0;
467 if (variable_list_sp) {
468 for (
size_t i = 0; i < variable_list_sp->GetSize(); ++i) {
469 VariableSP variable = variable_list_sp->GetVariableAtIndex(i);
470 if (filter(variable.get())) {
471 num_variables_added++;
477 if (get_parent_variables) {
478 if (stop_if_block_is_inlined_function && is_inlined_function)
479 return num_variables_added;
484 can_create, get_parent_variables, stop_if_block_is_inlined_function,
485 filter, variable_list);
487 return num_variables_added;
492 return module_sp->GetSymbolFile();
498 return sym_file->GetDeclContextForUID(
GetID());
506 collection::const_iterator pos, end =
m_children.end();
507 for (pos =
m_children.begin(); pos != end; ++pos)
508 (*pos)->SetBlockInfoHasBeenParsed(b,
true);
515 collection::const_iterator pos, end =
m_children.end();
516 for (pos =
m_children.begin(); pos != end; ++pos)
517 (*pos)->SetDidParseVariables(b,
true);
533 collection::const_iterator pos, end =
m_children.end();
534 for (pos =
m_children.begin(); pos != end; ++pos) {
535 if (pos->get() == child_block) {
#define LLDB_LOGF(log,...)
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
void Clear()
Clear the object's state.
void SetByteSize(lldb::addr_t byte_size)
Set accessor for the byte size of this range.
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
bool SetLoadAddress(lldb::addr_t load_addr, Target *target, bool allow_section_end=false)
Set the address to represent load_addr.
lldb::SectionSP GetSection() const
Get const accessor for the section.
bool Slide(int64_t offset)
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool SetOffset(lldb::addr_t offset)
Set accessor for the offset.
A class that describes a single lexical block.
lldb::VariableListSP m_variable_list_sp
The variable list for all local, static and parameter variables scoped to this block.
lldb::VariableListSP GetBlockVariableList(bool can_create)
Get the variable list for this block only.
Block * GetContainingInlinedBlockWithCallSite(const Declaration &find_call_site)
Get the inlined block at the given call site that contains this block.
void CalculateSymbolContext(SymbolContext *sc) override
Reconstruct the object's symbol context into sc.
Block * FindInnermostBlockByOffset(const lldb::addr_t offset)
lldb::ModuleSP CalculateSymbolContextModule() override
Block * GetContainingInlinedBlock()
Get the inlined block that contains this block.
void SetBlockInfoHasBeenParsed(bool b, bool set_children)
bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range)
const InlineFunctionInfo * GetInlinedFunctionInfo() const
Get const accessor for any inlined function information.
AddressRanges GetRanges()
bool m_parsed_child_blocks
lldb::InlineFunctionInfoSP m_inlineInfoSP
Inlined function information.
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
bool GetRangeContainingAddress(const Address &addr, AddressRange &range)
Block * FindBlockByID(lldb::user_id_t block_id)
bool m_parsed_block_info
Set to true if this block and it's children have all been parsed.
Block * GetSibling() const
Get the sibling block for this block.
bool Contains(lldb::addr_t range_offset) const
Check if an offset is in one of the block offset ranges.
SymbolContextScope * m_parent_scope
CompileUnit * CalculateSymbolContextCompileUnit() override
Block * GetSiblingForChild(const Block *child_block) const
Function * CalculateSymbolContextFunction() override
bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target, AddressRange &range)
CompilerDeclContext GetDeclContext()
bool m_parsed_block_variables
Block * GetParent() const
Get the parent block.
~Block() override
Destructor.
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.
bool GetStartAddress(Address &addr)
SymbolFile * GetSymbolFile()
Get the symbol file which contains debug info for this block's symbol context module.
void Dump(Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const
Dump the block contents.
void SetDidParseVariables(bool b, bool set_children)
bool GetRangeContainingOffset(const lldb::addr_t offset, Range &range)
void AddRange(const Range &range)
Add a new offset range to this block.
Block(lldb::user_id_t uid)
Construct with a User ID uid, depth.
Block * CalculateSymbolContextBlock() override
void DumpAddressRanges(Stream *s, lldb::addr_t base_addr)
Block * GetInlinedParent()
Get the inlined parent block for this block.
uint32_t GetRangeIndexContainingAddress(const Address &addr)
void AddChild(const lldb::BlockSP &child_block_sp)
Add a child to this object.
void SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr)
Set accessor for any inlined function information.
size_t MemorySize() const
Get the memory cost of this object.
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.
void GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Target *target) const
A class that describes a compilation unit.
Represents a generic declaration context in a program.
A class that describes the declaration location of a lldb object.
uint32_t GetLine() const
Get accessor for the declaration line number.
FileSpec & GetFile()
Get accessor for file specification.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
A class that describes a function.
const AddressRange & GetAddressRange()
void DumpSymbolContext(Stream *s) override
Dump the object's symbol context to the stream s.
Type * GetType()
Get accessor for the type that describes the function return value type, and parameter types.
const Entry * FindEntryThatContains(B addr) const
uint32_t FindEntryIndexThatContains(B addr) const
Entry & GetEntryRef(size_t i)
void Append(const Entry &entry)
void CombineConsecutiveRanges()
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
virtual Function * CalculateSymbolContextFunction()
virtual CompileUnit * CalculateSymbolContextCompileUnit()
virtual void CalculateSymbolContext(SymbolContext *sc)=0
Reconstruct the object's symbol context into sc.
virtual Block * CalculateSymbolContextBlock()
virtual lldb::ModuleSP CalculateSymbolContextModule()
Defines a symbol context baton that can be handed other debug core functions.
Block * block
The Block for a given query.
lldb::ModuleSP module_sp
The Module for a given query.
Provides public interface for all SymbolFiles.
const lldb_private::Declaration & GetDeclaration() const
void AddVariable(const lldb::VariableSP &var_sp)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
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.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::shared_ptr< lldb_private::Block > BlockSP
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::Module > ModuleSP
BaseType GetRangeBase() const
SizeType GetByteSize() const
BaseType GetRangeEnd() const
A mix in class that contains a generic user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.