projects
/
pintos-anon
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b4c4739
)
backtrace utility
author
Ben Pfaff
<blp@cs.stanford.edu>
Thu, 16 Sep 2004 00:53:41 +0000
(
00:53
+0000)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Thu, 16 Sep 2004 00:53:41 +0000
(
00:53
+0000)
src/utils/backtrace
[new file with mode: 0755]
patch
|
blob
diff --git a/src/utils/backtrace
b/src/utils/backtrace
new file mode 100755
(executable)
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 = <A2L>) {
+ $line = <A2L>;
+ 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;
+}