[all-commits] [llvm/llvm-project] 7d2723: [lldb][AArch64] Add memory tag writing to lldb-server

David Spickett via All-commits all-commits at lists.llvm.org
Tue Jul 27 04:02:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d27230de3336b8c79bfdc90f59858f6dad28fa5
      https://github.com/llvm/llvm-project/commit/7d27230de3336b8c79bfdc90f59858f6dad28fa5
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2021-07-27 (Tue, 27 Jul 2021)

  Changed paths:
    M lldb/include/lldb/Host/common/NativeProcessProtocol.h
    M lldb/include/lldb/Utility/StringExtractorGDBRemote.h
    M lldb/source/Host/common/NativeProcessProtocol.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
    M lldb/source/Utility/StringExtractorGDBRemote.cpp
    M lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py

  Log Message:
  -----------
  [lldb][AArch64] Add memory tag writing to lldb-server

This is implemented using the QMemTags packet, as specified
by GDB in:
https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets

(recall that qMemTags was previously added to read tags)

On receipt of a valid packet lldb-server will:
* align the given address and length to granules
  (most of the time lldb will have already done this
  but the specification doesn't guarantee it)
* Repeat the supplied tags as many times as needed to cover
  the range. (if tags > range we just use as many as needed)
* Call ptrace POKEMTETAGS to write the tags.

The ptrace step will loop just like the tag read does,
until all tags are written or we get an error.
Meaning that if ptrace succeeds it could be a partial write.
So we call it again and if we then get an error, return an error to
lldb.

We are not going to attempt to restore tags after a partial
write followed by an error. This matches the behaviour of the
existing memory writes.

The lldb-server tests have been extended to include read and
write in the same test file. With some updated function names
since "qMemTags" vs "QMemTags" isn't very clear when they're
next to each other.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D105180




More information about the All-commits mailing list