Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c96d701

Browse filesBrowse files
bnoordhuisFishrock123
authored andcommitted
src: print backtrace on abort/unreachable code
Print a C backtrace on fatal errors to make it easier to debug issues. PR-URL: #6734 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 6cec90a commit c96d701
Copy full SHA for c96d701

File tree

Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-3
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,6 @@ static void OnFatalError(const char* location, const char* message) {
24522452
} else {
24532453
PrintErrorString("FATAL ERROR: %s\n", message);
24542454
}
2455-
DumpBacktrace(stderr);
24562455
fflush(stderr);
24572456
ABORT();
24582457
}
Collapse file

‎src/util.h‎

Copy file name to clipboardExpand all lines: src/util.h
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,18 @@ template <typename T> using remove_reference = std::remove_reference<T>;
3838

3939
// Windows 8+ does not like abort() in Release mode
4040
#ifdef _WIN32
41-
#define ABORT() raise(SIGABRT)
41+
#define ABORT_NO_BACKTRACE() raise(SIGABRT)
4242
#else
43-
#define ABORT() abort()
43+
#define ABORT_NO_BACKTRACE() abort()
4444
#endif
4545

46+
#define ABORT() \
47+
do { \
48+
node::DumpBacktrace(stderr); \
49+
fflush(stderr); \
50+
ABORT_NO_BACKTRACE(); \
51+
} while (0)
52+
4653
#if defined(NDEBUG)
4754
# define ASSERT(expression)
4855
# define CHECK(expression) \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.