Skip to content

Introduces more interactive command for PDB  #126785

Open
@wenqiny

Description

@wenqiny

Feature or enhancement

Proposal:

Hi Guys!

In the current pdb interactive command list, there is only up and down command for switching the frame, but it's really inflexibility when we meet a very depth stack, we may have to count how many number of stack we would like to up or down

Under such a background, I proposed here to introduce a new command like frame (just like what it did in GDB) to switch the current frame with the frame index came from the bt command.

A case like:

def a():
    breakpoint()
    print("a")

def b():
    a()
    print("b")

def c():
    
    b()
    print("c")

if __name__ == "__main__":
    c()

We could see some workflow like:

> /home/wenqin/work/my-python/script/nested-stack.py(4)a()
-> breakpoint()
(Pdb) bt
#0   /home/wenqin/work/my-python/script/nested-stack.py(17)<module>()
-> c()
#1   /home/wenqin/work/my-python/script/nested-stack.py(13)c()
-> b()
#2   /home/wenqin/work/my-python/script/nested-stack.py(8)b()
-> a()
#3 > /home/wenqin/work/my-python/script/nested-stack.py(4)a()
-> breakpoint()
(Pdb) f 1
> /home/wenqin/work/my-python/script/nested-stack.py(13)c()
-> b()
(Pdb) bt
#0   /home/wenqin/work/my-python/script/nested-stack.py(17)<module>()
-> c()
#1 > /home/wenqin/work/my-python/script/nested-stack.py(13)c()
-> b()
#2   /home/wenqin/work/my-python/script/nested-stack.py(8)b()
-> a()
#3   /home/wenqin/work/my-python/script/nested-stack.py(4)a()
-> breakpoint()

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions