summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2017-04-06 01:33:38 +0000
committerJim Ingham <jingham@apple.com>2017-04-06 01:33:38 +0000
commitbef72b77fada7d71940277aadd58b6e22f3168a9 (patch)
tree6e3e6bcbf661645ba64186f7621c585fe03a40b0 /lldb/source/Commands/CommandObjectMemory.cpp
parent90dce06f24e7a1587ffe15cd77ce64c508dc320a (diff)
downloadbcm5719-llvm-bef72b77fada7d71940277aadd58b6e22f3168a9.tar.gz
bcm5719-llvm-bef72b77fada7d71940277aadd58b6e22f3168a9.zip
getAsInteger is not a equivalent replacement for strtol
work around that fact for CommandObjectMemoryWrite. <rdar://problem/31457148> llvm-svn: 299609
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 34ae8dc9138..1679614fe3f 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1443,8 +1443,16 @@ protected:
case eFormatHex:
case eFormatHexUppercase:
case eFormatPointer:
+ {
// Decode hex bytes
- if (entry.ref.getAsInteger(16, uval64)) {
+ // Be careful, getAsInteger with a radix of 16 rejects "0xab" so we
+ // have to special case that:
+ bool success = false;
+ if (entry.ref.startswith("0x"))
+ success = !entry.ref.getAsInteger(0, uval64);
+ if (!success)
+ success = !entry.ref.getAsInteger(16, uval64);
+ if (!success) {
result.AppendErrorWithFormat(
"'%s' is not a valid hex string value.\n", entry.c_str());
result.SetStatus(eReturnStatusFailed);
@@ -1459,7 +1467,7 @@ protected:
}
buffer.PutMaxHex64(uval64, item_byte_size);
break;
-
+ }
case eFormatBoolean:
uval64 = Args::StringToBoolean(entry.ref, false, &success);
if (!success) {
OpenPOWER on IntegriCloud