summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBFrame.h3
-rw-r--r--lldb/scripts/Python/interface/SBFrame.i3
-rw-r--r--lldb/source/API/SBFrame.cpp58
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp1
4 files changed, 65 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h
index f8e86beb01f..4ae38c13bed 100644
--- a/lldb/include/lldb/API/SBFrame.h
+++ b/lldb/include/lldb/API/SBFrame.h
@@ -159,6 +159,9 @@ public:
lldb::SBValueList
GetRegisters ();
+ lldb::SBValue
+ FindRegister (const char *name);
+
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
diff --git a/lldb/scripts/Python/interface/SBFrame.i b/lldb/scripts/Python/interface/SBFrame.i
index 1735dd99472..8f36cec97a7 100644
--- a/lldb/scripts/Python/interface/SBFrame.i
+++ b/lldb/scripts/Python/interface/SBFrame.i
@@ -211,6 +211,9 @@ public:
lldb::SBValue
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
+ lldb::SBValue
+ FindRegister (const char *name);
+
%feature("docstring", "
/// Get a lldb.SBValue for a variable path.
///
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 282206066f7..409603a3b4e 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -1214,6 +1214,64 @@ SBFrame::GetRegisters ()
return value_list;
}
+SBValue
+SBFrame::FindRegister (const char *name)
+{
+ Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ SBValue result;
+ ValueObjectSP value_sp;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ StackFrame *frame = NULL;
+ Target *target = exe_ctx.GetTargetPtr();
+ Process *process = exe_ctx.GetProcessPtr();
+ if (target && process)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process->GetRunLock()))
+ {
+ frame = exe_ctx.GetFramePtr();
+ if (frame)
+ {
+ RegisterContextSP reg_ctx (frame->GetRegisterContext());
+ if (reg_ctx)
+ {
+ const uint32_t num_regs = reg_ctx->GetRegisterCount();
+ for (uint32_t reg_idx = 0; reg_idx < num_regs; ++reg_idx)
+ {
+ const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx);
+ if (reg_info &&
+ ((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
+ (reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
+ {
+ value_sp = ValueObjectRegister::Create (frame, reg_ctx, reg_idx);
+ result.SetSP (value_sp);
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBFrame::GetRegisterByName () => error: could not reconstruct frame object for this SBFrame.");
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBFrame::GetRegisterByName () => error: process is running");
+ }
+ }
+
+ if (log)
+ log->Printf ("SBFrame(%p)::GetRegisterByName () => SBValue(%p)", frame, value_sp.get());
+
+ return result;
+}
+
bool
SBFrame::GetDescription (SBStream &description)
{
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index 330a81812e0..a904d8b649c 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -1187,6 +1187,7 @@ ABISysV_x86_64::RegisterIsVolatile (const RegisterInfo *reg_info)
// "System V Application Binary Interface"
// "AMD64 Architecture Processor Supplement"
// (or "x86-64(tm) Architecture Processor Supplement" in earlier revisions)
+// (this doc is also commonly referred to as the x86-64/AMD64 psABI)
// Edited by Michael Matz, Jan Hubicka, Andreas Jaeger, and Mark Mitchell
// current version is 0.99.6 released 2012-07-02 at http://refspecs.linuxfoundation.org/elf/x86-64-abi-0.99.pdf
OpenPOWER on IntegriCloud