[Lldb-commits] [lldb] r246958 - Use eAddressClassCode for address lookup for opcodes for stack frames
Tamas Berghammer via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 7 02:58:10 PDT 2015
Author: tberghammer
Date: Mon Sep 7 04:58:09 2015
New Revision: 246958
URL: http://llvm.org/viewvc/llvm-project?rev=246958&view=rev
Log:
Use eAddressClassCode for address lookup for opcodes for stack frames
It is required because of the following edge case on arm:
bx <addr> Non-tail call in a no return function
[data-pool] Marked with $d mapping symbol
The return address of the function call will point to the data pool but
we have to treat it as code so the StackFrame can calculate the symbols
correctly.
Differential revision: http://reviews.llvm.org/D12556
Modified:
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/Core/Address.cpp
lldb/trunk/source/Target/StackFrame.cpp
lldb/trunk/source/Target/StackFrameList.cpp
Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=246958&r1=246957&r2=246958&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Mon Sep 7 04:58:09 2015
@@ -326,7 +326,8 @@ public:
/// not loaded.
//------------------------------------------------------------------
lldb::addr_t
- GetOpcodeLoadAddress (Target *target) const;
+ GetOpcodeLoadAddress (Target *target,
+ lldb::AddressClass addr_class = lldb::eAddressClassInvalid) const;
//------------------------------------------------------------------
/// Get the section relative offset value.
@@ -425,7 +426,9 @@ public:
SetLoadAddress (lldb::addr_t load_addr, Target *target);
bool
- SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);
+ SetOpcodeLoadAddress (lldb::addr_t load_addr,
+ Target *target,
+ lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
bool
SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=246958&r1=246957&r2=246958&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Mon Sep 7 04:58:09 2015
@@ -484,7 +484,7 @@ SBFrame::GetPC () const
frame = exe_ctx.GetFramePtr();
if (frame)
{
- addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress (target);
+ addr = frame->GetFrameCodeAddress().GetOpcodeLoadAddress (target, eAddressClassCode);
}
else
{
Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=246958&r1=246957&r2=246958&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Mon Sep 7 04:58:09 2015
@@ -367,21 +367,29 @@ Address::SetCallableLoadAddress (lldb::a
}
addr_t
-Address::GetOpcodeLoadAddress (Target *target) const
+Address::GetOpcodeLoadAddress (Target *target, AddressClass addr_class) const
{
addr_t code_addr = GetLoadAddress (target);
if (code_addr != LLDB_INVALID_ADDRESS)
- code_addr = target->GetOpcodeLoadAddress (code_addr, GetAddressClass());
+ {
+ if (addr_class == eAddressClassInvalid)
+ addr_class = GetAddressClass();
+ code_addr = target->GetOpcodeLoadAddress (code_addr, addr_class);
+ }
return code_addr;
}
bool
-Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target)
+Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target, AddressClass addr_class)
{
if (SetLoadAddress (load_addr, target))
{
if (target)
- m_offset = target->GetOpcodeLoadAddress (m_offset, GetAddressClass());
+ {
+ if (addr_class == eAddressClassInvalid)
+ addr_class = GetAddressClass();
+ m_offset = target->GetOpcodeLoadAddress (m_offset, addr_class);
+ }
return true;
}
return false;
Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=246958&r1=246957&r2=246958&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Mon Sep 7 04:58:09 2015
@@ -259,7 +259,7 @@ StackFrame::GetFrameCodeAddress()
TargetSP target_sp (thread_sp->CalculateTarget());
if (target_sp)
{
- if (m_frame_code_addr.SetOpcodeLoadAddress (m_frame_code_addr.GetOffset(), target_sp.get()))
+ if (m_frame_code_addr.SetOpcodeLoadAddress (m_frame_code_addr.GetOffset(), target_sp.get(), eAddressClassCode))
{
ModuleSP module_sp (m_frame_code_addr.GetModule());
if (module_sp)
Modified: lldb/trunk/source/Target/StackFrameList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrameList.cpp?rev=246958&r1=246957&r2=246958&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrameList.cpp (original)
+++ lldb/trunk/source/Target/StackFrameList.cpp Mon Sep 7 04:58:09 2015
@@ -362,8 +362,8 @@ StackFrameList::GetFramesUpTo(uint32_t e
// adjustment it will point to an other section. In that case resolve the
// address again to the correct section plus offset form.
TargetSP target = m_thread.CalculateTarget();
- addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target.get());
- curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target.get());
+ addr_t load_addr = curr_frame_address.GetOpcodeLoadAddress(target.get(), eAddressClassCode);
+ curr_frame_address.SetOpcodeLoadAddress(load_addr - 1, target.get(), eAddressClassCode);
}
else
{
More information about the lldb-commits
mailing list