From: Ben Pfaff Date: Thu, 16 Sep 2004 00:53:41 +0000 (+0000) Subject: backtrace utility X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9aba44b7bb4e200639d73adaa347d8eabd0a1f11;p=pintos-anon backtrace utility --- diff --git a/src/utils/backtrace b/src/utils/backtrace new file mode 100755 index 0000000..18ff195 --- /dev/null +++ b/src/utils/backtrace @@ -0,0 +1,19 @@ +#! /usr/bin/perl +$a2l = search_path ("i386-elf-addr2line") || search_path ("addr2line"); +$bin = shift @ARGV; +open (A2L, "$a2l -fe $bin " . join (' ', @ARGV) . "|"); +while ($function = ) { + $line = ; + chomp $function; + chomp $line; + print "$function ($line)\n"; +} + +sub search_path { + my ($target) = @_; + for $dir (split (':', $ENV{PATH})) { + my ($file = "$dir/$target"; + return $file if -e $file; + } + return 0; +}