[all-commits] [llvm/llvm-project] d4eca1: [lldb/gdb-remote] Add support for the qOffsets packet

Pavel Labath via All-commits all-commits at lists.llvm.org
Wed Feb 26 01:19:10 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d4eca120ac0af2a805c19301412bf843a71c14b5
      https://github.com/llvm/llvm-project/commit/d4eca120ac0af2a805c19301412bf843a71c14b5
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-02-26 (Wed, 26 Feb 2020)

  Changed paths:
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
    A lldb/test/API/functionalities/gdb_remote_client/TestqOffsets.py
    M lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
    A lldb/test/API/functionalities/gdb_remote_client/qOffsets.yaml
    M lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

  Log Message:
  -----------
  [lldb/gdb-remote] Add support for the qOffsets packet

Summary:
This packet is necessary to make lldb work with the remote-gdb stub in
user mode qemu when running position-independent binaries. It reports
the relative position (load bias) of the loaded executable wrt. the
addresses in the file itself.

Lldb needs to know this information in order to correctly set the load
address of the executable. Normally, lldb would be able to find this out
on its own by following the breadcrumbs in the process auxiliary vector,
but we can't do this here because qemu does not support the
qXfer:auxv:read packet.

This patch does not implement full scope of the qOffsets packet (it only
supports packets with identical code, data and bss offsets), because it
is not fully clear how should the different offsets be handled and I am
not aware of a producer which would make use of this feature (qemu will
always
<https://github.com/qemu/qemu/blob/master/linux-user/elfload.c#L2436>
return the same value for code and data offsets). In fact, even gdb
ignores the offset for the bss sections, and uses the "data" offset
instead.  So, until the we need more of this packet, I think it's best
to stick to the simplest solution possible. This patch simply rejects
replies with non-uniform offsets.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list