Log argv[0] for failing spawns

This adds argv[0] for PLOG(FATAL) calls following a failed posix_spawn
or execve call to make logs more useful.

Bug: chromium:324982367
Change-Id: I179928ec9f791ce5b365b3444aa3bb667f4ec4b3
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5315332
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
This commit is contained in:
Peter Boström 2024-02-21 15:22:12 -08:00 committed by Crashpad LUCI CQ
parent 37afd37401
commit bc4fd34fe2

View File

@ -190,7 +190,8 @@ bool SpawnSubprocess(const std::vector<std::string>& argv,
auto execve_fp = use_path ? execvpe : execve;
execve_fp(argv_for_spawn[0], argv_for_spawn, envp_for_spawn);
PLOG(FATAL) << (use_path ? "execvpe" : "execve");
PLOG(FATAL) << (use_path ? "execvpe" : "execve") << " "
<< argv_for_spawn[0];
#else
#if BUILDFLAG(IS_APPLE)
PosixSpawnAttr attr;
@ -218,7 +219,8 @@ bool SpawnSubprocess(const std::vector<std::string>& argv,
attr_p,
argv_for_spawn,
envp_for_spawn)) != 0) {
PLOG(FATAL) << (use_path ? "posix_spawnp" : "posix_spawn");
PLOG(FATAL) << (use_path ? "posix_spawnp" : "posix_spawn") << " "
<< argv_for_spawn[0];
}
// _exit() instead of exit(), because fork() was called.