Message392309
I've played around with a few formats, and what I've ended up with is this:
1. Use the >> marker for for exception targets, as well as normal branch targets.
2. Add a text version of the exception handler table at the end of the disassembly.
This has all the information, without too much visual clutter.
The function `f` above looks like this:
>>> dis.dis(f)
2 0 NOP
3 2 LOAD_CONST 1 (1)
4 LOAD_CONST 2 (0)
6 BINARY_TRUE_DIVIDE
8 POP_TOP
10 NOP
12 LOAD_CONST 0 (None)
14 RETURN_VALUE
>> 16 NOP
18 PUSH_EXC_INFO
4 20 POP_TOP
22 POP_TOP
24 POP_TOP
5 26 NOP
28 POP_EXCEPT
30 LOAD_CONST 3 ('fail')
32 RETURN_VALUE
>> 34 POP_EXCEPT_AND_RERAISE
ExceptionTable:
2 to 8 -> 16 (depth 0)
18 to 24 -> 34 (depth 3) lasti
The 'lasti' field indicates that the offset of the last instruction is pushed to the stack, which is needed for cleanup-then-reraise code. |
|
Date |
User |
Action |
Args |
2021-04-29 13:53:50 | Mark.Shannon | set | recipients:
+ Mark.Shannon, gvanrossum, rhettinger, chris.jerdonek, serhiy.storchaka, Guido.van.Rossum, corona10, erlendaasland, Yonatan Goldschmidt, hauntsaninja |
2021-04-29 13:53:50 | Mark.Shannon | set | messageid: <1619704430.69.0.926614673722.issue40222@roundup.psfhosted.org> |
2021-04-29 13:53:50 | Mark.Shannon | link | issue40222 messages |
2021-04-29 13:53:50 | Mark.Shannon | create | |
|