This extends DumpDataExtractor to also print memory
tags if called with an execution context on a target
that has memory tagging.
(lldb) memory read mte_buf mte_buf+32 -f "x" -s8
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.
There are no special alignment requirements, simply
use "memory read" as usual. All alignment is handled
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"
0x900fffff7ff7ff0: 0x00000000 <...> (tags: <no tag> 0x0)
The tags are read from a new class MemoryTagMap which
is a sparse map of tag read results.
Using the new tag manager method MakeTaggedRanges you
can get all the sub-ranges of a larger range, that
have memory tagging.
Then loop over these calling ReadMemoryTags, insert them
into the map and request as needed when printing memory dumps.
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).