forked from nanocurrency/nano-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
124421b
commit 2da08e1
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
set -uo pipefail | ||
|
||
# Enable core dumps | ||
ulimit -c unlimited | ||
echo '/tmp/core-%e.%p' | sudo tee /proc/sys/kernel/core_pattern | ||
|
||
source "$(dirname "$BASH_SOURCE")/common.sh" | ||
|
||
BUILD_DIR=${1-${PWD}} | ||
|
||
${BUILD_DIR}/core_test$(get_exec_extension) | ||
executable=${BUILD_DIR}/core_test$(get_exec_extension) | ||
./"${executable}" | ||
|
||
status=$? | ||
if [ $status -ne 0 ]; then | ||
echo "Test failed" | ||
|
||
# Print location of core dump loaded from the system config | ||
echo "Core dump location: $(cat /proc/sys/kernel/core_pattern)" | ||
|
||
# Find the most recent core dump. Adjust the pattern as needed. | ||
core_dump=$(find /tmp -name 'core-*' -exec ls -lt {} + | head -n 1) | ||
|
||
ls /tmp/ | ||
|
||
if [ -n "$core_dump" ]; then | ||
echo "Analyzing core dump: $core_dump" | ||
|
||
# Use gdb to print the backtrace from the core dump | ||
gdb -quiet -batch -ex "thread apply all bt full" -ex "quit" "${executable}" "${core_dump}" | ||
else | ||
echo "No core dump file found." | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters