Feature or enhancement
Support instruction-level debugging in pdb
Pitch
pdb could provide a better debugging experience by supporting instruction level debugging. We already have most of the utilities but we need to put them together.
The new commands will be introduced: li(listinst), lli(longlistinst), si(stepinst) and ni(nextinst) (Another candidate would be dis, which is short for import dis; dis.dis()).
li and lli will list source file with the instructions.
(Pdb) lli
4 def f():
0 RESUME 0
5 a = [1, 2, 3]
2 BUILD_LIST 0
4 LOAD_CONST 1 ((1, 2, 3))
6 LIST_EXTEND 1
8 STORE_FAST 0 (a)
6 breakpoint()
10 LOAD_GLOBAL 1 (NULL + breakpoint)
20 CALL 0
30 POP_TOP
7 -> g(a)
32 LOAD_GLOBAL 3 (NULL + g)
42 LOAD_FAST 0 (a)
44 CALL 1
--> 54 POP_TOP
56 RETURN_CONST 0 (None)
si will step one instruction ahead and ni will stay in this frame. We have opcode event to support this.
> /home/gaogaotiantian/programs/mycpython/example.py(7)f()
-> g(a)
(Pdb) ni
> /home/gaogaotiantian/programs/mycpython/example.py(7)f()
-> g(a)
--> 42 LOAD_FAST 0 (a)
(Pdb) ni
> /home/gaogaotiantian/programs/mycpython/example.py(7)f()
-> g(a)
--> 44 CALL 1
(Pdb) si
--Call--
> /home/gaogaotiantian/programs/mycpython/example.py(1)g()
-> def g(x):
--> 0 RESUME 0
Previous discussion
Did not find any.
Linked PRs
Feature or enhancement
Support instruction-level debugging in pdb
liandllito display instructions with source codesiandnicommandPitch
pdbcould provide a better debugging experience by supporting instruction level debugging. We already have most of the utilities but we need to put them together.The new commands will be introduced:
li(listinst),lli(longlistinst),si(stepinst)andni(nextinst)(Another candidate would bedis, which is short forimport dis; dis.dis()).liandlliwill list source file with the instructions.siwill step one instruction ahead andniwill stay in this frame. We haveopcodeevent to support this.Previous discussion
Did not find any.
Linked PRs