mirror of
https://github.com/gunchev/home_bin.git
synced 2025-11-20 12:15:46 +00:00
Added bt_from_core.sh (backtrace from core dump file).
This commit is contained in:
parent
0fe8795d35
commit
de0c5b31d6
1 changed files with 23 additions and 0 deletions
23
bt_from_core.sh
Executable file
23
bt_from_core.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $(basename "$0") CORE_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
core_file="$1"
|
||||||
|
|
||||||
|
bin_file=$(file -- "$core_file" | sed "s/.*'\\([^']*\\)'.*/\1/g") # '
|
||||||
|
|
||||||
|
echo "=== $bin_file ========================"
|
||||||
|
# sed -n '/sweet/,$p' filename
|
||||||
|
#
|
||||||
|
# -n don't print lines by default
|
||||||
|
#
|
||||||
|
# /sweet/,$ is a restriction for the following command p, meaning 'only look from the first occurence of 'sweet' to '$' (the end of the file)
|
||||||
|
#
|
||||||
|
# p print
|
||||||
|
|
||||||
|
gdb --quiet "$bin_file" --core "$core_file" -ex bt -ex quit 2>&1 | sed -n '/^#0 /,$p'
|
||||||
|
|
||||||
|
echo "=== $bin_file ========================"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue