forked from OSchip/llvm-project
Add a new ABI plugin method which specifies whether the architecture
must push something on the stack for a function call or not. In x86, the stack pointer is decremented when the caller's pc is saved on the stack. In arm, the stack pointer and frame pointer don't necessarily have to change for a function call, although most functions need to use some stack space during their execution. Use this information in the RegisterContextLLDB to detect invalid unwind scenarios more accurately. <rdar://problem/12348574> llvm-svn: 166005
This commit is contained in:
parent
c74b600afb
commit
af2521fd74
|
|
@ -46,7 +46,6 @@ public:
|
|||
GetArgumentValues (Thread &thread,
|
||||
ValueList &values) const = 0;
|
||||
|
||||
public:
|
||||
lldb::ValueObjectSP
|
||||
GetReturnValueObject (Thread &thread,
|
||||
ClangASTType &type,
|
||||
|
|
@ -72,12 +71,22 @@ public:
|
|||
virtual bool
|
||||
RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
|
||||
|
||||
// Should return true if your ABI uses frames when doing stack backtraces. This
|
||||
// means a frame pointer is used that points to the previous stack frame in some
|
||||
// way or another.
|
||||
virtual bool
|
||||
StackUsesFrames () = 0;
|
||||
|
||||
// Should take a look at a call frame address (CFA) which is just the stack
|
||||
// pointer value upon entry to a function. ABIs usually impose alignment
|
||||
// restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
|
||||
// This function should return true if "cfa" is valid call frame address for
|
||||
// the ABI, and false otherwise. This is used by the generic stack frame unwinding
|
||||
// code to help determine when a stack ends.
|
||||
virtual bool
|
||||
CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
|
||||
|
||||
// Validates a possible PC value and returns true if an opcode can be at "pc".
|
||||
virtual bool
|
||||
CodeAddressIsValid (lldb::addr_t pc) = 0;
|
||||
|
||||
|
|
@ -93,7 +102,15 @@ public:
|
|||
virtual const RegisterInfo *
|
||||
GetRegisterInfoArray (uint32_t &count) = 0;
|
||||
|
||||
|
||||
// Some architectures (e.g. x86) will push the return address on the stack and decrement
|
||||
// the stack pointer when making a function call. This means that every stack frame will
|
||||
// have a unique CFA.
|
||||
// Other architectures (e.g. arm) pass the return address in a register so it is possible
|
||||
// to have a frame on a backtrace that does not push anything on the stack or change the
|
||||
// CFA.
|
||||
virtual bool
|
||||
FunctionCallsChangeCFA () = 0;
|
||||
|
||||
|
||||
bool
|
||||
GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ public:
|
|||
return pc & ~(lldb::addr_t)1;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
FunctionCallsChangeCFA ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual const lldb_private::RegisterInfo *
|
||||
GetRegisterInfoArray (uint32_t &count);
|
||||
|
||||
|
|
|
|||
|
|
@ -93,7 +93,13 @@ public:
|
|||
// Just make sure the address is a valid 32 bit address.
|
||||
return pc <= UINT32_MAX;
|
||||
}
|
||||
|
||||
|
||||
virtual bool
|
||||
FunctionCallsChangeCFA ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const lldb_private::RegisterInfo *
|
||||
GetRegisterInfoArray (uint32_t &count);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,13 @@ public:
|
|||
// aren't fixed width...
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
virtual bool
|
||||
FunctionCallsChangeCFA ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual const lldb_private::RegisterInfo *
|
||||
GetRegisterInfoArray (uint32_t &count);
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ RegisterContextLLDB::InitializeNonZerothFrame()
|
|||
repeating_frames = true;
|
||||
}
|
||||
}
|
||||
if (repeating_frames)
|
||||
if (repeating_frames && abi->FunctionCallsChangeCFA())
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue