class CodeBlock
Defined at line 21 of file ../../src/developer/debug/zxdb/symbols/code_block.h
Base class for anything that has code: lexical blocks, inlined subroutines, and functions. A
DWARF lexical block is represented as a CodeBlock rather than a derived type since it has no
additional attributes.
Public Methods
fxl::RefPtr<CodeBlock> GetContainingBlock ()
Returns the block (function, inline, lexical scope) that contains this one. May return null if
this isn't inside another block.
This is different than getting the parent() because the parent() of an inline class member
function is the class it's a member of, but the containing block is the code block the inlined
function was inlined into.
See also Function::containing_block().
Defined at line 23 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
AddressRanges GetAbsoluteCodeRanges (const SymbolContext & symbol_context)
Retrieves the code ranges for this block in absolute addresses for the process.
Defined at line 32 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
AddressRange GetFullRange (const SymbolContext & symbol_context)
Computes the full code range covering all sub-ranges. There can be multiple code ranges that
can be discontiguous so not everything in this range is guaranteed to be inside the code block.
Returns empty AddressRange if there are no code ranges.
Defined at line 36 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
bool ContainsAddress (const SymbolContext & symbol_context, uint64_t absolute_address)
Returns true if the block's code ranges contain the given address. A block with no specified
range will always return true.
Defined at line 43 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
const AddressRanges & code_ranges ()
The valid ranges of code for this block. In many cases there will be only one range (most
functions specify DW_AT_low_pc and DW_AT_high_pc), but some blocks, especially inlined
subroutines, may be at multiple discontiguous ranges in the code (DW_AT_ranges are specified).
In this case, the ranges will be in sorted order.
Some lexical blocks won't have location information in them. These are often strictly to hold
groups of variables, each of which has their own range of validity.
Function declarations will have no ranges associated with them. These aren't strictly "code
blocks" but many functions won't have a declaration/implementation split and there's so much
overlap it's more convenient to just have one type representing both.
These ranges will be RELATIVE to the module. See GetAbsoluteCodeRanges() to get absolute
addresses.
Defined at line 49 of file ../../src/developer/debug/zxdb/symbols/code_block.h
void set_code_ranges (AddressRanges r)
Defined at line 50 of file ../../src/developer/debug/zxdb/symbols/code_block.h
const std::vector<LazySymbol> & inner_blocks ()
The code blocks (lexical blocks and inlines) that are children of this one.
Defined at line 61 of file ../../src/developer/debug/zxdb/symbols/code_block.h
void set_inner_blocks (std::vector<LazySymbol> ib)
Defined at line 62 of file ../../src/developer/debug/zxdb/symbols/code_block.h
const std::vector<LazySymbol> & variables ()
Variables contained within this block.
Defined at line 65 of file ../../src/developer/debug/zxdb/symbols/code_block.h
void set_variables (std::vector<LazySymbol> v)
Defined at line 66 of file ../../src/developer/debug/zxdb/symbols/code_block.h
const CodeBlock * GetMostSpecificChild (const SymbolContext & symbol_context, uint64_t absolute_address, bool recurse_into_inlines)
Recursively searches all children of this block for the innermost block covering the given
address. Returns |this| if the current block is already the most specific, or nullptr if the
current block doesn't contain the address.
Whether this function will go into inlined subroutines is controlled by recurse_into_inlines.
In many cases the Stack will handle expanding inlined subroutines and one would use this
function to find the most specific code block in the current virtual frame.
Defined at line 67 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
const std::vector<LazySymbol> & call_sites ()
All call sites contained within this block. In no specific order.
Defined at line 69 of file ../../src/developer/debug/zxdb/symbols/code_block.h
void set_call_sites (std::vector<LazySymbol> v)
Defined at line 70 of file ../../src/developer/debug/zxdb/symbols/code_block.h
fxl::RefPtr<Function> GetContainingFunction (SearchFunction search)
Defined at line 128 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
fxl::RefPtr<CallSite> GetCallSiteForReturnTo (const SymbolContext & symbol_context, TargetPointer absolute_return_address)
Searches this code block and all descendents for a call site annotation matching the given
return address. Returns null if there is no call site record for this return address.
Defined at line 93 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
std::vector<fxl::RefPtr<Function>> GetInlineChain ()
Returns the chain of inline functions to the current code block.
The returned vector will go back in time. The [0] item will be the most specific function
containing this code block (always GetContainingFunction(), will be = |this| if this is a
function).
The back "should" be the containing non-inlined function (this depends on the symbols declaring
a function for the code block which they should do, but calling code shouldn't crash on
malformed symbols).
If the current block is not in an inline function, the returned vector will have one element.
Defined at line 142 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
std::vector<fxl::RefPtr<Function>> GetAmbiguousInlineChain (const SymbolContext & symbol_context, TargetPointer absolute_address)
Like GetInlineChain() but returns only those functions with ambiguous inline locations at the
given address. If the address is at the first address of an inline routine, it's ambiguous
whether the virtual location is at the first instruction of the inlined function, or at the
optimized-out "call" to the inlined function.
The returned vector will go back in time. The [0] item will be the most specific function
containing this code block (always GetContainingFunction(), will be = |this| if this is a
function).
When the [0] item is ambiguous (the address is at the beginning of it), the [1] item will
be the containing function (inlined or not). If that's also ambiguous, there will be a [2]
item, etc. The back() item will be either a non-inlined function or a non-ambiguous inlined
function.
Defined at line 167 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
Protected Methods
void CodeBlock (DwarfTag tag)
Defined at line 16 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
void ~CodeBlock ()
Defined at line 21 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
const CodeBlock * AsCodeBlock ()
Symbol protected overrides.
Defined at line 30 of file ../../src/developer/debug/zxdb/symbols/code_block.cc
Enumerations
enum SearchFunction
| Name | Value |
|---|---|
| kInlineOrPhysical | 0 |
| kPhysicalOnly | 1 |
Recursively searches the containing blocks until it finds a function (physical or inline). If
this code block is a function, returns |this| as a Function. Returns null on error, but this
should not happen for well-formed symbols (all code should be inside functions).
Defined at line 90 of file ../../src/developer/debug/zxdb/symbols/code_block.h
Friends
class MakeRefCountedHelper
class RefCountedThreadSafe