dmlc / dmlc/dmlc-core

[Feature] stack trace printing in signal handlers

Open
#630 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
878
Forks
526
Avg merge
12d 19h
Merged PRs (30d)
1

Description

Currently in DMLC core the utility for printing stacktrace (and demangling) are the following:

https://github.com/dmlc/dmlc-core/blob/ebcaa42d0b7271265e6a02ff468c6753a8fbecdb/include/dmlc/logging.h#L49-L96

The problem with them is that they can't be used safely in asynchronous signal handlers, for which [non-reentrant functions](https://www.ibm.com/developerworks/library/l-reent/) are required.

According to [boost](https://www.boost.org/doc/libs/1_67_0/doc/html/stacktrace/getting_started.html#stacktrace.getting_started.handle_terminates_aborts_and_seg), there isn't a safe way to get stacktrace that's portable. On the other hand, one was described in this [blog](https://oroboro.com/stack-trace-on-crash/). The downside is that on windows it relies on [StackWalker](https://www.codeproject.com/Articles/11132/Walking-the-callstack-2). There may be better, more modern ways to achieve this that I missed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.