From 020acb4f10832d0c003f24272b75a95859d4188f Mon Sep 17 00:00:00 2001 From: Frans Kaashoek <kaashoek@mit.edu> Date: Thu, 23 Aug 2012 09:35:00 -0400 Subject: For the convenience of students --- printpcs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 printpcs (limited to 'printpcs') diff --git a/printpcs b/printpcs new file mode 100755 index 0000000..32b33cc --- /dev/null +++ b/printpcs @@ -0,0 +1,11 @@ +#!/bin/sh + +# Decode the symbols from a panic stack trace on stdin + +if which addr2line +then + p="addr2line" +else + p="i386-jos-elf-addr2line" +fi +echo grep '^ ' | $p -e kernel $* -- cgit v1.2.3 From 951b77f7eced2165312d5c12d6256e874dba10f8 Mon Sep 17 00:00:00 2001 From: Austin Clements <amdragon@mit.edu> Date: Fri, 24 Aug 2012 14:51:52 -0400 Subject: 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). --- printpcs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'printpcs') 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 "$@" -- cgit v1.2.3