diff options
| author | Greg Clayton <gclayton@apple.com> | 2010-08-24 21:05:24 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2010-08-24 21:05:24 +0000 |
| commit | 9da7bd07390bc3c35caaea2b59fb74109b860889 (patch) | |
| tree | 502c1f8d69b153bd5e4023ef58d5c6a7eb85e7f0 /lldb/source/Symbol/Block.cpp | |
| parent | ccd28d0665d0d6c405c11ecf5dee9e6dd6f75e1a (diff) | |
| download | bcm5719-llvm-9da7bd07390bc3c35caaea2b59fb74109b860889.tar.gz bcm5719-llvm-9da7bd07390bc3c35caaea2b59fb74109b860889.zip | |
Got a lot of the kinks worked out in the inline support after debugging more
complex inlined examples.
StackFrame classes don't have a "GetPC" anymore, they have "GetFrameCodeAddress()".
This is because inlined frames will have a PC value that is the same as the
concrete frame that owns the inlined frame, yet the code locations for the
frame can be different. We also need to be able to get the real PC value for
a given frame so that variables evaluate correctly. To get the actual PC
value for a frame you can use:
addr_t pc = frame->GetRegisterContext()->GetPC();
Some issues with the StackFrame stomping on its own symbol context were
resolved which were causing the information to change for a frame when the
stack ID was calculated. Also the StackFrame will now correctly store the
symbol context resolve flags for any extra bits of information that were
looked up (if you ask for a block only and you find one, you will alwasy have
the compile unit and function).
llvm-svn: 111964
Diffstat (limited to 'lldb/source/Symbol/Block.cpp')
| -rw-r--r-- | lldb/source/Symbol/Block.cpp | 71 |
1 files changed, 33 insertions, 38 deletions
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index 8256aa7e199..c0b9ac667e0 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -24,7 +24,7 @@ Block::Block(lldb::user_id_t uid) : m_children (), m_ranges (), m_inlineInfoSP (), - m_variables (), + m_variable_list_sp (), m_parsed_block_info (false), m_parsed_block_variables (false), m_parsed_child_blocks (false) @@ -104,9 +104,9 @@ Block::Dump(Stream *s, addr_t base_addr, int32_t depth, bool show_context) const { s->IndentMore(); - if (m_variables.get()) + if (m_variable_list_sp.get()) { - m_variables->Dump(s, show_context); + m_variable_list_sp->Dump(s, show_context); } for (Block *child_block = GetFirstChild(); child_block != NULL; child_block = child_block->GetSibling()) @@ -137,7 +137,7 @@ Block::FindBlockByID (user_id_t block_id) } void -Block::CalculateSymbolContext(SymbolContext* sc) +Block::CalculateSymbolContext (SymbolContext* sc) { if (m_parent_scope) m_parent_scope->CalculateSymbolContext(sc); @@ -149,7 +149,7 @@ Block::DumpStopContext (Stream *s, const SymbolContext *sc) { Block* parent_block = GetParent(); - InlineFunctionInfo* inline_info = InlinedFunctionInfo (); + const InlineFunctionInfo* inline_info = InlinedFunctionInfo (); if (inline_info) { const Declaration &call_site = inline_info->GetCallSite(); @@ -226,7 +226,15 @@ Block::GetParent () const } Block * -Block::GetInlinedParent () const +Block::GetContainingInlinedBlock () +{ + if (InlinedFunctionInfo()) + return this; + return GetInlinedParent (); +} + +Block * +Block::GetInlinedParent () { Block *parent_block = GetParent (); if (parent_block) @@ -241,6 +249,20 @@ Block::GetInlinedParent () const bool +Block::GetRangeContainingOffset (const addr_t offset, VMRange &range) +{ + uint32_t range_idx = VMRange::FindRangeIndexThatContainsValue (m_ranges, offset); + if (range_idx < m_ranges.size()) + { + range = m_ranges[range_idx]; + return true; + } + range.Clear(); + return false; +} + + +bool Block::GetRangeContainingAddress (const Address& addr, AddressRange &range) { SymbolContext sc; @@ -278,18 +300,6 @@ Block::AddRange(addr_t start_offset, addr_t end_offset) m_ranges.back().Reset(start_offset, end_offset); } -InlineFunctionInfo* -Block::InlinedFunctionInfo () -{ - return m_inlineInfoSP.get(); -} - -const InlineFunctionInfo* -Block::InlinedFunctionInfo () const -{ - return m_inlineInfoSP.get(); -} - // Return the current number of bytes that this object occupies in memory size_t Block::MemorySize() const @@ -297,20 +307,12 @@ Block::MemorySize() const size_t mem_size = sizeof(Block) + m_ranges.size() * sizeof(VMRange); if (m_inlineInfoSP.get()) mem_size += m_inlineInfoSP->MemorySize(); - if (m_variables.get()) - mem_size += m_variables->MemorySize(); + if (m_variable_list_sp.get()) + mem_size += m_variable_list_sp->MemorySize(); return mem_size; } -Block * -Block::GetFirstChild () const -{ - if (m_children.empty()) - return NULL; - return m_children.front().get(); -} - void Block::AddChild(const BlockSP &child_block_sp) { @@ -343,7 +345,7 @@ Block::GetVariableList (bool get_child_variables, bool can_create) VariableListSP variable_list_sp; if (m_parsed_block_variables == false) { - if (m_variables.get() == NULL && can_create) + if (m_variable_list_sp.get() == NULL && can_create) { m_parsed_block_variables = true; SymbolContext sc; @@ -353,11 +355,11 @@ Block::GetVariableList (bool get_child_variables, bool can_create) } } - if (m_variables.get()) + if (m_variable_list_sp.get()) { variable_list_sp.reset(new VariableList()); if (variable_list_sp.get()) - variable_list_sp->AddVariables(m_variables.get()); + variable_list_sp->AddVariables(m_variable_list_sp.get()); if (get_child_variables) { @@ -406,13 +408,6 @@ Block::AppendVariables return num_variables_added; } - -void -Block::SetVariableList(VariableListSP& variables) -{ - m_variables = variables; -} - void Block::SetBlockInfoHasBeenParsed (bool b, bool set_children) { |

