[all-commits] [llvm/llvm-project] a6e673: [lldb] Inline Platform::LoadCachedExecutable into ...

Pavel Labath via All-commits all-commits at lists.llvm.org
Tue Nov 30 05:22:36 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a6e673643c44f94557fa09022a3c6edf76167871
      https://github.com/llvm/llvm-project/commit/a6e673643c44f94557fa09022a3c6edf76167871
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M lldb/include/lldb/Target/Platform.h
    M lldb/source/Target/Platform.cpp

  Log Message:
  -----------
  [lldb] Inline Platform::LoadCachedExecutable into its (single) caller


  Commit: 1408684957bbfb5b412e0ef3c027c88daa1058eb
      https://github.com/llvm/llvm-project/commit/1408684957bbfb5b412e0ef3c027c88daa1058eb
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M lldb/packages/Python/lldbsuite/test/gdbclientutils.py
    M lldb/source/Plugins/Platform/CMakeLists.txt
    A lldb/source/Plugins/Platform/QemuUser/CMakeLists.txt
    A lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
    A lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
    A lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
    A lldb/test/API/qemu/Makefile
    A lldb/test/API/qemu/TestQemuLaunch.py
    A lldb/test/API/qemu/main.c
    A lldb/test/API/qemu/qemu.py

  Log Message:
  -----------
  [lldb] Introduce PlatformQemuUser

This adds a new platform class, whose job is to enable running
(debugging) executables under qemu.

(For general information about qemu, I recommend reading the RFC thread
on lldb-dev
<https://lists.llvm.org/pipermail/lldb-dev/2021-October/017106.html>.)

This initial patch implements the necessary boilerplate as well as the
minimal amount of functionality needed to actually be able to do
something useful (which, in this case means debugging a fully statically
linked executable).

The knobs necessary to emulate dynamically linked programs, as well as
to control other aspects of qemu operation (the emulated cpu, for
instance) will be added in subsequent patches. Same goes for the ability
to automatically bind to the executables of the emulated architecture.

Currently only two settings are available:
- architecture: the architecture that we should emulate
- emulator-path: the path to the emulator

Even though this patch is relatively small, it doesn't lack subtleties
that are worth calling out explicitly:
- named sockets: qemu supports tcp and unix socket connections, both of
  them in the "forward connect" mode (qemu listening, lldb connecting).
  Forward TCP connections are impossible to realise in a race-free way.
  This is the reason why I chose unix sockets as they have larger, more
  structured names, which can guarantee that there are no collisions
  between concurrent connection attempts.
- the above means that this code will not work on windows. I don't think
  that's an issue since user mode qemu does not support windows anyway.
- Right now, I am leaving the code enabled for windows, but maybe it
  would be better to disable it (otoh, disabling it means windows
  developers can't check they don't break it)
- qemu-user also does not support macOS, so one could contemplate
  disabling it there too. However, macOS does support named sockets, so
  one can even run the (mock) qemu tests there, and I think it'd be a
  shame to lose that.

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


Compare: https://github.com/llvm/llvm-project/compare/ee0c75eba31b...1408684957bb


More information about the All-commits mailing list