summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-01-06 22:35:55 +0000
committerGreg Clayton <gclayton@apple.com>2011-01-06 22:35:55 +0000
commit43b4e213cb9bf939c1fd59574f2f429911b1d469 (patch)
treeb6e378d7c514625257e808db48fcacfc92b5feca
parentc07c98f8537509485b8015301a8da3db6072af9c (diff)
downloadbcm5719-llvm-43b4e213cb9bf939c1fd59574f2f429911b1d469.tar.gz
bcm5719-llvm-43b4e213cb9bf939c1fd59574f2f429911b1d469.zip
First try at patching linux for the recent RegisterContext patch. Can someone
try and build this and let me know how it goes? llvm-svn: 122981
-rw-r--r--lldb/source/Plugins/Process/Linux/LinuxThread.cpp52
-rw-r--r--lldb/source/Plugins/Process/Linux/LinuxThread.h22
-rw-r--r--lldb/source/Plugins/Process/Linux/RegisterContextLinux.h4
-rw-r--r--lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp4
-rw-r--r--lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h4
5 files changed, 52 insertions, 34 deletions
diff --git a/lldb/source/Plugins/Process/Linux/LinuxThread.cpp b/lldb/source/Plugins/Process/Linux/LinuxThread.cpp
index c4c8bf56ab7..725cc5a9485 100644
--- a/lldb/source/Plugins/Process/Linux/LinuxThread.cpp
+++ b/lldb/source/Plugins/Process/Linux/LinuxThread.cpp
@@ -26,21 +26,8 @@ using namespace lldb_private;
LinuxThread::LinuxThread(Process &process, lldb::tid_t tid)
: Thread(process, tid),
m_frame_ap(0),
- m_register_ap(0),
m_note(eNone)
{
- ArchSpec arch = process.GetTarget().GetArchitecture();
-
- switch (arch.GetGenericCPUType())
- {
- default:
- assert(false && "CPU type not supported!");
- break;
-
- case ArchSpec::eCPU_x86_64:
- m_register_ap.reset(new RegisterContextLinux_x86_64(*this, NULL));
- break;
- }
}
ProcessMonitor &
@@ -61,10 +48,25 @@ LinuxThread::GetInfo()
return NULL;
}
-RegisterContextLinux *
+lldb::RegisterContextSP
LinuxThread::GetRegisterContext()
{
- return m_register_ap.get();
+ if (!m_reg_context_sp)
+ {
+ ArchSpec arch = process.GetTarget().GetArchitecture();
+
+ switch (arch.GetGenericCPUType())
+ {
+ default:
+ assert(false && "CPU type not supported!");
+ break;
+
+ case ArchSpec::eCPU_x86_64:
+ m_reg_context_sp.reset(new RegisterContextLinux_x86_64(*this, 0));
+ break;
+ }
+ }
+ return m_reg_context_sp
}
bool
@@ -79,10 +81,19 @@ LinuxThread::RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint)
return false;
}
-RegisterContextLinux *
-LinuxThread::CreateRegisterContextForFrame(lldb_private::StackFrame *frame)
+lldb::RegisterContextSP
+LinuxThread::CreateRegisterContextForFrame (lldb_private::StackFrame *frame)
{
- return new RegisterContextLinux_x86_64(*this, frame);
+ lldb::RegisterContextSP reg_ctx_sp;
+ uint32_t concrete_frame_idx = 0;
+ if (frame)
+ concrete_frame_idx = frame->GetConcreteFrameIndex();
+
+ if (concrete_frame_idx == 0)
+ reg_ctx_sp = GetRegisterContext();
+ else
+ reg_ctx_sp.reset (new RegisterContextLinux_x86_64(*this, frame->GetConcreteFrameIndex()));
+ return reg_ctx_sp;
}
lldb::StopInfoSP
@@ -159,14 +170,13 @@ LinuxThread::BreakNotify()
{
bool status;
- status = GetRegisterContext()->UpdateAfterBreakpoint();
+ status = GetRegisterContextLinux()->UpdateAfterBreakpoint();
assert(status && "Breakpoint update failed!");
// With our register state restored, resolve the breakpoint object
// corresponding to our current PC.
lldb::addr_t pc = GetRegisterContext()->GetPC();
- lldb::BreakpointSiteSP bp_site =
- GetProcess().GetBreakpointSiteList().FindByAddress(pc);
+ lldb::BreakpointSiteSP bp_site(GetProcess().GetBreakpointSiteList().FindByAddress(pc));
assert(bp_site && bp_site->ValidForThisThread(this));
m_note = eBreak;
diff --git a/lldb/source/Plugins/Process/Linux/LinuxThread.h b/lldb/source/Plugins/Process/Linux/LinuxThread.h
index 0e7f89df972..a87e5ca76d8 100644
--- a/lldb/source/Plugins/Process/Linux/LinuxThread.h
+++ b/lldb/source/Plugins/Process/Linux/LinuxThread.h
@@ -16,9 +16,9 @@
// Other libraries and framework includes
#include "lldb/Target/Thread.h"
-#include "RegisterContextLinux.h"
class ProcessMonitor;
+class RegisterContextLinux;
//------------------------------------------------------------------------------
// @class LinuxThread
@@ -38,17 +38,17 @@ public:
const char *
GetInfo();
- RegisterContextLinux *
+ virtual lldb::RegisterContextSP
GetRegisterContext();
- bool
+ virtual bool
SaveFrameZeroState(RegisterCheckpoint &checkpoint);
- bool
+ virtual bool
RestoreSaveFrameZero(const RegisterCheckpoint &checkpoint);
- RegisterContextLinux *
- CreateRegisterContextForFrame(lldb_private::StackFrame *frame);
+ virtual lldb::RegisterContextSP
+ CreateRegisterContextForFrame (StackFrame *frame);
//--------------------------------------------------------------------------
// These methods form a specialized interface to linux threads.
@@ -60,8 +60,16 @@ public:
void ExitNotify();
private:
+
+ RegisterContextLinux *
+ GetRegisterContextLinux ()
+ {
+ if (!m_reg_context_sp)
+ GetRegisterContext();
+ return (RegisterContextLinux *)m_reg_context_sp.get()
+ }
+
std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
- std::auto_ptr<RegisterContextLinux> m_register_ap;
lldb::BreakpointSiteSP m_breakpoint;
diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/RegisterContextLinux.h
index 4badd4bb28b..519c06a4aee 100644
--- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux.h
+++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux.h
@@ -24,8 +24,8 @@ class RegisterContextLinux
{
public:
RegisterContextLinux(lldb_private::Thread &thread,
- lldb_private::StackFrame *frame)
- : RegisterContext(thread, frame) { }
+ uint32_t concrete_frame_idx)
+ : RegisterContext(thread, concrete_frame_idx) { }
/// Updates the register state of the associated thread after hitting a
/// breakpoint (if that make sense for the architecture). Default
diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
index 4c78a2537ba..10d9947c1ab 100644
--- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.cpp
@@ -402,8 +402,8 @@ static unsigned GetRegOffset(unsigned reg)
}
RegisterContextLinux_x86_64::RegisterContextLinux_x86_64(Thread &thread,
- StackFrame *frame)
- : RegisterContextLinux(thread, frame)
+ uint32_t concrete_frame_idx)
+ : RegisterContextLinux(thread, concrete_frame_idx)
{
}
diff --git a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
index b61de407da9..9bba38a1d80 100644
--- a/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
+++ b/lldb/source/Plugins/Process/Linux/RegisterContextLinux_x86_64.h
@@ -18,8 +18,8 @@ class RegisterContextLinux_x86_64
: public RegisterContextLinux
{
public:
- RegisterContextLinux_x86_64(lldb_private::Thread &thread,
- lldb_private::StackFrame *frame);
+ RegisterContextLinux_x86_64 (lldb_private::Thread &thread,
+ uint32_t concrete_frame_idx);
~RegisterContextLinux_x86_64();
OpenPOWER on IntegriCloud