summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r--lldb/source/Symbol/Block.cpp6
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp89
2 files changed, 94 insertions, 1 deletions
diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp
index d1e4d401498..6676279dabf 100644
--- a/lldb/source/Symbol/Block.cpp
+++ b/lldb/source/Symbol/Block.cpp
@@ -367,7 +367,7 @@ Block::GetRangeContainingOffset (const addr_t offset, VMRange &range)
bool
-Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
+Block::GetRangeContainingAddress (const Address& addr, AddressRange &range, uint32_t *range_idx_ptr)
{
Function *function = CalculateSymbolContextFunction();
if (function)
@@ -387,11 +387,15 @@ Block::GetRangeContainingAddress (const Address& addr, AddressRange &range)
range.GetBaseAddress() = func_range.GetBaseAddress();
range.GetBaseAddress().SetOffset(func_offset + m_ranges[range_idx].GetBaseAddress());
range.SetByteSize(m_ranges[range_idx].GetByteSize());
+ if (range_idx_ptr)
+ *range_idx_ptr = range_idx;
return true;
}
}
}
}
+ if (range_idx_ptr)
+ *range_idx_ptr = UINT32_MAX;
range.Clear();
return false;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 45a5f52c3bf..c7b2fb26613 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -487,6 +487,95 @@ SymbolContext::FindTypeByName (const ConstString &name) const
return return_value;
}
+bool
+SymbolContext::GetParentInlinedFrameInfo (const Address &curr_frame_pc,
+ bool is_concrete_frame,
+ SymbolContext &next_frame_sc,
+ Address &inlined_frame_addr) const
+{
+ next_frame_sc.Clear();
+ inlined_frame_addr.Clear();
+
+ if (block)
+ {
+ bool concrete_has_inlines = false;
+ Block *curr_inlined_block = NULL;
+ Block *next_inlined_block = NULL;
+ //const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress();
+ if (is_concrete_frame)
+ {
+ curr_inlined_block = block->GetContainingInlinedBlock();
+ if (curr_inlined_block)
+ {
+ concrete_has_inlines = true;
+ next_inlined_block = curr_inlined_block->GetInlinedParent();
+ }
+ }
+ else
+ {
+ curr_inlined_block = block;
+ next_inlined_block = block->GetInlinedParent();
+ }
+
+ if (next_inlined_block)
+ {
+ next_inlined_block->CalculateSymbolContext (&next_frame_sc);
+
+ AddressRange range;
+ bool got_range = curr_inlined_block->GetRangeContainingAddress (curr_frame_pc, range);
+ assert (got_range);
+ const InlineFunctionInfo* inline_info = next_inlined_block->GetInlinedFunctionInfo();
+ if (inline_info)
+ {
+ inlined_frame_addr = range.GetBaseAddress();
+ next_frame_sc.line_entry.range.GetBaseAddress() = inlined_frame_addr;
+ next_frame_sc.line_entry.file = inline_info->GetCallSite().GetFile();
+ next_frame_sc.line_entry.line = inline_info->GetCallSite().GetLine();
+ next_frame_sc.line_entry.column = inline_info->GetCallSite().GetColumn();
+ return true;
+ }
+ }
+ else if (is_concrete_frame && !concrete_has_inlines)
+ {
+ // This is the symbol context for the frame that was found using the
+ // PC value and there are no inlined blocks so there are no inlined
+ // parent frames.
+ return false;
+ }
+ else
+ {
+ // We have had inlined frames before and now we are at the function
+ // instance that called the inlined frames.
+ // The SymbolContext object should contain a previous inline symbol
+ // context which we need to use to get the file, line and column info
+ const InlineFunctionInfo* inline_info = curr_inlined_block->GetInlinedFunctionInfo();
+ if (inline_info)
+ {
+ Block *parent_block = curr_inlined_block->GetParent();
+ if (parent_block)
+ {
+ parent_block->CalculateSymbolContext (&next_frame_sc);
+
+ AddressRange range;
+ if (curr_inlined_block->GetRangeContainingAddress (curr_frame_pc, range))
+ {
+ inlined_frame_addr = range.GetBaseAddress();
+ //const addr_t range_file_file_addr = inlined_frame_addr.GetFileAddress();
+ next_frame_sc.line_entry.range.GetBaseAddress() = inlined_frame_addr;
+ next_frame_sc.line_entry.file = inline_info->GetCallSite().GetFile();
+ next_frame_sc.line_entry.line = inline_info->GetCallSite().GetLine();
+ next_frame_sc.line_entry.column = inline_info->GetCallSite().GetColumn();
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+
//----------------------------------------------------------------------
//
// SymbolContextSpecifier
OpenPOWER on IntegriCloud