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
3107540
commit 63a09b4
Showing
3 changed files
with
42 additions
and
16 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
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
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,18 +1,32 @@ | ||
# Print location of core dump loaded from the system config | ||
echo "Core dump location: $(cat /proc/sys/kernel/core_pattern)" | ||
#!/bin/bash | ||
set -uo pipefail | ||
|
||
echo "Analyzing core dumps..." | ||
echo "Core dump location: ${COREDUMP_DIR}" | ||
echo "Executable: ${EXECUTABLE}" | ||
|
||
# List core dump files | ||
echo "Core dump files:" | ||
ls -al "${CORE_DIR}" | ||
echo "::group::Core dump files" | ||
ls -al "${COREDUMP_DIR}" | ||
echo "::endgroup::" | ||
|
||
# Use a glob pattern to match core dumps, sorted by modification time | ||
shopt -s nullglob | ||
core_dumps=("${COREDUMP_DIR}"/core*) | ||
|
||
if [ ${#core_dumps[@]} -gt 0 ]; then | ||
# Sort the core dumps by modification time | ||
IFS=$'\n' core_dumps=($(sort -r <<<"${core_dumps[*]}")) | ||
unset IFS | ||
|
||
# Find the most recent core dump | ||
core_dump=$(find "${CORE_DIR}" -name 'coredump-*' -printf "%T+ %p\n" | sort -r | head -n 1 | cut -d" " -f2-) | ||
for core_dump in "${core_dumps[@]}"; do | ||
echo "::group::Analyzing core dump: $core_dump" | ||
|
||
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" | ||
|
||
# Use gdb to print the backtrace from the core dump | ||
gdb -quiet -batch -ex "thread apply all bt full" -ex "quit" "${executable}" "${core_dump}" | ||
echo "::endgroup::" | ||
done | ||
else | ||
echo "No core dump file found." | ||
fi | ||
fi |