25 :
Block(function_uid, function) {}
28 :
UserID(uid), m_parent_scope(parent_scope), m_parsed_block_info(false),
29 m_parsed_block_variables(false), m_parsed_child_blocks(false) {}
35 *s <<
"id = " << ((
const UserID &)*
this);
47 s->
Printf(
", range%s = ", num_ranges > 1 ?
"s" :
"");
48 for (
size_t i = 0; i < num_ranges; ++i) {
62 bool show_context)
const {
67 parent->
Dump(s, base_addr, depth + 1, show_context);
71 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
73 *s <<
"Block" <<
static_cast<const UserID &
>(*this);
76 s->
Printf(
", parent = {0x%8.8" PRIx64
"}", parent_block->
GetID());
79 bool show_fullpaths =
false;
87 for (
size_t i = 0; i < num_ranges; ++i) {
89 if (parent_block !=
nullptr && !parent_block->
Contains(range))
106 collection::const_iterator pos, end =
m_children.end();
107 for (pos =
m_children.begin(); pos != end; ++pos)
108 (*pos)->Dump(s, base_addr, depth - 1, show_context);
115 if (block_id ==
GetID())
118 Block *matching_block =
nullptr;
119 collection::const_iterator pos, end =
m_children.end();
120 for (pos =
m_children.begin(); pos != end; ++pos) {
125 return matching_block;
167 for (
size_t i = 0; i < num_ranges; ++i) {
184 const Block *block_parent;
185 for (block_parent = block->
GetParent(); block_parent !=
nullptr;
186 block_parent = block_parent->
GetParent()) {
187 if (
this == block_parent)
222 while (inlined_block) {
226 function_info->GetCallSite().FileAndLineEqual(find_call_site,
true))
227 return inlined_block;
250 const addr_t func_file_addr =
252 if (file_addr >= func_file_addr &&
253 file_addr < func_file_addr + func_range.
GetByteSize()) {
254 addr_t offset = file_addr - func_file_addr;
287 if (addr_offset >= func_offset &&
288 addr_offset < func_offset + func_range.
GetByteSize()) {
289 addr_t offset = addr_offset - func_offset;
317 ranges.emplace_back();
318 auto &range = ranges.back();
347 if (parent_block && !parent_block->
Contains(range)) {
352 const addr_t function_file_addr =
361 "warning: %s:%u block {0x%8.8" PRIx64
362 "} has range[%u] [0x%" PRIx64
" - 0x%" PRIx64
363 ") which is not contained in parent block {0x%8.8" PRIx64
364 "} in function {0x%8.8" PRIx64
"} from %s",
367 block_end_addr, parent_block->
GetID(), function->
GetID(),
368 module_sp->GetFileSpec().GetPath().c_str());
371 "warning: block {0x%8.8" PRIx64
"} has range[%u] [0x%" PRIx64
373 ") which is not contained in parent block {0x%8.8" PRIx64
374 "} in function {0x%8.8" PRIx64
"} from %s",
376 block_end_addr, parent_block->
GetID(), function->
GetID(),
377 module_sp->GetFileSpec().GetPath().c_str());
403 m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
414 sc.
module_sp->GetSymbolFile()->ParseVariablesForContext(sc);
422 bool stop_if_child_block_is_inlined_function,
423 const std::function<
bool(
Variable *)> &filter,
425 uint32_t num_variables_added = 0;
427 if (block_var_list) {
428 for (
const VariableSP &var_sp : *block_var_list) {
429 if (filter(var_sp.get())) {
430 num_variables_added++;
436 if (get_child_block_variables) {
437 collection::const_iterator pos, end =
m_children.end();
438 for (pos =
m_children.begin(); pos != end; ++pos) {
439 Block *child_block = pos->get();
440 if (!stop_if_child_block_is_inlined_function ||
443 can_create, get_child_block_variables,
444 stop_if_child_block_is_inlined_function, filter, variable_list);
448 return num_variables_added;
452 bool stop_if_block_is_inlined_function,
453 const std::function<
bool(
Variable *)> &filter,
455 uint32_t num_variables_added = 0;
459 if (variable_list_sp) {
460 for (
size_t i = 0; i < variable_list_sp->GetSize(); ++i) {
461 VariableSP variable = variable_list_sp->GetVariableAtIndex(i);
462 if (filter(variable.get())) {
463 num_variables_added++;
469 if (get_parent_variables) {
470 if (stop_if_block_is_inlined_function && is_inlined_function)
471 return num_variables_added;
476 can_create, get_parent_variables, stop_if_block_is_inlined_function,
477 filter, variable_list);
479 return num_variables_added;
484 return module_sp->GetSymbolFile();
490 return sym_file->GetDeclContextForUID(
GetID());
498 collection::const_iterator pos, end =
m_children.end();
499 for (pos =
m_children.begin(); pos != end; ++pos)
500 (*pos)->SetBlockInfoHasBeenParsed(b,
true);
507 collection::const_iterator pos, end =
m_children.end();
508 for (pos =
m_children.begin(); pos != end; ++pos)
509 (*pos)->SetDidParseVariables(b,
true);
523 collection::const_iterator pos, end =
m_children.end();
524 for (pos =
m_children.begin(); pos != end; ++pos) {
525 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::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
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.
Block(Function &function, lldb::user_id_t function_uid)
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)
lldb::BlockSP CreateChild(lldb::user_id_t uid)
Creates a block with the specified UID uid.
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.
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.
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 * CalculateSymbolContextBlock() override
void DumpAddressRanges(Stream *s, lldb::addr_t base_addr)
Block * GetInlinedParent()
Get the inlined parent block for this block.
SymbolContextScope & m_parent_scope
uint32_t GetRangeIndexContainingAddress(const Address &addr)
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()
DEPRECATED: Use GetAddressRanges instead.
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.
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
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.