Stacktrace improvements.
GitOrigin-RevId: 99dd952cff5c9e5edce575b84e365def24a59441
This commit is contained in:
parent
c093afbf68
commit
3d972da1e6
@ -306,6 +306,7 @@ static void block_stdin() {
|
||||
}
|
||||
|
||||
static void default_failure_signal_handler(int sig) {
|
||||
Stacktrace::init();
|
||||
signal_safe_write_signal_number(sig);
|
||||
|
||||
Stacktrace::PrintOptions options;
|
||||
|
@ -114,4 +114,11 @@ void Stacktrace::print_to_stderr(const PrintOptions &options) {
|
||||
print_backtrace();
|
||||
}
|
||||
|
||||
void Stacktrace::init() {
|
||||
#if __GLIBC__
|
||||
void *buffer[1];
|
||||
backtrace(buffer, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -16,6 +16,8 @@ class Stacktrace {
|
||||
}
|
||||
};
|
||||
static void print_to_stderr(const PrintOptions &options = PrintOptions());
|
||||
// backtrace needs to be called once to ensure that next calls are async-signal-safe
|
||||
static void init();
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
Loading…
Reference in New Issue
Block a user