Skip to content

Commit 658c102

Browse files
committed
Add AVM_PRINT_PROCESS_CRASH_DUMPS option
1 parent 3b6901b commit 658c102

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5454
- Added `binary:match/2` and `binary:match/3`
5555
- Added `supervisor:which_children/1`
5656
- Added `monitored_by` in `process_info/2`
57+
- Added `AVM_PRINT_PROCESS_CRASH_DUMPS` option
5758

5859
### Changed
5960

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ option(AVM_RELEASE "Build an AtomVM release" OFF)
3737
option(AVM_CREATE_STACKTRACES "Create stacktraces" ON)
3838
option(AVM_BUILD_RUNTIME_ONLY "Only build the AtomVM runtime" OFF)
3939
option(COVERAGE "Build for code coverage" OFF)
40+
option(AVM_PRINT_PROCESS_CRASH_DUMPS "Print crash reports when processes die with non-standard reasons" ON)
4041

4142
if((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") OR
4243
(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR

src/libAtomVM/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ if(HAVE_PLATFORM_ATOMIC_H)
166166
target_compile_definitions(libAtomVM PUBLIC HAVE_PLATFORM_ATOMIC_H)
167167
endif()
168168

169+
if (AVM_PRINT_PROCESS_CRASH_DUMPS)
170+
target_compile_definitions(libAtomVM PUBLIC AVM_PRINT_PROCESS_CRASH_DUMPS)
171+
endif()
172+
169173
# Platforms that run select in a task must set this option
170174
if(AVM_SELECT_IN_TASK)
171175
target_compile_definitions(libAtomVM PUBLIC AVM_SELECT_IN_TASK)

src/libAtomVM/opcodesswitch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7181,10 +7181,12 @@ HOT_FUNC int scheduler_entry_point(GlobalContext *glb)
71817181
}
71827182
}
71837183

7184+
#ifdef AVM_PRINT_PROCESS_CRASH_DUMPS
71847185
// Do not print crash dump if reason is normal or shutdown.
71857186
if (x_regs[0] != LOWERCASE_EXIT_ATOM || (x_regs[1] != NORMAL_ATOM && x_regs[1] != SHUTDOWN_ATOM)) {
71867187
context_dump(ctx);
71877188
}
7189+
#endif
71887190

71897191
if (x_regs[0] == LOWERCASE_EXIT_ATOM) {
71907192
ctx->exit_reason = x_regs[1];

0 commit comments

Comments
 (0)