[all-commits] [llvm/llvm-project] 45aa43: [lldb/qemu] Separate host and target environments
Pavel Labath via All-commits
all-commits at lists.llvm.org
Wed Dec 8 04:08:43 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 45aa435661d80843554d425156f300b207d8a0a0
https://github.com/llvm/llvm-project/commit/45aa435661d80843554d425156f300b207d8a0a0
Author: Pavel Labath <pavel at labath.sk>
Date: 2021-12-08 (Wed, 08 Dec 2021)
Changed paths:
M lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
M lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
M lldb/source/Plugins/Platform/QemuUser/PlatformQemuUserProperties.td
M lldb/test/API/qemu/TestQemuLaunch.py
M lldb/test/API/qemu/qemu.py
Log Message:
-----------
[lldb/qemu] Separate host and target environments
Qemu normally forwards its (host) environment variables to the emulated
process. While this works fine for most variables, there are some (few, but
fairly important) variables where this is not possible. LD_LIBRARY_PATH
is the probably the most important of those -- we don't want the library
search path for the emulated libraries to interfere with the libraries
that the emulator itself needs.
For this reason, qemu provides a mechanism (QEMU_SET_ENV,
QEMU_UNSET_ENV) to set variables only for the emulated process. This
patch makes use of that functionality to pass any user-provided
variables to the emulated process. Since we're piggy-backing on the
normal lldb environment-handling mechanism, all the usual mechanism to
provide environment (target.env-vars setting, SBLaunchInfo, etc.) work
out-of-the-box, and the only thing we need to do is to properly
construct the qemu environment variables.
This patch also adds a new setting -- target-env-vars, which represents
environment variables which are added (on top of the host environment)
to the default launch environments of all (qemu) targets. The reason for
its existence is to enable the configuration (e.g., from a startup
script) of the default launch environment, before any target is created.
The idea is that this would contain the variables (like the
aforementioned LD_LIBRARY_PATH) common to all targets being debugged on
the given system. The user is, of course, free to customize the
environment for a particular target in the usual manner.
The reason I do not want to use/recommend the "global" version of the
target.env-vars setting for this purpose is that the setting would apply
to all targets, whereas the settings (their values) I have mentioned
would be specific to the given platform.
Differential Revision: https://reviews.llvm.org/D115246
More information about the All-commits
mailing list