Skip to content

expose globals in bpdb debugging #713

Closed
@toejough

Description

@toejough

I love bpython!

I haven't dived into the codebase too deeply, but would it be easy to expose the globals when performing post-mortem debugging? Right now I can only access the locals in the bpython debugger - to interact with the globals (for instance, debugging functions I might have defined in the same module as the function the pm debugging is in), I have to drop out of bpdb, losing all of it's benefits.

def debug():
    print('global debugging!')

def broken():
    def internal_debug():
        print('local debugging!')
    do_bad_thing_here()  # pm debugging drops me here

in the above example, I can do >>> intern<tab>, and get internal_debug to complete and get its help, and run it, but if I try to do >>> debug()<enter> I get an error about the name "debug" not being defined.

I can do >>> exit() to get back to (BPdb) and then do (BPdb) debug()<enter> and debug is available and executes correctly.

I've found code that looks like it's only exposing the locals (

bpython.embed(self.curframe.f_locals, ['-i'])
), but I'm not sure how easy it is to make it expose the globals, too.

I'll circle back and investigate more, but on the chance someone else knows better or gets to a PR first, I figured I'd post this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions