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);
46 s->
Printf(
", range%s = ", num_ranges > 1 ?
"s" :
"");
47 for (
size_t i = 0; i < num_ranges; ++i) {
61 bool show_context)
const {
66 parent->
Dump(s, base_addr, depth + 1, show_context);
70 s->
Printf(
"%p: ",
static_cast<const void *
>(
this));
72 *s <<
"Block" <<
static_cast<const UserID &
>(*this);
75 s->
Printf(
", parent = {0x%8.8" PRIx64
"}", parent_block->
GetID());
78 bool show_fullpaths =
false;
86 for (
size_t i = 0; i < num_ranges; ++i) {
88 if (parent_block !=
nullptr && !parent_block->
Contains(range))
105 collection::const_iterator pos, end =
m_children.end();
106 for (pos =
m_children.begin(); pos != end; ++pos)
107 (*pos)->Dump(s, base_addr, depth - 1, show_context);
114 if (block_id ==
GetID())
117 Block *matching_block =
nullptr;
118 collection::const_iterator pos, end =
m_children.end();
119 for (pos =
m_children.begin(); pos != end; ++pos) {
124 return matching_block;
166 for (
size_t i = 0; i < num_ranges; ++i) {
183 const Block *block_parent;
184 for (block_parent = block->
GetParent(); block_parent !=
nullptr;
185 block_parent = block_parent->
GetParent()) {
186 if (
this == block_parent)
221 while (inlined_block) {
225 function_info->GetCallSite().FileAndLineEqual(find_call_site,
true))
226 return inlined_block;
249 const addr_t func_file_addr =
251 if (file_addr >= func_file_addr &&
252 file_addr < func_file_addr + func_range.
GetByteSize()) {
253 addr_t offset = file_addr - func_file_addr;
286 if (addr_offset >= func_offset &&
287 addr_offset < func_offset + func_range.
GetByteSize()) {
288 addr_t offset = addr_offset - func_offset;
316 ranges.emplace_back();
317 auto &range = ranges.back();
319 range.GetBaseAddress() = function->
GetAddress();
346 if (parent_block && !parent_block->
Contains(range)) {
359 "warning: %s:%u block {0x%8.8" PRIx64
360 "} has range[%u] [0x%" PRIx64
" - 0x%" PRIx64
361 ") which is not contained in parent block {0x%8.8" PRIx64
362 "} in function {0x%8.8" PRIx64
"} from %s",
365 block_end_addr, parent_block->
GetID(), function->
GetID(),
366 module_sp->GetFileSpec().GetPath().c_str());
369 "warning: block {0x%8.8" PRIx64
"} has range[%u] [0x%" PRIx64
371 ") which is not contained in parent block {0x%8.8" PRIx64
372 "} in function {0x%8.8" PRIx64
"} from %s",
374 block_end_addr, parent_block->
GetID(), function->
GetID(),
375 module_sp->GetFileSpec().GetPath().c_str());
401 m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
412 sc.
module_sp->GetSymbolFile()->ParseVariablesForContext(sc);
420 bool stop_if_child_block_is_inlined_function,
421 const std::function<
bool(
Variable *)> &filter,
423 uint32_t num_variables_added = 0;
425 if (block_var_list) {
426 for (
const VariableSP &var_sp : *block_var_list) {
427 if (filter(var_sp.get())) {
428 num_variables_added++;
434 if (get_child_block_variables) {
435 collection::const_iterator pos, end =
m_children.end();
436 for (pos =
m_children.begin(); pos != end; ++pos) {
437 Block *child_block = pos->get();
438 if (!stop_if_child_block_is_inlined_function ||
441 can_create, get_child_block_variables,
442 stop_if_child_block_is_inlined_function, filter, variable_list);
446 return num_variables_added;
450 bool stop_if_block_is_inlined_function,
451 const std::function<
bool(
Variable *)> &filter,
453 uint32_t num_variables_added = 0;
457 if (variable_list_sp) {
458 for (
size_t i = 0; i < variable_list_sp->GetSize(); ++i) {
459 VariableSP variable = variable_list_sp->GetVariableAtIndex(i);
460 if (filter(variable.get())) {
461 num_variables_added++;
467 if (get_parent_variables) {
468 if (stop_if_block_is_inlined_function && is_inlined_function)
469 return num_variables_added;
474 can_create, get_parent_variables, stop_if_block_is_inlined_function,
475 filter, variable_list);
477 return num_variables_added;
482 return module_sp->GetSymbolFile();
488 return sym_file->GetDeclContextForUID(
GetID());
496 collection::const_iterator pos, end =
m_children.end();
497 for (pos =
m_children.begin(); pos != end; ++pos)
498 (*pos)->SetBlockInfoHasBeenParsed(b,
true);
505 collection::const_iterator pos, end =
m_children.end();
506 for (pos =
m_children.begin(); pos != end; ++pos)
507 (*pos)->SetDidParseVariables(b,
true);
521 collection::const_iterator pos, end =
m_children.end();
522 for (pos =
m_children.begin(); pos != end; ++pos) {
523 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 Address & GetAddress() const
Return the address of the function (its entry point).
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.