llvm-project/lldb/source/Commands
David Spickett 070090d08e [lldb] Add option to show memory tags in memory read output
This adds an option --show-tags to "memory read".

(lldb) memory read mte_buf mte_buf+32 -f "x" -s8 --show-tags
0x900fffff7ff8000: 0x0000000000000000 0x0000000000000000 (tag: 0x0)
0x900fffff7ff8010: 0x0000000000000000 0x0000000000000000 (tag: 0x1)

Tags are printed on the end of each line, if that
line has any tags associated with it. Meaning that
untagged memory output is unchanged.

Tags are printed based on the granule(s) of memory that
a line covers. So you may have lines with 1 tag, with many
tags, no tags or partially tagged lines.

In the case of partially tagged lines, untagged granules
will show "<no tag>" so that the ordering is obvious.
For example, a line that covers 2 granules where the first
is not tagged:

(lldb) memory read mte_buf-16 mte_buf+16 -l32 -f"x" --show-tags
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)

Untagged lines will just not have the "(tags: ..." at all.
Though they may be part of a larger output that does have
some tagged lines.

To do this I've extended DumpDataExtractor to also print
memory tags where it has a valid execution context and
is asked to print them.

There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
in DumpDataExtractor.

We use MakeTaggedRanges to find all the tagged memory
in the current dump, then read all that into a MemoryTagMap.

The tag map is populated once in DumpDataExtractor and re-used
for each subsequently printed line (or recursive call of
DumpDataExtractor, which some formats do).

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D107140
2022-01-26 14:40:39 +00:00
..
CMakeLists.txt [lldb] Make lldbVersion a full fledged library 2021-12-08 15:14:34 -08:00
CommandCompletions.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectApropos.cpp Add a "command container" hierarchy to allow users to add container nodes. 2021-10-18 15:29:24 -07:00
CommandObjectApropos.h
CommandObjectBreakpoint.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectBreakpoint.h
CommandObjectBreakpointCommand.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectBreakpointCommand.h
CommandObjectCommands.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectCommands.h
CommandObjectDisassemble.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectDisassemble.h [lldb] Use C++11 default member initializers 2021-06-09 09:43:13 -07:00
CommandObjectExpression.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectExpression.h
CommandObjectFrame.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectFrame.h
CommandObjectGUI.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
CommandObjectGUI.h
CommandObjectHelp.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectHelp.h [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectLanguage.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
CommandObjectLanguage.h
CommandObjectLog.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectLog.h [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
CommandObjectMemory.cpp [lldb] Add option to show memory tags in memory read output 2022-01-26 14:40:39 +00:00
CommandObjectMemory.h
CommandObjectMemoryTag.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectMemoryTag.h [lldb][AArch64] Add "memory tag read" command 2021-06-24 17:35:45 +01:00
CommandObjectMultiword.cpp [lldb] Remove unused AproposAllSubCommands (NFC) 2022-01-02 11:30:51 -08:00
CommandObjectPlatform.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectPlatform.h [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
CommandObjectPlugin.cpp [lldb] Remove redundant calls to set eReturnStatusFailed 2021-06-17 14:39:35 +01:00
CommandObjectPlugin.h
CommandObjectProcess.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectProcess.h
CommandObjectQuit.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
CommandObjectQuit.h
CommandObjectRegexCommand.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectRegexCommand.h [lldb] Move ScriptCommand and RegexCommand under Commands (NFC) 2020-09-01 17:33:39 -07:00
CommandObjectRegister.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectRegister.h [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN 2020-06-02 13:23:53 -04:00
CommandObjectReproducer.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectReproducer.h
CommandObjectScript.cpp [lldb] Replace default bodies of special member functions with = default; 2021-07-02 11:31:16 -07:00
CommandObjectScript.h [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectSession.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectSession.h [lldb/interpreter] Add ability to save lldb session to a file 2020-07-22 11:43:16 +02:00
CommandObjectSettings.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectSettings.h
CommandObjectSource.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectSource.h
CommandObjectStats.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectStats.h
CommandObjectTarget.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectTarget.h
CommandObjectThread.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectThread.h
CommandObjectThreadUtil.cpp [lldb] Remove redundant calls to set eReturnStatusFailed 2021-06-17 14:39:35 +01:00
CommandObjectThreadUtil.h [trace][intel-pt] Create basic SB API 2021-06-17 15:14:47 -07:00
CommandObjectTrace.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectTrace.h [trace][intel-pt] Implement trace start and trace stop 2021-03-30 17:31:37 -07:00
CommandObjectType.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectType.h
CommandObjectVersion.cpp [lldb] Make lldbVersion a full fledged library 2021-12-08 15:14:34 -08:00
CommandObjectVersion.h
CommandObjectWatchpoint.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectWatchpoint.h
CommandObjectWatchpointCommand.cpp [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
CommandObjectWatchpointCommand.h
CommandOptionsProcessLaunch.cpp [lldb/Commands] Add command options for ScriptedProcess to ProcessLaunch 2021-03-23 18:24:47 +01:00
CommandOptionsProcessLaunch.h [Commands] Remove redundant member initialization (NFC) 2022-01-23 11:07:14 -08:00
Options.td [lldb] Add option to show memory tags in memory read output 2022-01-26 14:40:39 +00:00
OptionsBase.td