Report exception number in metadata on CrOS.

In order to determine in crash_reporter whether a crash was fatal, we
need the exception number (-1 is not an actual crash).

BUG=b:269159625
TEST=deploy to DUT; chrome://crashdump; verify metadata present.

Change-Id: I83d3c9cc839a685af2f50d143d627cf9fcfaf3ac
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4265253
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Miriam Zimmerman <mutexlox@chromium.org>
This commit is contained in:
Miriam Zimmerman 2023-02-21 14:44:59 -05:00 committed by Crashpad LUCI CQ
parent 448d2d90da
commit 7a997fb253

View File

@ -17,6 +17,7 @@
#include <vector> #include <vector>
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "client/settings.h" #include "client/settings.h"
#include "handler/linux/capture_snapshot.h" #include "handler/linux/capture_snapshot.h"
#include "handler/minidump_to_upload_parameters.h" #include "handler/minidump_to_upload_parameters.h"
@ -246,6 +247,16 @@ bool CrosCrashReportExceptionHandler::HandleExceptionWithConnection(
// crash_reporter needs to know the pid and uid of the crashing process. // crash_reporter needs to know the pid and uid of the crashing process.
std::vector<std::string> argv({"/sbin/crash_reporter"}); std::vector<std::string> argv({"/sbin/crash_reporter"});
// Used to distinguish between non-fatal and fatal crashes.
const ExceptionSnapshot* const exception_snapshot = snapshot->Exception();
if (exception_snapshot) {
// convert to int32, since crashpad uses -1 as a signal for non-fatal
// crashes.
argv.push_back(base::StringPrintf(
"--chrome_signal=%d",
static_cast<int32_t>(exception_snapshot->Exception())));
}
argv.push_back("--chrome_memfd=" + std::to_string(file_writer.fd())); argv.push_back("--chrome_memfd=" + std::to_string(file_writer.fd()));
const pid_t pid = process_snapshot->ProcessID(); const pid_t pid = process_snapshot->ProcessID();