-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8a84eb
commit 1fcddb3
Showing
4 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import sys | ||
import mips32emu.DbgEngine | ||
|
||
|
||
|
||
dbg = mips32emu.DbgEngine.DbgEngine() | ||
|
||
if len(sys.argv) >= 2: | ||
dbg.loadSystemMapFile(sys.argv[1]) | ||
else: | ||
raise Exception("function trace requires a system.map file") | ||
|
||
pfn = "" | ||
while 1: | ||
dbg.step() | ||
pc = dbg.readReg("PC") | ||
fn = dbg.getFunctionName(pc) | ||
if fn != pfn: | ||
print(fn) | ||
pfn = fn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,16 @@ | ||
import sys | ||
import time | ||
import mips32emu.DbgEngine | ||
import re | ||
|
||
|
||
|
||
lookup = {} | ||
|
||
def getFunctionName(pc): | ||
distance = 0xffffffff | ||
ret = "???" | ||
for k in lookup.keys(): | ||
diff = pc - k | ||
if diff < distance and diff >= 0: | ||
distance = diff | ||
ret = lookup[k] | ||
return ret | ||
|
||
if len(sys.argv) == 2: | ||
for line in open(sys.argv[1]): | ||
fields = line.split(" ") | ||
addr = int(fields[0],16) | ||
fn = fields[2].strip() | ||
lookup[addr] = fn | ||
|
||
dbg = mips32emu.DbgEngine.DbgEngine() | ||
|
||
if len(sys.argv) >= 2: | ||
dbg.loadSystemMapFile(sys.argv[1]) | ||
|
||
|
||
while 1: | ||
time.sleep(1) | ||
pc = dbg.readReg("PC") | ||
print("PC: %08X (%s)"%(pc,lookup.get(pc,getFunctionName(pc)))) | ||
print("PC: %08X (%s)"%(pc,dbg.getFunctionName(pc))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters