diff options
Diffstat (limited to 'source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | source/Commands/CommandObjectMemory.cpp | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/source/Commands/CommandObjectMemory.cpp b/source/Commands/CommandObjectMemory.cpp index 49ae923892772..1679614fe3f77 100644 --- a/source/Commands/CommandObjectMemory.cpp +++ b/source/Commands/CommandObjectMemory.cpp @@ -17,15 +17,13 @@ // Project includes #include "CommandObjectMemory.h" #include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h" -#include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/DataExtractor.h" #include "lldb/Core/Debugger.h" +#include "lldb/Core/DumpDataExtractor.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObjectMemory.h" #include "lldb/DataFormatters/ValueObjectPrinter.h" -#include "lldb/Host/StringConvert.h" +#include "lldb/Host/OptionParser.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/CommandReturnObject.h" @@ -42,6 +40,9 @@ #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/DataBufferHeap.h" +#include "lldb/Utility/DataBufferLLVM.h" +#include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" @@ -861,10 +862,10 @@ protected: } assert(output_stream); - size_t bytes_dumped = - data.Dump(output_stream, 0, format, item_byte_size, item_count, - num_per_line / target->GetArchitecture().GetDataByteSize(), - addr, 0, 0, exe_scope); + size_t bytes_dumped = DumpDataExtractor( + data, output_stream, 0, format, item_byte_size, item_count, + num_per_line / target->GetArchitecture().GetDataByteSize(), addr, 0, 0, + exe_scope); m_next_addr = addr + bytes_dumped; output_stream->EOL(); return true; @@ -1131,10 +1132,10 @@ protected: DataExtractor data(dumpbuffer.GetBytes(), dumpbuffer.GetByteSize(), process->GetByteOrder(), process->GetAddressByteSize()); - data.Dump(&result.GetOutputStream(), 0, lldb::eFormatBytesWithASCII, 1, - dumpbuffer.GetByteSize(), 16, - found_location + m_memory_options.m_offset.GetCurrentValue(), - 0, 0); + DumpDataExtractor( + data, &result.GetOutputStream(), 0, lldb::eFormatBytesWithASCII, 1, + dumpbuffer.GetByteSize(), 16, + found_location + m_memory_options.m_offset.GetCurrentValue(), 0, 0); result.GetOutputStream().EOL(); } @@ -1358,8 +1359,9 @@ protected: size_t length = SIZE_MAX; if (item_byte_size > 1) length = item_byte_size; - lldb::DataBufferSP data_sp(m_memory_options.m_infile.ReadFileContents( - m_memory_options.m_infile_offset, length)); + auto data_sp = DataBufferLLVM::CreateSliceFromPath( + m_memory_options.m_infile.GetPath(), length, + m_memory_options.m_infile_offset); if (data_sp) { length = data_sp->GetByteSize(); if (length > 0) { @@ -1441,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); @@ -1457,7 +1467,7 @@ protected: } buffer.PutMaxHex64(uval64, item_byte_size); break; - + } case eFormatBoolean: uval64 = Args::StringToBoolean(entry.ref, false, &success); if (!success) { |