mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
18 lines
323 B
Bash
Executable File
18 lines
323 B
Bash
Executable File
#!/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
|
|
addr=${BASH_REMATCH[1]}
|
|
func=$(addr2line -Cfpe "$ELF_FILE" "$addr")
|
|
line+=" $func"
|
|
fi
|
|
echo "$line"
|
|
done
|