summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBFrame.cpp5
-rw-r--r--lldb/source/Commands/CommandObjectArgs.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp2
-rw-r--r--lldb/source/Core/Disassembler.cpp2
-rw-r--r--lldb/source/Core/ModuleList.cpp4
-rw-r--r--lldb/source/Expression/DWARFExpression.cpp16
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp2
-rw-r--r--lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp4
-rw-r--r--lldb/source/Symbol/Block.cpp71
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp4
-rw-r--r--lldb/source/Symbol/Variable.cpp3
-rw-r--r--lldb/source/Target/StackFrame.cpp113
-rw-r--r--lldb/source/Target/Thread.cpp12
-rw-r--r--lldb/source/Target/ThreadPlanStepInstruction.cpp4
-rw-r--r--lldb/source/Target/ThreadPlanStepOut.cpp3
-rw-r--r--lldb/source/Target/ThreadPlanStepUntil.cpp3
17 files changed, 123 insertions, 129 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 53307718143..b2d591d8507 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -121,12 +121,11 @@ SBFrame::GetFrameID () const
return UINT32_MAX;
}
-
lldb::addr_t
SBFrame::GetPC () const
{
if (m_opaque_sp)
- return m_opaque_sp->GetPC().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess());
+ return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess());
return LLDB_INVALID_ADDRESS;
}
@@ -161,7 +160,7 @@ SBFrame::GetPCAddress () const
{
SBAddress sb_addr;
if (m_opaque_sp)
- sb_addr.SetAddress (&m_opaque_sp->GetPC());
+ sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress());
return sb_addr;
}
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index a7169c5c8cf..604489804c6 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -148,7 +148,7 @@ CommandObjectArgs::Execute
return false;
}
- Module *thread_module = thread_cur_frame->GetPC ().GetModule ();
+ Module *thread_module = thread_cur_frame->GetFrameCodeAddress ().GetModule ();
if (!thread_module)
{
result.AppendError ("The PC has no associated module.");
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 4bf392c094f..0bc4bf3b73b 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -248,7 +248,7 @@ CommandObjectDisassemble::Execute
else if (sc.symbol && sc.symbol->GetAddressRangePtr())
range = *sc.symbol->GetAddressRangePtr();
else
- range.GetBaseAddress() = exe_ctx.frame->GetPC();
+ range.GetBaseAddress() = exe_ctx.frame->GetFrameCodeAddress();
}
else
{
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index 49c131a1361..22f6c06510d 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -311,7 +311,7 @@ Disassembler::Disassemble
}
else
{
- range.GetBaseAddress() = exe_ctx.frame->GetPC();
+ range.GetBaseAddress() = exe_ctx.frame->GetFrameCodeAddress();
}
if (range.GetBaseAddress().IsValid() && range.GetByteSize() == 0)
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 37357c373ca..1d7e75537b3 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -267,7 +267,7 @@ ModuleList::FindModules
}
ModuleSP
-ModuleList::FindModule (lldb_private::Module *module_ptr)
+ModuleList::FindModule (const Module *module_ptr)
{
ModuleSP module_sp;
@@ -450,7 +450,7 @@ GetSharedModuleList ()
}
const lldb::ModuleSP
-ModuleList::GetModuleSP (lldb_private::Module *module_ptr)
+ModuleList::GetModuleSP (const Module *module_ptr)
{
lldb::ModuleSP module_sp;
if (module_ptr)
diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp
index 1f63b95d259..77e1581ceaf 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -688,13 +688,18 @@ ReadRegisterValueAsScalar
bool
DWARFExpression::LocationListContainsLoadAddress (Process* process, const Address &addr) const
{
+ return LocationListContainsLoadAddress(process, addr.GetLoadAddress(process));
+}
+
+bool
+DWARFExpression::LocationListContainsLoadAddress (Process* process, addr_t load_addr) const
+{
+ if (load_addr == LLDB_INVALID_ADDRESS)
+ return false;
+
if (IsLocationList())
{
uint32_t offset = 0;
- const addr_t load_addr = addr.GetLoadAddress(process);
-
- if (load_addr == LLDB_INVALID_ADDRESS)
- return false;
addr_t loc_list_base_addr = m_loclist_base_addr.GetLoadAddress(process);
@@ -722,6 +727,7 @@ DWARFExpression::LocationListContainsLoadAddress (Process* process, const Addres
}
return false;
}
+
bool
DWARFExpression::Evaluate
(
@@ -749,7 +755,7 @@ DWARFExpression::Evaluate
if (IsLocationList())
{
uint32_t offset = 0;
- addr_t pc = exe_ctx->frame->GetPC().GetLoadAddress(exe_ctx->process);
+ addr_t pc = exe_ctx->frame->GetRegisterContext()->GetPC();
if (pc == LLDB_INVALID_ADDRESS)
{
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp
index d3ba88b45bd..0e78cdc4d6d 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp
@@ -210,7 +210,7 @@ MachThreadContext_i386::GetStackFrameData(StackFrame *first_frame, std::vector<s
if (addr_range_ptr)
{
- if (first_frame->GetPC() == addr_range_ptr->GetBaseAddress())
+ if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress())
{
// We are at the first instruction, so we can recover the
// previous PC by dereferencing the SP
diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp
index 2d11d5bd14a..0dcbe746de4 100644
--- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp
@@ -221,7 +221,7 @@ MachThreadContext_x86_64::GetStackFrameData(StackFrame *first_frame, std::vector
if (addr_range_ptr)
{
- if (first_frame->GetPC() == addr_range_ptr->GetBaseAddress())
+ if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress())
{
// We are at the first instruction, so we can recover the
// previous PC by dereferencing the SP
diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
index 29bc89e63fa..4ef6338bb37 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp
@@ -130,7 +130,7 @@ UnwindMacOSXFrameBackchain::GetStackFrameData_i386 (StackFrame *first_frame)
if (addr_range_ptr)
{
- if (first_frame->GetPC() == addr_range_ptr->GetBaseAddress())
+ if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress())
{
// We are at the first instruction, so we can recover the
// previous PC by dereferencing the SP
@@ -218,7 +218,7 @@ UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64 (StackFrame *first_frame)
if (addr_range_ptr)
{
- if (first_frame->GetPC() == addr_range_ptr->GetBaseAddress())
+ if (first_frame->GetFrameCodeAddress() == addr_range_ptr->GetBaseAddress())
{
// We are at the first instruction, so we can recover the
// previous PC by dereferencing the SP
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)
{
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index db0bccb726e..ce65b91ad4f 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -131,10 +131,10 @@ SymbolContext::DumpStopContext
if (show_inlined_frames && block)
{
- InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
+ const InlineFunctionInfo *inline_info = block->InlinedFunctionInfo();
if (inline_info == NULL)
{
- Block *parent_inline_block = block->GetInlinedParent();
+ const Block *parent_inline_block = block->GetInlinedParent();
if (parent_inline_block)
inline_info = parent_inline_block->InlinedFunctionInfo();
}
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index dfd436e53c3..cb3d1c6cf15 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -14,6 +14,7 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Thread.h"
@@ -142,7 +143,7 @@ Variable::IsInScope (StackFrame *frame)
// It is a location list. We just need to tell if the location
// list contains the current address when converted to a load
// address
- return m_location.LocationListContainsLoadAddress (&frame->GetThread().GetProcess(), frame->GetPC());
+ return m_location.LocationListContainsLoadAddress (&frame->GetThread().GetProcess(), frame->GetRegisterContext()->GetPC());
}
else
{
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index 1f72c318f9c..178144ad84b 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -29,8 +29,8 @@ using namespace lldb_private;
// The first bits in the flags are reserved for the SymbolContext::Scope bits
// so we know if we have tried to look up information in our internal symbol
// context (m_sc) already.
-#define RESOLVED_PC_SO_ADDR (uint32_t(eSymbolContextEverything + 1))
-#define RESOLVED_FRAME_ID (RESOLVED_PC_SO_ADDR << 1)
+#define RESOLVED_FRAME_ADDR (uint32_t(eSymbolContextEverything + 1))
+#define RESOLVED_FRAME_ID (RESOLVED_FRAME_ADDR << 1)
#define GOT_FRAME_BASE (RESOLVED_FRAME_ID << 1)
#define FRAME_IS_OBSOLETE (GOT_FRAME_BASE << 1)
#define RESOLVED_VARIABLES (FRAME_IS_OBSOLETE << 1)
@@ -169,53 +169,29 @@ StackFrame::GetStackID()
// Resolve our PC to section offset if we haven't alreday done so
// and if we don't have a module. The resolved address section will
// contain the module to which it belongs.
- if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_PC_SO_ADDR))
- GetPC();
+ if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_ADDR))
+ GetFrameCodeAddress();
- const uint32_t resolve_scope = eSymbolContextModule |
- eSymbolContextCompUnit |
- eSymbolContextFunction;
-
- if (m_sc.module_sp)
+ if (GetSymbolContext (eSymbolContextFunction).function)
{
- if (m_sc.module_sp->ResolveSymbolContextForAddress (GetPC(), resolve_scope, m_sc) & eSymbolContextFunction)
- {
- assert (m_sc.function);
- m_id.SetStartAddress(m_sc.function->GetAddressRange().GetBaseAddress());
- }
- else if (m_sc.module_sp->ResolveSymbolContextForAddress (GetPC(), resolve_scope, m_sc) & eSymbolContextSymbol)
- {
- assert (m_sc.symbol);
- AddressRange *symbol_range_ptr = m_sc.symbol->GetAddressRangePtr();
- if (symbol_range_ptr)
- m_id.SetStartAddress(symbol_range_ptr->GetBaseAddress());
- }
+ m_id.SetStartAddress (m_sc.function->GetAddressRange().GetBaseAddress());
+ }
+ else if (GetSymbolContext (eSymbolContextSymbol).symbol)
+ {
+ AddressRange *symbol_range_ptr = m_sc.symbol->GetAddressRangePtr();
+ if (symbol_range_ptr)
+ m_id.SetStartAddress(symbol_range_ptr->GetBaseAddress());
}
-// else if (m_sc.target != NULL)
-// {
-// if (m_sc.target->GetImages().ResolveSymbolContextForAddress (GetPC(), resolve_scope, m_sc) & eSymbolContextFunction)
-// {
-// assert (m_sc.function);
-// m_id.GetAddressRange() = m_sc.function->GetAddressRange();
-// }
-// else if (m_sc.target->GetImages().ResolveSymbolContextForAddress (GetPC(), resolve_scope, m_sc) & eSymbolContextSymbol)
-// {
-// assert (m_sc.symbol);
-// AddressRange *symbol_range_ptr = m_sc.symbol->GetAddressRange();
-// if (symbol_range_ptr)
-// m_id.GetAddressRange() = *symbol_range_ptr;
-// }
-// }
}
return m_id;
}
Address&
-StackFrame::GetPC()
+StackFrame::GetFrameCodeAddress()
{
- if (m_flags.IsClear(RESOLVED_PC_SO_ADDR) && !m_pc.IsSectionOffset())
+ if (m_flags.IsClear(RESOLVED_FRAME_ADDR) && !m_pc.IsSectionOffset())
{
- m_flags.Set (RESOLVED_PC_SO_ADDR);
+ m_flags.Set (RESOLVED_FRAME_ADDR);
// Resolve the PC into a temporary address because if ResolveLoadAddress
// fails to resolve the address, it will clear the address object...
@@ -279,20 +255,19 @@ const SymbolContext&
StackFrame::GetSymbolContext (uint32_t resolve_scope)
{
// Copy our internal symbol context into "sc".
-
if ((m_flags.GetAllFlagBits() & resolve_scope) != resolve_scope)
{
// Resolve our PC to section offset if we haven't alreday done so
// and if we don't have a module. The resolved address section will
// contain the module to which it belongs
- if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_PC_SO_ADDR))
- GetPC();
+ if (!m_sc.module_sp && m_flags.IsClear(RESOLVED_FRAME_ADDR))
+ GetFrameCodeAddress();
// If this is not frame zero, then we need to subtract 1 from the PC
// value when doing address lookups since the PC will be on the
// instruction following the function call instruction...
- Address lookup_addr(GetPC());
+ Address lookup_addr(GetFrameCodeAddress());
if (m_frame_index > 0 && lookup_addr.IsValid())
{
addr_t offset = lookup_addr.GetOffset();
@@ -300,6 +275,8 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
lookup_addr.SetOffset(offset - 1);
}
+
+ uint32_t resolved = 0;
if (m_sc.module_sp)
{
// We have something in our stack frame symbol context, lets check
@@ -313,7 +290,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if (m_flags.IsClear (eSymbolContextCompUnit))
{
if (m_sc.comp_unit)
- m_flags.Set (eSymbolContextCompUnit);
+ resolved |= eSymbolContextCompUnit;
else
actual_resolve_scope |= eSymbolContextCompUnit;
}
@@ -324,7 +301,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if (m_flags.IsClear (eSymbolContextFunction))
{
if (m_sc.function)
- m_flags.Set (eSymbolContextFunction);
+ resolved |= eSymbolContextFunction;
else
actual_resolve_scope |= eSymbolContextFunction;
}
@@ -335,7 +312,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if (m_flags.IsClear (eSymbolContextBlock))
{
if (m_sc.block)
- m_flags.Set (eSymbolContextBlock);
+ resolved |= eSymbolContextBlock;
else
actual_resolve_scope |= eSymbolContextBlock;
}
@@ -346,7 +323,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if (m_flags.IsClear (eSymbolContextSymbol))
{
if (m_sc.symbol)
- m_flags.Set (eSymbolContextSymbol);
+ resolved |= eSymbolContextSymbol;
else
actual_resolve_scope |= eSymbolContextSymbol;
}
@@ -357,7 +334,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
if (m_flags.IsClear (eSymbolContextLineEntry))
{
if (m_sc.line_entry.IsValid())
- m_flags.Set (eSymbolContextLineEntry);
+ resolved |= eSymbolContextLineEntry;
else
actual_resolve_scope |= eSymbolContextLineEntry;
}
@@ -371,15 +348,21 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
// already found in "m_sc"
SymbolContext sc;
// Set flags that indicate what we have tried to resolve
- const uint32_t resolved = m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, actual_resolve_scope, sc);
+ resolved |= m_sc.module_sp->ResolveSymbolContextForAddress (lookup_addr, actual_resolve_scope, sc);
// Only replace what we didn't already have as we may have
// information for an inlined function scope that won't match
// what a standard lookup by address would match
- if (resolved & eSymbolContextCompUnit) m_sc.comp_unit = sc.comp_unit;
- if (resolved & eSymbolContextFunction) m_sc.function = sc.function;
- if (resolved & eSymbolContextBlock) m_sc.block = sc.block;
- if (resolved & eSymbolContextSymbol) m_sc.symbol = sc.symbol;
- if (resolved & eSymbolContextLineEntry) m_sc.line_entry = sc.line_entry;
+ if ((resolved & eSymbolContextCompUnit) && m_sc.comp_unit == NULL)
+ m_sc.comp_unit = sc.comp_unit;
+ if ((resolved & eSymbolContextFunction) && m_sc.function == NULL)
+ m_sc.function = sc.function;
+ if ((resolved & eSymbolContextBlock) && m_sc.block == NULL)
+ m_sc.block = sc.block;
+ if ((resolved & eSymbolContextSymbol) && m_sc.symbol == NULL)
+ m_sc.symbol = sc.symbol;
+ if ((resolved & eSymbolContextLineEntry) && !m_sc.line_entry.IsValid())
+ m_sc.line_entry = sc.line_entry;
+
}
}
else
@@ -387,16 +370,23 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
// If we don't have a module, then we can't have the compile unit,
// function, block, line entry or symbol, so we can safely call
// ResolveSymbolContextForAddress with our symbol context member m_sc.
- m_thread.GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
+ resolved |= m_thread.GetProcess().GetTarget().GetImages().ResolveSymbolContextForAddress (lookup_addr, resolve_scope, m_sc);
}
// If the target was requested add that:
if (m_sc.target_sp.get() == NULL)
+ {
m_sc.target_sp = CalculateProcess()->GetTarget().GetSP();
+ if (m_sc.target_sp)
+ resolved |= eSymbolContextTarget;
+ }
// Update our internal flags so we remember what we have tried to locate so
// we don't have to keep trying when more calls to this function are made.
- m_flags.Set(resolve_scope);
+ // We might have dug up more information that was requested (for example
+ // if we were asked to only get the block, we will have gotten the
+ // compile unit, and function) so set any additional bits that we resolved
+ m_flags.Set (resolve_scope | resolved);
}
// Return the symbol context with everything that was possible to resolve
@@ -412,8 +402,7 @@ StackFrame::GetVariableList ()
{
m_flags.Set(RESOLVED_VARIABLES);
- GetSymbolContext(eSymbolContextFunction);
- if (m_sc.function)
+ if (GetSymbolContext (eSymbolContextFunction).function)
{
bool get_child_variables = true;
bool can_create = true;
@@ -474,7 +463,7 @@ StackFrame::GetRegisterContext ()
bool
StackFrame::HasDebugInformation ()
{
- GetSymbolContext(eSymbolContextLineEntry);
+ GetSymbolContext (eSymbolContextLineEntry);
return m_sc.line_entry.IsValid();
}
@@ -525,12 +514,12 @@ StackFrame::Dump (Stream *strm, bool show_frame_index)
if (show_frame_index)
strm->Printf("frame #%u: ", m_frame_index);
- strm->Printf("pc = 0x%0*llx", m_thread.GetProcess().GetAddressByteSize() * 2, GetRegisterContext()->GetPC());
- SymbolContext sc (GetSymbolContext(eSymbolContextEverything));
+ strm->Printf("0x%0*llx", m_thread.GetProcess().GetAddressByteSize() * 2, GetFrameCodeAddress().GetLoadAddress(&m_thread.GetProcess()));
+ GetSymbolContext(eSymbolContextEverything);
strm->PutCString(", where = ");
// TODO: need to get the
const bool show_module = true;
const bool show_inline = true;
- sc.DumpStopContext(strm, &m_thread.GetProcess(), GetPC(), show_module, show_inline);
+ m_sc.DumpStopContext(strm, &m_thread.GetProcess(), GetFrameCodeAddress(), show_module, show_inline);
}
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 0a6cc828329..3ab789fa00a 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -926,18 +926,21 @@ Thread::GetStackFrameAtIndex (uint32_t idx)
Block *parent_block = m_inlined_frame_info[idx].block->GetParent();
parent_block->CalculateSymbolContext(&inline_sc);
}
+
+ Address backed_up_pc (previous_frame_sp->GetFrameCodeAddress());
+ backed_up_pc.SetOffset(backed_up_pc.GetOffset()-1);
+ AddressRange range;
+ m_inlined_frame_info[idx].block->GetRangeContainingAddress (backed_up_pc, range);
- InlineFunctionInfo* inline_info = m_inlined_frame_info[idx].block->InlinedFunctionInfo();
+ const InlineFunctionInfo* inline_info = m_inlined_frame_info[idx].block->InlinedFunctionInfo();
assert (inline_info);
- inline_sc.line_entry.range.GetBaseAddress() = previous_frame_sp->GetPC();
+ inline_sc.line_entry.range.GetBaseAddress() = previous_frame_sp->GetFrameCodeAddress();
inline_sc.line_entry.file = inline_info->GetCallSite().GetFile();
inline_sc.line_entry.line = inline_info->GetCallSite().GetLine();
inline_sc.line_entry.column = inline_info->GetCallSite().GetColumn();
StackFrameSP concrete_frame_sp (m_concrete_frames.GetFrameAtIndex (m_inlined_frame_info[idx].concrete_frame_index));
assert (previous_frame_sp.get());
- AddressRange range;
- m_inlined_frame_info[idx].block->GetRangeContainingAddress (previous_frame_sp->GetPC(), range);
frame_sp.reset (new StackFrame (idx,
m_inlined_frame_info[idx].concrete_frame_index,
@@ -949,7 +952,6 @@ Thread::GetStackFrameAtIndex (uint32_t idx)
&inline_sc)); // The symbol context for this inline frame
}
-
}
else
{
diff --git a/lldb/source/Target/ThreadPlanStepInstruction.cpp b/lldb/source/Target/ThreadPlanStepInstruction.cpp
index b469566b2c2..cef481ef0fd 100644
--- a/lldb/source/Target/ThreadPlanStepInstruction.cpp
+++ b/lldb/source/Target/ThreadPlanStepInstruction.cpp
@@ -122,10 +122,10 @@ ThreadPlanStepInstruction::ShouldStop (Event *event_ptr)
{
StreamString s;
s.PutCString ("Stepped in to: ");
- addr_t stop_addr = m_thread.GetStackFrameAtIndex(0)->GetPC().GetLoadAddress(&m_thread.GetProcess());
+ addr_t stop_addr = m_thread.GetStackFrameAtIndex(0)->GetRegisterContext()->GetPC();
s.Address (stop_addr, m_thread.GetProcess().GetAddressByteSize());
s.PutCString (" stepping out to: ");
- addr_t return_addr = return_frame->GetPC().GetLoadAddress(&m_thread.GetProcess());
+ addr_t return_addr = return_frame->GetRegisterContext()->GetPC();
s.Address (return_addr, m_thread.GetProcess().GetAddressByteSize());
log->Printf("%s.", s.GetData());
}
diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp
index fd9f8faf99d..5d29134b859 100644
--- a/lldb/source/Target/ThreadPlanStepOut.cpp
+++ b/lldb/source/Target/ThreadPlanStepOut.cpp
@@ -53,7 +53,8 @@ ThreadPlanStepOut::ThreadPlanStepOut
StackFrame *return_frame = m_thread.GetStackFrameAtIndex(1).get();
if (return_frame)
{
- m_return_addr = return_frame->GetPC().GetLoadAddress(&m_thread.GetProcess());
+ // TODO: check for inlined frames and do the right thing...
+ m_return_addr = return_frame->GetRegisterContext()->GetPC();
Breakpoint *return_bp = m_thread.GetProcess().GetTarget().CreateBreakpoint (m_return_addr, true).get();
if (return_bp != NULL)
{
diff --git a/lldb/source/Target/ThreadPlanStepUntil.cpp b/lldb/source/Target/ThreadPlanStepUntil.cpp
index 8c0748bce33..f528cb0aae1 100644
--- a/lldb/source/Target/ThreadPlanStepUntil.cpp
+++ b/lldb/source/Target/ThreadPlanStepUntil.cpp
@@ -63,7 +63,8 @@ ThreadPlanStepUntil::ThreadPlanStepUntil
// FIXME - can we do this more securely if we know first_insn?
StackFrame *return_frame = m_thread.GetStackFrameAtIndex(1).get();
- m_return_addr = return_frame->GetPC().GetLoadAddress(&m_thread.GetProcess());
+ // TODO: add inline functionality
+ m_return_addr = return_frame->GetRegisterContext()->GetPC();
Breakpoint *return_bp = target.CreateBreakpoint (m_return_addr, true).get();
if (return_bp != NULL)
{
OpenPOWER on IntegriCloud