Skip to content

1.2.0

Compare
Choose a tag to compare
@rocky rocky released this 28 Jun 03:40
· 389 commits to master since this release

disasesmbly via xdis now supports "extended" assembly listing which is new. Use that by default.

Commands have been gone over to be DRYer and use a more modern style of imports.
Small bugs have been fixed in conjunction with going over the commands.

New/Changed commands:

  • set asmfmt will let you select between the different formats and
  • show asmfmt will show you what format is in effect
  • info lines shows more information about what lines can be breakpointed (have line number table offsets in code)
  • info offsets shows you what offsets can be breakpointed (start on a line-number table entry)
  • info line gives more information, i.e. offset info, for a given line.

Some changes were made to allow using from trepan-xpy. In particular we allow breakpoints by offset in addition to by line.

Examples of new/changed commands

$ trepan3k test/example/gcd.py 3 5
(/tmp/python3-trepan/test/example/gcd.py:2): <module>
-> 2 """Greatest Common Divisor
Evaluate unrecognized is on.
output set for terminal with escape sequences for a dark background
(trepan3k) info lines
Line - (fn, start offset) table for /tmp/python3-trepan/test/example/gcd.py
       2: <module> @0         19: check_args() @36     30: gcd() @0     40: <module> @28
      11: <module> @4         20: check_args() @68     31: gcd() @8     41: <module> @36
      13: <module> @12        21: check_args() @82     34: gcd() @18    43: <module> @42
      14: check_args() @0     22: check_args() @104    35: gcd() @26    44: <module> @60
      16: check_args() @14    23: check_args() @114    36: gcd() @30    45: <module> @84
      17: check_args() @22    24: check_args() @120    37: gcd() @50
      18: check_args() @34    26: <module> @20         38: gcd() @54

(trepan3k) info offset
Offset - line number table for /tmp/python3-trepan/test/example/gcd.py
    @   0:   2  @  12:  13  @  28:  40  @  42:  43  @  84:  45
    @   4:  11  @  20:  26  @  36:  41  @  60:  44

(trepan3k) info line
Line 2 of "gcd.py" starts at offset 0 of <module> and contains 2 instructions
(trepan3k) (trepan3k) disasm 1,20
Disassembly of <frame at 0x7f1c1715e040, file '/tmp/python3-trepan/test/example/gcd.py', line 2, code <module>>: to line 20
   2 -->     0 LOAD_CONST           ("Greatest Common Divisor\n\nSome characterstics of this program used for testing check_args() does\nnot have a 'return' statement.\n\ncheck_args() raises an uncaught exception when given the wrong number\nof parameters.\n\n")
             2 STORE_NAME           (__doc__)

  11         4 LOAD_CONST           (0)
             6 LOAD_CONST           (None)
             8 IMPORT_NAME          (sys)
            10 STORE_NAME           (sys)

  13        12 LOAD_CONST           (<code object check_args at 0x7f1c171cc870, file "/tmp/python3-trepan/test/example/gcd.py", line 13>)
            14 LOAD_CONST           ('check_args')
            16 MAKE_FUNCTION        ('check_args': 0 positional, 0 name and default)
            18 STORE_NAME           (check_args)

(trepan3k) set asmfmt extended-bytes
Assembly format style is extended-bytes
(trepan3k) disasm 1,20
Disassembly of <frame at 0x7f1c1715e040, file '/tmp/python3-trepan/test/example/gcd.py', line 2, code <module>>: to line 20
   2 -->     0 |64 00| LOAD_CONST           ("Greatest Common Divisor\n\nSome characterstics of this program used for testing check_args() does\nnot have a 'return' statement.\n\ncheck_args() raises an uncaught exception when given the wrong number\nof parameters.\n\n")
             2 |5a 00| STORE_NAME           (__doc__)

  11         4 |64 01| LOAD_CONST           (0)
             6 |64 02| LOAD_CONST           (None)
             8 |6c 01| IMPORT_NAME          (sys)
            10 |5a 01| STORE_NAME           (sys)

  13        12 |64 03| LOAD_CONST           (<code object check_args at 0x7f1c171cc870, file "/tmp/python3-trepan/test/example/gcd.py", line 13>)
            14 |64 04| LOAD_CONST           ('check_args')
            16 |84 00| MAKE_FUNCTION        ('check_args': 0 positional, 0 name and default)
            18 |5a 02| STORE_NAME           (check_args)

(trepan3k)