Author: jingham Date: Wed Apr 5 20:33:38 2017 New Revision: 299609 URL: http://llvm.org/viewvc/llvm-project?rev=299609&view=rev Log: getAsInteger is not a equivalent replacement for strtol
work around that fact for CommandObjectMemoryWrite. <rdar://problem/31457148> Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=299609&r1=299608&r2=299609&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Apr 5 20:33:38 2017 @@ -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) { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits