summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2012-08-22 21:25:19 -0400
committerFrans Kaashoek <[email protected]>2012-08-22 21:25:19 -0400
commit6650cc934afa222bb729f63fbfe85aa15ebbd778 (patch)
treea4c5f05a9a24a1ee0e65862c5c65a3b82d349610
parent3fb7eceea7fb967d6d4567559f544f5742edae49 (diff)
downloadxv6-labs-6650cc934afa222bb729f63fbfe85aa15ebbd778.tar.gz
xv6-labs-6650cc934afa222bb729f63fbfe85aa15ebbd778.tar.bz2
xv6-labs-6650cc934afa222bb729f63fbfe85aa15ebbd778.zip
Use addr2line (or i386-jos-elf-addr2line, if you cross compile)
-rwxr-xr-xdepcs48
1 files changed, 0 insertions, 48 deletions
diff --git a/depcs b/depcs
deleted file mode 100755
index 6dfb888..0000000
--- a/depcs
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-# Decode a stack trace from getcallerpcs() to kernel symbols.
-# Peter H. Froehlich <[email protected]>, 600.318/418, Spring 2011
-#
-# $ ./depcs 1072fa 1073c4 106d4a 103024 102fdd 0 0 0 0 0
-# 1078010 ['mappages']
-# 1078212 ['setupkvm']
-# 1076554 ['kvmalloc']
-# 1060900 ['mainc']
-# 1060829 ['jmpkstack']
-
-import sys
-
-# read the symbols, mapping each address to all known names
-
-raw = {}
-with open("kernel.sym") as f:
- for s in f:
- adr, sym = s.strip().split()
- adr = int(adr, 16)
- if adr in raw:
- raw[adr].append(sym)
- else:
- raw[adr] = [sym]
-
-# for a given address, we need to determine what range it
-# lies in; there are fancy data structures or this, which
-# we ignore; let's just sort the keys instead
-
-sort = sorted(raw.keys())
-
-# now we can find the least key greater than an address;
-# if there's none, we use the last address we know; doh!
-
-def least(x):
- for i in range(len(sort)-1):
- if sort[i] <= x < sort[i+1]:
- return sort[i]
- return sort[-1]
-
-# therefore we can decode a backtrace (ignoring address
-# 0 since it's useless for xv6)
-
-for adr in sys.argv[1:]:
- adr = int(adr, 16)
- if adr != 0:
- print adr, raw[least(adr)]