Dump a disassembly. Optionally mark where the program counter is. @type disassembly: list of tuple( int, int, str, str ) @param disassembly: Disassembly dump as returned by L{Process.disassemble} or L{Thread.disassemble_around_pc}. @type pc: int
(disassembly, pc=None, bLowercase=True, bits=None)
| 1466 | # + It'd be very useful to show register contents for code at EIP |
| 1467 | @staticmethod |
| 1468 | def dump_code(disassembly, pc=None, bLowercase=True, bits=None): |
| 1469 | """ |
| 1470 | Dump a disassembly. Optionally mark where the program counter is. |
| 1471 | |
| 1472 | @type disassembly: list of tuple( int, int, str, str ) |
| 1473 | @param disassembly: Disassembly dump as returned by |
| 1474 | L{Process.disassemble} or L{Thread.disassemble_around_pc}. |
| 1475 | |
| 1476 | @type pc: int |
| 1477 | @param pc: (Optional) Program counter. |
| 1478 | |
| 1479 | @type bLowercase: bool |
| 1480 | @param bLowercase: (Optional) If C{True} convert the code to lowercase. |
| 1481 | |
| 1482 | @type bits: int |
| 1483 | @param bits: |
| 1484 | (Optional) Number of bits of the target architecture. |
| 1485 | The default is platform dependent. See: L{HexDump.address_size} |
| 1486 | |
| 1487 | @rtype: str |
| 1488 | @return: Text suitable for logging. |
| 1489 | """ |
| 1490 | if not disassembly: |
| 1491 | return "" |
| 1492 | table = Table(sep=" | ") |
| 1493 | for addr, size, code, dump in disassembly: |
| 1494 | if bLowercase: |
| 1495 | code = code.lower() |
| 1496 | if addr == pc: |
| 1497 | addr = " * %s" % HexDump.address(addr, bits) |
| 1498 | else: |
| 1499 | addr = " %s" % HexDump.address(addr, bits) |
| 1500 | table.addRow(addr, dump, code) |
| 1501 | table.justify(1, 1) |
| 1502 | return table.getOutput() |
| 1503 | |
| 1504 | @staticmethod |
| 1505 | def dump_code_line(disassembly_line, bShowAddress=True, bShowDump=True, bLowercase=True, dwDumpWidth=None, dwCodeWidth=None, bits=None): |