summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprintpcs19
1 files changed, 11 insertions, 8 deletions
diff --git a/printpcs b/printpcs
index 32b33cc..81d039b 100755
--- a/printpcs
+++ b/printpcs
@@ -1,11 +1,14 @@
#!/bin/sh
-# Decode the symbols from a panic stack trace on stdin
+# Decode the symbols from a panic EIP list
-if which addr2line
-then
- p="addr2line"
-else
- p="i386-jos-elf-addr2line"
-fi
-echo grep '^ ' | $p -e kernel $*
+# Find a working addr2line
+for p in i386-jos-elf-addr2line addr2line; do
+ if which $p 2>&1 >/dev/null && \
+ $p -h 2>&1 | grep -q '\belf32-i386\b'; then
+ break
+ fi
+done
+
+# Enable as much pretty-printing as this addr2line can do
+$p $($p -h | grep ' -[aipsf] ' | awk '{print $1}') -e kernel "$@"