Message392309
| Author |
Mark.Shannon |
| Recipients |
Guido.van.Rossum, Mark.Shannon, Yonatan Goldschmidt, chris.jerdonek, corona10, erlendaasland, gvanrossum, hauntsaninja, rhettinger, serhiy.storchaka |
| Date |
2021年04月29日.13:53:50 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1619704430.69.0.926614673722.issue40222@roundup.psfhosted.org> |
| In-reply-to |
| Content |
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. |
|