Skip to content

expose globals in bpdb debugging #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
toejough opened this issue Nov 1, 2017 · 1 comment · Fixed by #728
Closed

expose globals in bpdb debugging #713

toejough opened this issue Nov 1, 2017 · 1 comment · Fixed by #728
Assignees

Comments

@toejough
Copy link
Contributor

toejough commented Nov 1, 2017

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.

toejough added a commit to toejough/bpython that referenced this issue Feb 7, 2018
@ikanobori
Copy link
Contributor

Good idea, thanks for the PR I will likely merge it tomorrow unless I think of something overnight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants