diff options
author | David Spickett <david.spickett@linaro.org> | 2022-04-14 11:56:44 +0100 |
---|---|---|
committer | David Spickett <david.spickett@linaro.org> | 2022-05-18 16:49:09 +0100 |
commit | 29e556fc2ba93028f0dc45c4c2636da6283e9c28 (patch) | |
tree | 7f4e3f4cab20b1a3762e3296f69b6c80e340cce9 /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | ca302f07b453cc79e56ff4834930697a6be52707 (diff) | |
download | llvm-29e556fc2ba93028f0dc45c4c2636da6283e9c28.zip llvm-29e556fc2ba93028f0dc45c4c2636da6283e9c28.tar.gz llvm-29e556fc2ba93028f0dc45c4c2636da6283e9c28.tar.bz2 |
[lldb] Change implementation of memory read --show-tags option
This does 2 things:
* Moves it after the short options. Which makes sense given it's
a niche, default off option.
(if 2 files for one option seems a bit much, I am going to reuse
them for "memory find" later)
* Fixes the use of repeated commands. For example:
memory read buf --show-tags
<shows tags>
memory read
<shows tags>
Added tests for the repetition and updated existing help tests.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D125089
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index e94306c..f13f749 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -16,6 +16,7 @@ #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/OptionArgParser.h" #include "lldb/Interpreter/OptionGroupFormat.h" +#include "lldb/Interpreter/OptionGroupMemoryTag.h" #include "lldb/Interpreter/OptionGroupOutputFile.h" #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" #include "lldb/Interpreter/OptionValueLanguage.h" @@ -90,10 +91,6 @@ public: error = m_offset.SetValueFromString(option_value); break; - case '\x01': - m_show_tags = true; - break; - default: llvm_unreachable("Unimplemented option"); } @@ -107,7 +104,6 @@ public: m_force = false; m_offset.Clear(); m_language_for_type.Clear(); - m_show_tags = false; } Status FinalizeSettings(Target *target, OptionGroupFormat &format_options) { @@ -281,7 +277,6 @@ public: bool m_force; OptionValueUInt64 m_offset; OptionValueLanguage m_language_for_type; - bool m_show_tags = false; }; // Read memory from the inferior process @@ -336,6 +331,8 @@ public: m_option_group.Append(&m_outfile_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3); m_option_group.Append(&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3); + m_option_group.Append(&m_memory_tag_options, LLDB_OPT_SET_ALL, + LLDB_OPT_SET_ALL); m_option_group.Finalize(); } @@ -555,11 +552,13 @@ protected: if (!m_format_options.AnyOptionWasSet() && !m_memory_options.AnyOptionWasSet() && !m_outfile_options.AnyOptionWasSet() && - !m_varobj_options.AnyOptionWasSet()) { + !m_varobj_options.AnyOptionWasSet() && + !m_memory_tag_options.AnyOptionWasSet()) { m_format_options = m_prev_format_options; m_memory_options = m_prev_memory_options; m_outfile_options = m_prev_outfile_options; m_varobj_options = m_prev_varobj_options; + m_memory_tag_options = m_prev_memory_tag_options; } } @@ -753,6 +752,7 @@ protected: m_prev_memory_options = m_memory_options; m_prev_outfile_options = m_outfile_options; m_prev_varobj_options = m_varobj_options; + m_prev_memory_tag_options = m_memory_tag_options; m_prev_compiler_type = compiler_type; std::unique_ptr<Stream> output_stream_storage; @@ -864,7 +864,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, m_memory_options.m_show_tags); + exe_scope, m_memory_tag_options.GetShowTags().GetCurrentValue()); m_next_addr = addr + bytes_dumped; output_stream_p->EOL(); return true; @@ -875,12 +875,14 @@ protected: OptionGroupReadMemory m_memory_options; OptionGroupOutputFile m_outfile_options; OptionGroupValueObjectDisplay m_varobj_options; + OptionGroupMemoryTag m_memory_tag_options; lldb::addr_t m_next_addr = LLDB_INVALID_ADDRESS; lldb::addr_t m_prev_byte_size = 0; OptionGroupFormat m_prev_format_options; OptionGroupReadMemory m_prev_memory_options; OptionGroupOutputFile m_prev_outfile_options; OptionGroupValueObjectDisplay m_prev_varobj_options; + OptionGroupMemoryTag m_prev_memory_tag_options; CompilerType m_prev_compiler_type; }; |