Private method used when disassembling from process memory. It has no return value because the list is modified in place. On return all raw memory addresses are replaced by labels when possible. @type disasm: list of tuple(int, int, str, str) @param disasm
(self, disasm)
| 485 | __hexa_parameter = re.compile("0x[0-9A-Fa-f]+") |
| 486 | |
| 487 | def __fixup_labels(self, disasm): |
| 488 | """ |
| 489 | Private method used when disassembling from process memory. |
| 490 | |
| 491 | It has no return value because the list is modified in place. On return |
| 492 | all raw memory addresses are replaced by labels when possible. |
| 493 | |
| 494 | @type disasm: list of tuple(int, int, str, str) |
| 495 | @param disasm: Output of one of the dissassembly functions. |
| 496 | """ |
| 497 | for index in compat.xrange(len(disasm)): |
| 498 | (address, size, text, dump) = disasm[index] |
| 499 | m = self.__hexa_parameter.search(text) |
| 500 | while m: |
| 501 | s, e = m.span() |
| 502 | value = text[s:e] |
| 503 | try: |
| 504 | label = self.get_label_at_address(int(value, 0x10)) |
| 505 | except Exception: |
| 506 | label = None |
| 507 | if label: |
| 508 | text = text[:s] + label + text[e:] |
| 509 | e = s + len(value) |
| 510 | m = self.__hexa_parameter.search(text, e) |
| 511 | disasm[index] = (address, size, text, dump) |
| 512 | |
| 513 | def disassemble_string(self, lpAddress, code): |
| 514 | """ |
no test coverage detected