25 :
Block(function_uid, function) {}
35 *s <<
"id = " << ((
const UserID &)*
this);
37 size_t num_ranges =
m_ranges.GetSize();
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;
85 size_t num_ranges =
m_ranges.GetSize();
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;
131 if (
Block *block = block_sp->FindInnermostBlockByOffset(offset))
171 size_t num_ranges =
m_ranges.GetSize();
172 for (
size_t i = 0; i < num_ranges; ++i) {
181 return m_ranges.FindEntryThatContains(range_offset) !=
nullptr;
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)
199 return m_ranges.FindEntryThatContains(range) !=
nullptr;
227 while (inlined_block) {
231 function_info->GetCallSite().FileAndLineEqual(find_call_site,
true))
232 return inlined_block;
239 const Range *range_ptr =
m_ranges.FindEntryThatContains(offset);
258 func_addr.
GetModule()->GetSectionList());
283 return m_ranges.FindEntryIndexThatContains(file_addr - func_file_addr);
291 func_addr.
GetModule()->GetSectionList());
295 if (range_idx >=
m_ranges.GetSize())
312 for (
size_t i = 0, e =
m_ranges.GetSize(); i < e; ++i)
328 m_ranges.CombineConsecutiveRanges();
333 if (parent_block && !parent_block->
Contains(range)) {
346 "warning: %s:%u block {0x%8.8" PRIx64
347 "} has range[%u] [0x%" PRIx64
" - 0x%" PRIx64
348 ") which is not contained in parent block {0x%8.8" PRIx64
349 "} in function {0x%8.8" PRIx64
"} from %s",
352 block_end_addr, parent_block->
GetID(), function.
GetID(),
353 module_sp->GetFileSpec().GetPath().c_str());
356 "warning: block {0x%8.8" PRIx64
"} has range[%u] [0x%" PRIx64
358 ") which is not contained in parent block {0x%8.8" PRIx64
359 "} in function {0x%8.8" PRIx64
"} from %s",
361 block_end_addr, parent_block->
GetID(), function.
GetID(),
362 module_sp->GetFileSpec().GetPath().c_str());
388 m_inlineInfoSP = std::make_shared<InlineFunctionInfo>(name, mangled, decl_ptr,
399 sc.
module_sp->GetSymbolFile()->ParseVariablesForContext(sc);
407 bool stop_if_child_block_is_inlined_function,
408 const std::function<
bool(
Variable *)> &filter,
410 uint32_t num_variables_added = 0;
412 if (block_var_list) {
413 for (
const VariableSP &var_sp : *block_var_list) {
414 if (filter(var_sp.get())) {
415 num_variables_added++;
421 if (get_child_block_variables) {
422 collection::const_iterator pos, end =
m_children.end();
423 for (pos =
m_children.begin(); pos != end; ++pos) {
424 Block *child_block = pos->get();
425 if (!stop_if_child_block_is_inlined_function ||
428 can_create, get_child_block_variables,
429 stop_if_child_block_is_inlined_function, filter, variable_list);
433 return num_variables_added;
437 bool stop_if_block_is_inlined_function,
438 const std::function<
bool(
Variable *)> &filter,
440 uint32_t num_variables_added = 0;
444 if (variable_list_sp) {
445 for (
size_t i = 0; i < variable_list_sp->GetSize(); ++i) {
446 VariableSP variable = variable_list_sp->GetVariableAtIndex(i);
447 if (filter(variable.get())) {
448 num_variables_added++;
454 if (get_parent_variables) {
455 if (stop_if_block_is_inlined_function && is_inlined_function)
456 return num_variables_added;
461 can_create, get_parent_variables, stop_if_block_is_inlined_function,
462 filter, variable_list);
464 return num_variables_added;
469 return module_sp->GetSymbolFile();
475 return sym_file->GetDeclContextForUID(
GetID());
483 collection::const_iterator pos, end =
m_children.end();
484 for (pos =
m_children.begin(); pos != end; ++pos)
485 (*pos)->SetBlockInfoHasBeenParsed(b,
true);
492 collection::const_iterator pos, end =
m_children.end();
493 for (pos =
m_children.begin(); pos != end; ++pos)
494 (*pos)->SetDidParseVariables(b,
true);
508 collection::const_iterator pos, end =
m_children.end();
509 for (pos =
m_children.begin(); pos != end; ++pos) {
510 if (pos->get() == child_block) {
static AddressRange ToAddressRange(const Address &func_addr, const Block::Range &block_range)
#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.
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::ModuleSP GetModule() const
Get accessor for the module for this address.
lldb::addr_t GetFileAddress() const
Get the file address.
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
RangeList m_ranges
Address ranges of this block.
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).
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.
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...
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
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
lldb::user_id_t GetID() const
Get accessor for the user ID.