mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
feat: tools: add address parser
This commit is contained in:
parent
7757a174ce
commit
e3be1c56cd
17
tools/parse_backtrace.sh
Executable file
17
tools/parse_backtrace.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <ELF_FILE>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ELF_FILE=$1
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ PC:\ VirtAddr\((0x[0-9a-fA-F]+)\) ]]; then
|
||||
pc_address=${BASH_REMATCH[1]}
|
||||
pc_function_info=$(addr2line -Cfpe "$ELF_FILE" "$pc_address")
|
||||
line=$(echo "$line" | sed -E "s#FP: .*#$pc_function_info#")
|
||||
fi
|
||||
echo "$line"
|
||||
done
|
Loading…
Reference in New Issue
Block a user