aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-01-27 22:17:16 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-05-14 11:44:34 +0000
commit04eeddc0aa8e0a417a16eaf9d7d095207f4a8623 (patch)
tree2a5d3b2fe5c852e91531d128d9177754572d5338 /contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp
parent0eae32dcef82f6f06de6419a0d623d7def0cc8f6 (diff)
parent6f8fc217eaa12bf657be1c6468ed9938d10168b3 (diff)
Diffstat (limited to 'contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp
index 9df42f36fafd..1b44a1bd709a 100644
--- a/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/contrib/llvm-project/lldb/source/Commands/CommandObjectMemory.cpp
@@ -23,6 +23,7 @@
#include "lldb/Interpreter/Options.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Target/ABI.h"
#include "lldb/Target/Language.h"
#include "lldb/Target/MemoryHistory.h"
#include "lldb/Target/MemoryRegionInfo.h"
@@ -47,7 +48,7 @@ using namespace lldb_private;
class OptionGroupReadMemory : public OptionGroup {
public:
OptionGroupReadMemory()
- : m_num_per_line(1, 1), m_view_as_type(), m_offset(0, 0),
+ : m_num_per_line(1, 1), m_offset(0, 0),
m_language_for_type(eLanguageTypeUnknown) {}
~OptionGroupReadMemory() override = default;
@@ -90,6 +91,10 @@ public:
error = m_offset.SetValueFromString(option_value);
break;
+ case '\x01':
+ m_show_tags = true;
+ break;
+
default:
llvm_unreachable("Unimplemented option");
}
@@ -103,6 +108,7 @@ public:
m_force = false;
m_offset.Clear();
m_language_for_type.Clear();
+ m_show_tags = false;
}
Status FinalizeSettings(Target *target, OptionGroupFormat &format_options) {
@@ -276,6 +282,7 @@ public:
bool m_force;
OptionValueUInt64 m_offset;
OptionValueLanguage m_language_for_type;
+ bool m_show_tags = false;
};
// Read memory from the inferior process
@@ -286,12 +293,10 @@ public:
interpreter, "memory read",
"Read from the memory of the current target process.", nullptr,
eCommandRequiresTarget | eCommandProcessMustBePaused),
- m_option_group(), m_format_options(eFormatBytesWithASCII, 1, 8),
- m_memory_options(), m_outfile_options(), m_varobj_options(),
+ m_format_options(eFormatBytesWithASCII, 1, 8),
+
m_next_addr(LLDB_INVALID_ADDRESS), m_prev_byte_size(0),
- m_prev_format_options(eFormatBytesWithASCII, 1, 8),
- m_prev_memory_options(), m_prev_outfile_options(),
- m_prev_varobj_options() {
+ m_prev_format_options(eFormatBytesWithASCII, 1, 8) {
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
CommandArgumentData start_addr_arg;
@@ -590,9 +595,16 @@ protected:
return false;
}
+ ABISP abi = m_exe_ctx.GetProcessPtr()->GetABI();
+ if (abi)
+ addr = abi->FixDataAddress(addr);
+
if (argc == 2) {
lldb::addr_t end_addr = OptionArgParser::ToAddress(
&m_exe_ctx, command[1].ref(), LLDB_INVALID_ADDRESS, nullptr);
+ if (end_addr != LLDB_INVALID_ADDRESS && abi)
+ end_addr = abi->FixDataAddress(end_addr);
+
if (end_addr == LLDB_INVALID_ADDRESS) {
result.AppendError("invalid end address expression.");
result.AppendError(error.AsCString());
@@ -854,7 +866,7 @@ protected:
size_t bytes_dumped = DumpDataExtractor(
data, output_stream_p, 0, format, item_byte_size, item_count,
num_per_line / target->GetArchitecture().GetDataByteSize(), addr, 0, 0,
- exe_scope);
+ exe_scope, m_memory_options.m_show_tags);
m_next_addr = addr + bytes_dumped;
output_stream_p->EOL();
return true;
@@ -882,7 +894,7 @@ class CommandObjectMemoryFind : public CommandObjectParsed {
public:
class OptionGroupFindMemory : public OptionGroup {
public:
- OptionGroupFindMemory() : OptionGroup(), m_count(1), m_offset(0) {}
+ OptionGroupFindMemory() : m_count(1), m_offset(0) {}
~OptionGroupFindMemory() override = default;
@@ -936,8 +948,7 @@ public:
: CommandObjectParsed(
interpreter, "memory find",
"Find a value in the memory of the current target process.",
- nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
- m_option_group(), m_memory_options() {
+ nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched) {
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
CommandArgumentData addr_arg;
@@ -1027,6 +1038,12 @@ protected:
return false;
}
+ ABISP abi = m_exe_ctx.GetProcessPtr()->GetABI();
+ if (abi) {
+ low_addr = abi->FixDataAddress(low_addr);
+ high_addr = abi->FixDataAddress(high_addr);
+ }
+
if (high_addr <= low_addr) {
result.AppendError(
"starting address must be smaller than ending address");
@@ -1170,7 +1187,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed {
public:
class OptionGroupWriteMemory : public OptionGroup {
public:
- OptionGroupWriteMemory() : OptionGroup() {}
+ OptionGroupWriteMemory() {}
~OptionGroupWriteMemory() override = default;
@@ -1222,16 +1239,14 @@ public:
interpreter, "memory write",
"Write to the memory of the current target process.", nullptr,
eCommandRequiresProcess | eCommandProcessMustBeLaunched),
- m_option_group(),
m_format_options(
eFormatBytes, 1, UINT64_MAX,
{std::make_tuple(
eArgTypeFormat,
"The format to use for each of the value to be written."),
- std::make_tuple(
- eArgTypeByteSize,
- "The size in bytes to write from input file or each value.")}),
- m_memory_options() {
+ std::make_tuple(eArgTypeByteSize,
+ "The size in bytes to write from input file or "
+ "each value.")}) {
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
CommandArgumentData addr_arg;