Skip to content

Commit 951b77f

Browse files
author
Austin Clements
committed
Various fixes and improvements to printpcs
Search for an addr2line that supports elf32-i386. Don't print the path of addr2line as a side-effect of which. Don't uselessly pipe "grep '^ '" to addr2line's stdin. Enable as many pretty-printing and otherwise helpful options as possible (this makes the output *much* more pleasant on modern addr2lines).
1 parent 020acb4 commit 951b77f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

printpcs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
#!/bin/sh
22

3-
# Decode the symbols from a panic stack trace on stdin
3+
# Decode the symbols from a panic EIP list
44

5-
if which addr2line
6-
then
7-
p="addr2line"
8-
else
9-
p="i386-jos-elf-addr2line"
10-
fi
11-
echo grep '^ ' | $p -e kernel $*
5+
# Find a working addr2line
6+
for p in i386-jos-elf-addr2line addr2line; do
7+
if which $p 2>&1 >/dev/null && \
8+
$p -h 2>&1 | grep -q '\belf32-i386\b'; then
9+
break
10+
fi
11+
done
12+
13+
# Enable as much pretty-printing as this addr2line can do
14+
$p $($p -h | grep ' -[aipsf] ' | awk '{print $1}') -e kernel "$@"

0 commit comments

Comments
 (0)