projects
/
b43-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
b43-fwdump: Disassembler fixups
[b43-tools.git]
/
debug
/
b43-fwdump
diff --git
a/debug/b43-fwdump
b/debug/b43-fwdump
index 24f1f0d23d8e99cbb60b24eb7180e0eec93ee100..6ac7aa0f01c6d8c7140555614a41f0a5e34ddd04 100755
(executable)
--- a/
debug/b43-fwdump
+++ b/
debug/b43-fwdump
@@
-21,6
+21,7
@@
import getopt
from libb43 import *
from sys import stdout
from tempfile import *
from libb43 import *
from sys import stdout
from tempfile import *
+import re
def usage():
def usage():
@@
-91,21
+92,28
@@
def dump_regs(prefix, regs):
stdout.write("\n")
return
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:
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
break
i += 1
-
if i >= len(dasm)
:
+
else
:
return "<Could not find PC in the binary>"
ret = ""
pos = max(i - 8, 0)
end = min(i + 8, len(dasm) - 1)
while pos != end:
ret += dasm[pos]
return "<Could not find PC in the binary>"
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
ret += "\t\t<<<<<<<<<<<"
ret += "\n"
pos += 1