forked from OSchip/llvm-project
[lldb/qemu] Set qemu's "ld prefix" based on the platform sysroot
Both serve the same purpose (finding shared libraries) and allow one to launch a dynamically linked executable by just specifying the platform sysroot.
This commit is contained in:
parent
ca271f4ef5
commit
862fffd823
|
@ -191,6 +191,8 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
|
|||
launch_info.SetArguments(args, true);
|
||||
|
||||
Environment emulator_env = Host::GetEnvironment();
|
||||
if (ConstString sysroot = GetSDKRootDirectory())
|
||||
emulator_env["QEMU_LD_PREFIX"] = sysroot.GetStringRef().str();
|
||||
for (const auto &KV : GetGlobalProperties().GetEmulatorEnvVars())
|
||||
emulator_env[KV.first()] = KV.second;
|
||||
launch_info.GetEnvironment() = ComputeLaunchEnvironment(
|
||||
|
|
|
@ -249,3 +249,11 @@ class TestQemuLaunch(TestBase):
|
|||
|
||||
self.assertEqual(state["program"], self.getBuildArtifact())
|
||||
self.assertEqual(state["0"], "ARG0")
|
||||
|
||||
def test_sysroot(self):
|
||||
sysroot = self.getBuildArtifact("sysroot")
|
||||
self.runCmd("platform select qemu-user --sysroot %s" % sysroot)
|
||||
state = self._run_and_get_state()
|
||||
self.assertEqual(state["environ"]["QEMU_LD_PREFIX"], sysroot)
|
||||
self.assertIn("QEMU_LD_PREFIX",
|
||||
state["environ"]["QEMU_UNSET_ENV"].split(","))
|
||||
|
|
Loading…
Reference in New Issue