gdb_resolve.py
author Taras Glek <tglek@mozilla.com>
Mon, 24 May 2010 10:48:30 -0700
changeset 12 74e2f62fe64c
child 14 eccc037adef4
permissions -rw-r--r--
Got pagefault logging to associate symbols with page faults
import sys, tempfile

def read_log(filename):
    f = open(filename, 'r');
    for line in f:
        if line[0:7] == "-- p/a ":
            str_addr = line[7:]
            yield line[3:]
        else:
            yield "echo %s" % line
    
def gdb_log(output):
    os.unlink(output)
    cmds = ["set print symbol-filename on",
            "set logging redirect on", 
            "logging file %s" % output,
            "set logging on"]
    cmds.extend(read_log("/home/taras/work/startup/log.txt.html"))
    cmds.append("set logging off")
    for cmd in cmds:
        try:
            gdb.execute(cmd)
        except:
            None
    print "Saved log to %s" % output
    
#read_log(sys.argv[1], sys.argv[2])