summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectRegister.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-03-26 01:27:04 +0000
committerEnrico Granata <egranata@apple.com>2013-03-26 01:27:04 +0000
commit2f59302ce804c0886ccc4dcdd5e51789981d4bc3 (patch)
tree80ef4ff971b10d45c07a130629a6754af6291efa /lldb/source/Commands/CommandObjectRegister.cpp
parent333ec6ceb7d60d8a03fc2f3ae34f8a2486c82e30 (diff)
downloadbcm5719-llvm-2f59302ce804c0886ccc4dcdd5e51789981d4bc3.tar.gz
bcm5719-llvm-2f59302ce804c0886ccc4dcdd5e51789981d4bc3.zip
<rdar://problem/13221060>
Make register read and write accept $<regname> as valid. This allows: (lldb) reg read rbx rbx = 0x0000000000000000 (lldb) reg read $rbx rbx = 0x0000000000000000 (lldb) reg write $rbx 1 (lldb) reg read $rbx rbx = 0x0000000000000001 to function correctly It is not done at the RegisterContext level because we should keep the internal API clean of this user-friendly behavior and name registers appropriately. If this ends up being needed in more places we can reconsider. llvm-svn: 177961
Diffstat (limited to 'lldb/source/Commands/CommandObjectRegister.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectRegister.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/Commands/CommandObjectRegister.cpp b/lldb/source/Commands/CommandObjectRegister.cpp
index 79a76fbaed9..0a9115ec015 100644
--- a/lldb/source/Commands/CommandObjectRegister.cpp
+++ b/lldb/source/Commands/CommandObjectRegister.cpp
@@ -228,6 +228,12 @@ protected:
const char *arg_cstr;
for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != NULL; ++arg_idx)
{
+ // in most LLDB commands we accept $rbx as the name for register RBX - and here we would
+ // reject it and non-existant. we should be more consistent towards the user and allow them
+ // to say reg read $rbx - internally, however, we should be strict and not allow ourselves
+ // to call our registers $rbx in our own API
+ if (*arg_cstr == '$')
+ arg_cstr = arg_cstr+1;
reg_info = reg_ctx->GetRegisterInfoByName(arg_cstr);
if (reg_info)
@@ -410,6 +416,15 @@ protected:
{
const char *reg_name = command.GetArgumentAtIndex(0);
const char *value_str = command.GetArgumentAtIndex(1);
+
+
+ // in most LLDB commands we accept $rbx as the name for register RBX - and here we would
+ // reject it and non-existant. we should be more consistent towards the user and allow them
+ // to say reg write $rbx - internally, however, we should be strict and not allow ourselves
+ // to call our registers $rbx in our own API
+ if (reg_name && *reg_name == '$')
+ reg_name = reg_name+1;
+
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name);
if (reg_info)
OpenPOWER on IntegriCloud