Target &target, Status &error) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);
- std::string qemu = GetGlobalProperties().GetEmulatorPath().GetPath();
+ FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
+ if (!qemu)
+ qemu.SetPath(("qemu-" + GetGlobalProperties().GetArchitecture()).str());
+ FileSystem::Instance().ResolveExecutableLocation(qemu);
llvm::SmallString<0> socket_model, socket_path;
HostInfo::GetProcessTempDir().GetPath(socket_model);
llvm::sys::fs::createUniquePath(socket_model, socket_path, false);
} while (FileSystem::Instance().Exists(socket_path));
- Args args({qemu, "-g", socket_path});
+ Args args({qemu.GetPath(), "-g", socket_path});
args.AppendArguments(GetGlobalProperties().GetEmulatorArgs());
args.AppendArgument("--");
args.AppendArgument(launch_info.GetExecutableFile().GetPath());
def EmulatorPath: Property<"emulator-path", "FileSpec">,
Global,
DefaultStringValue<"">,
- Desc<"Path to the emulator binary.">;
+ Desc<"Path to the emulator binary. If the path does not contain a directory separator, the filename is looked up in the PATH environment variable. If empty, the filename is derived from the architecture setting.">;
def EmulatorArgs: Property<"emulator-args", "Args">,
Global,
DefaultStringValue<"">,
state = json.load(s)
self.assertEqual(state["stdin"], "STDIN CONTENT")
+ def test_find_in_PATH(self):
+ emulator = self.getBuildArtifact("qemu-" + self.getArchitecture())
+ os.rename(self.getBuildArtifact("qemu.py"), emulator)
+ self.set_emulator_setting("emulator-path", "''")
+
+ original_path = os.environ["PATH"]
+ os.environ["PATH"] = (self.getBuildDir() +
+ self.platformContext.shlib_path_separator + original_path)
+ def cleanup():
+ os.environ["PATH"] = original_path
+
+ self.addTearDownHook(cleanup)
+ state = self._run_and_get_state()
+
+ self.assertEqual(state["program"], self.getBuildArtifact())
+ self.assertEqual(state["args"],
+ ["dump:" + self.getBuildArtifact("state.log")])
+
def test_bad_emulator_path(self):
self.set_emulator_setting("emulator-path",
self.getBuildArtifact("nonexistent.file"))