X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=debug%2Fb43-fwdump;h=a24c61466d83195c590e3ca0ad74b72da0697ee0;hb=b88078e7a07ef6a20f9b8aa2347e7bc1de748023;hp=24f1f0d23d8e99cbb60b24eb7180e0eec93ee100;hpb=8dc01d7b658dc04c5c500640854c6dba547a3118;p=b43-tools.git diff --git a/debug/b43-fwdump b/debug/b43-fwdump index 24f1f0d..a24c614 100755 --- a/debug/b43-fwdump +++ b/debug/b43-fwdump @@ -2,7 +2,7 @@ """ # b43 firmware state dumper # -# Copyright (C) 2008 Michael Buesch +# Copyright (C) 2008 Michael Buesch # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 @@ -21,12 +21,13 @@ import getopt from libb43 import * from sys import stdout from tempfile import * +import re def usage(): print "b43 firmware state dumper" print "" - print "Copyright (C) 2008 Michael Buesch " + print "Copyright (C) 2008 Michael Buesch " print "Licensed under the GNU/GPL version 3" print "" print "Usage: b43-fwdump [OPTIONS]" @@ -91,21 +92,28 @@ def dump_regs(prefix, regs): stdout.write("\n") return +def dasmLineIsPC(line, pc): + m = re.match(r'.*/\*\s+([0-9a-fA-F]+)\s+\*/.*', line, re.DOTALL) + if not m: + return False + linePC = int(m.group(1), 16) + return pc == linePC + def makeShortDump(dasm, pc): dasm = dasm.splitlines() i = 0 for line in dasm: - if "/* %03X */" % pc in line: + if dasmLineIsPC(line, pc): break i += 1 - if i >= len(dasm): + else: return "" ret = "" pos = max(i - 8, 0) end = min(i + 8, len(dasm) - 1) while pos != end: ret += dasm[pos] - if "/* %03X */" % pc in dasm[pos]: + if dasmLineIsPC(dasm[pos], pc): ret += "\t\t<<<<<<<<<<<" ret += "\n" pos += 1