Linux: Write out si_code for SIGBUS exceptions.
Store the information in the exception record's exception_information field. Change-Id: Ie215cae2f070fdab63c3d05cc1bc4fb4b7b095fa Reviewed-on: https://chromium-review.googlesource.com/990799 Reviewed-by: Mark Mentovai <mark@chromium.org>
This commit is contained in:
parent
e93f852a3c
commit
adcc90ddb8
5 changed files with 26 additions and 11 deletions
|
@ -648,9 +648,7 @@ bool WriteMicrodump(pid_t crashing_process,
|
||||||
if (blob_size != sizeof(ExceptionHandler::CrashContext))
|
if (blob_size != sizeof(ExceptionHandler::CrashContext))
|
||||||
return false;
|
return false;
|
||||||
context = reinterpret_cast<const ExceptionHandler::CrashContext*>(blob);
|
context = reinterpret_cast<const ExceptionHandler::CrashContext*>(blob);
|
||||||
dumper.set_crash_address(
|
dumper.SetCrashInfoFromSigInfo(context->siginfo);
|
||||||
reinterpret_cast<uintptr_t>(context->siginfo.si_addr));
|
|
||||||
dumper.set_crash_signal(context->siginfo.si_signo);
|
|
||||||
dumper.set_crash_thread(context->tid);
|
dumper.set_crash_thread(context->tid);
|
||||||
}
|
}
|
||||||
MicrodumpWriter writer(context, mappings,
|
MicrodumpWriter writer(context, mappings,
|
||||||
|
|
|
@ -212,6 +212,7 @@ bool LinuxCoreDumper::EnumerateThreads() {
|
||||||
if (first_thread) {
|
if (first_thread) {
|
||||||
crash_thread_ = pid;
|
crash_thread_ = pid;
|
||||||
crash_signal_ = status->pr_info.si_signo;
|
crash_signal_ = status->pr_info.si_signo;
|
||||||
|
crash_signal_code_ = status->pr_info.si_code;
|
||||||
}
|
}
|
||||||
first_thread = false;
|
first_thread = false;
|
||||||
threads_.push_back(pid);
|
threads_.push_back(pid);
|
||||||
|
|
|
@ -283,6 +283,7 @@ LinuxDumper::LinuxDumper(pid_t pid, const char* root_prefix)
|
||||||
root_prefix_(root_prefix),
|
root_prefix_(root_prefix),
|
||||||
crash_address_(0),
|
crash_address_(0),
|
||||||
crash_signal_(0),
|
crash_signal_(0),
|
||||||
|
crash_signal_code_(0),
|
||||||
crash_thread_(pid),
|
crash_thread_(pid),
|
||||||
threads_(&allocator_, 8),
|
threads_(&allocator_, 8),
|
||||||
mappings_(&allocator_),
|
mappings_(&allocator_),
|
||||||
|
@ -354,6 +355,12 @@ LinuxDumper::ElfFileIdentifierForMapping(const MappingInfo& mapping,
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinuxDumper::SetCrashInfoFromSigInfo(const siginfo_t& siginfo) {
|
||||||
|
set_crash_address(reinterpret_cast<uintptr_t>(siginfo.si_addr));
|
||||||
|
set_crash_signal(siginfo.si_signo);
|
||||||
|
set_crash_signal_code(siginfo.si_code);
|
||||||
|
}
|
||||||
|
|
||||||
const char* LinuxDumper::GetCrashSignalString() const {
|
const char* LinuxDumper::GetCrashSignalString() const {
|
||||||
switch (static_cast<unsigned int>(crash_signal_)) {
|
switch (static_cast<unsigned int>(crash_signal_)) {
|
||||||
case MD_EXCEPTION_CODE_LIN_SIGHUP:
|
case MD_EXCEPTION_CODE_LIN_SIGHUP:
|
||||||
|
|
|
@ -170,6 +170,8 @@ class LinuxDumper {
|
||||||
unsigned int mapping_id,
|
unsigned int mapping_id,
|
||||||
wasteful_vector<uint8_t>& identifier);
|
wasteful_vector<uint8_t>& identifier);
|
||||||
|
|
||||||
|
void SetCrashInfoFromSigInfo(const siginfo_t& siginfo);
|
||||||
|
|
||||||
uintptr_t crash_address() const { return crash_address_; }
|
uintptr_t crash_address() const { return crash_address_; }
|
||||||
void set_crash_address(uintptr_t crash_address) {
|
void set_crash_address(uintptr_t crash_address) {
|
||||||
crash_address_ = crash_address;
|
crash_address_ = crash_address;
|
||||||
|
@ -179,6 +181,9 @@ class LinuxDumper {
|
||||||
void set_crash_signal(int crash_signal) { crash_signal_ = crash_signal; }
|
void set_crash_signal(int crash_signal) { crash_signal_ = crash_signal; }
|
||||||
const char* GetCrashSignalString() const;
|
const char* GetCrashSignalString() const;
|
||||||
|
|
||||||
|
void set_crash_signal_code(int code) { crash_signal_code_ = code; }
|
||||||
|
int crash_signal_code() const { return crash_signal_code_; }
|
||||||
|
|
||||||
pid_t crash_thread() const { return crash_thread_; }
|
pid_t crash_thread() const { return crash_thread_; }
|
||||||
void set_crash_thread(pid_t crash_thread) { crash_thread_ = crash_thread; }
|
void set_crash_thread(pid_t crash_thread) { crash_thread_ = crash_thread; }
|
||||||
|
|
||||||
|
@ -228,6 +233,9 @@ class LinuxDumper {
|
||||||
// Signal that terminated the crashed process.
|
// Signal that terminated the crashed process.
|
||||||
int crash_signal_;
|
int crash_signal_;
|
||||||
|
|
||||||
|
// The code associated with |crash_signal_|.
|
||||||
|
int crash_signal_code_;
|
||||||
|
|
||||||
// ID of the crashed thread.
|
// ID of the crashed thread.
|
||||||
pid_t crash_thread_;
|
pid_t crash_thread_;
|
||||||
|
|
||||||
|
|
|
@ -702,15 +702,18 @@ class MinidumpWriter {
|
||||||
TypedMDRVA<MDRawExceptionStream> exc(&minidump_writer_);
|
TypedMDRVA<MDRawExceptionStream> exc(&minidump_writer_);
|
||||||
if (!exc.Allocate())
|
if (!exc.Allocate())
|
||||||
return false;
|
return false;
|
||||||
my_memset(exc.get(), 0, sizeof(MDRawExceptionStream));
|
|
||||||
|
MDRawExceptionStream* stream = exc.get();
|
||||||
|
my_memset(stream, 0, sizeof(MDRawExceptionStream));
|
||||||
|
|
||||||
dirent->stream_type = MD_EXCEPTION_STREAM;
|
dirent->stream_type = MD_EXCEPTION_STREAM;
|
||||||
dirent->location = exc.location();
|
dirent->location = exc.location();
|
||||||
|
|
||||||
exc.get()->thread_id = GetCrashThread();
|
stream->thread_id = GetCrashThread();
|
||||||
exc.get()->exception_record.exception_code = dumper_->crash_signal();
|
stream->exception_record.exception_code = dumper_->crash_signal();
|
||||||
exc.get()->exception_record.exception_address = dumper_->crash_address();
|
stream->exception_record.exception_flags = dumper_->crash_signal_code();
|
||||||
exc.get()->thread_context = crashing_thread_context_;
|
stream->exception_record.exception_address = dumper_->crash_address();
|
||||||
|
stream->thread_context = crashing_thread_context_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1366,9 +1369,7 @@ bool WriteMinidumpImpl(const char* minidump_path,
|
||||||
if (blob_size != sizeof(ExceptionHandler::CrashContext))
|
if (blob_size != sizeof(ExceptionHandler::CrashContext))
|
||||||
return false;
|
return false;
|
||||||
context = reinterpret_cast<const ExceptionHandler::CrashContext*>(blob);
|
context = reinterpret_cast<const ExceptionHandler::CrashContext*>(blob);
|
||||||
dumper.set_crash_address(
|
dumper.SetCrashInfoFromSigInfo(context->siginfo);
|
||||||
reinterpret_cast<uintptr_t>(context->siginfo.si_addr));
|
|
||||||
dumper.set_crash_signal(context->siginfo.si_signo);
|
|
||||||
dumper.set_crash_thread(context->tid);
|
dumper.set_crash_thread(context->tid);
|
||||||
}
|
}
|
||||||
MinidumpWriter writer(minidump_path, minidump_fd, context, mappings,
|
MinidumpWriter writer(minidump_path, minidump_fd, context, mappings,
|
||||||
|
|
Loading…
Reference in a new issue