diff options
author | David Spickett <david.spickett@linaro.org> | 2022-04-13 14:32:18 +0100 |
---|---|---|
committer | David Spickett <david.spickett@linaro.org> | 2022-05-19 14:40:01 +0100 |
commit | 068f14f1e4ec69d218df544487f9420f2b3ab29b (patch) | |
tree | 3ce42779aa3d2f57d3f5e58d506cb5bd5890eedc /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | df25f0d5202bbd9e2e909dccb1aa16f8ebad5e7b (diff) | |
download | llvm-068f14f1e4ec69d218df544487f9420f2b3ab29b.zip llvm-068f14f1e4ec69d218df544487f9420f2b3ab29b.tar.gz llvm-068f14f1e4ec69d218df544487f9420f2b3ab29b.tar.bz2 |
[lldb] Add --show-tags option to "memory find"
This is off by default. If you get a result and that
memory has memory tags, when --show-tags is given you'll
see the tags inline with the memory content.
```
(lldb) memory read mte_buf mte_buf+64 --show-tags
<...>
0xfffff7ff8020: 00 00 00 00 00 00 00 00 0d f0 fe ca 00 00 00 00 ................ (tag: 0x2)
<...>
(lldb) memory find -e 0xcafef00d mte_buf mte_buf+64 --show-tags
data found at location: 0xfffff7ff8028
0xfffff7ff8028: 0d f0 fe ca 00 00 00 00 00 00 00 00 00 00 00 00 ................ (tags: 0x2 0x3)
0xfffff7ff8038: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ (tags: 0x3 0x4)
```
The logic for handling alignments is the same as for memory read
so in the above example because the line starts misaligned to the
granule it covers 2 granules.
Depends on D125089
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D125090
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 7005db3..b7678ad 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -288,7 +288,7 @@ public: "Read from the memory of the current target process.", nullptr, eCommandRequiresTarget | eCommandProcessMustBePaused), m_format_options(eFormatBytesWithASCII, 1, 8), - + m_memory_tag_options(/*note_binary=*/true), m_prev_format_options(eFormatBytesWithASCII, 1, 8) { CommandArgumentEntry arg1; CommandArgumentEntry arg2; @@ -975,6 +975,8 @@ public: m_arguments.push_back(arg2); m_option_group.Append(&m_memory_options); + m_option_group.Append(&m_memory_tag_options, LLDB_OPT_SET_ALL, + LLDB_OPT_SET_ALL); m_option_group.Finalize(); } @@ -1139,7 +1141,9 @@ protected: DumpDataExtractor( data, &result.GetOutputStream(), 0, lldb::eFormatBytesWithASCII, 1, dumpbuffer.GetByteSize(), 16, - found_location + m_memory_options.m_offset.GetCurrentValue(), 0, 0); + found_location + m_memory_options.m_offset.GetCurrentValue(), 0, 0, + m_exe_ctx.GetBestExecutionContextScope(), + m_memory_tag_options.GetShowTags().GetCurrentValue()); result.GetOutputStream().EOL(); } @@ -1182,6 +1186,7 @@ protected: OptionGroupOptions m_option_group; OptionGroupFindMemory m_memory_options; + OptionGroupMemoryTag m_memory_tag_options; }; #define LLDB_OPTIONS_memory_write |