[merge] Control-backspace to drop into the debugger

Martin Pool mbp at sourcefrog.net
Wed Apr 18 01:22:11 BST 2007


On 4/17/07, John Arbash Meinel <john at arbash-meinel.com> wrote:
> I think Robert brings up a good idea of at least being able to disable
> this with an env var. Maybe "BZR_SIGQUIT_EXITS" versus
> "BZR_SIGQUIT_DEBUGS". (If we wanted just a knob to disable it, or enable
> it respectively)

OK, I'll add a variable.  I do think it's reasonable to have it on by
default though.

As I said above, if you really just want it to quit then pressing C-\
twice will do it now.

> v- I think this is just 2007 (unless you started on it last year :)
> > +# Copyright (C) 2006, 2007 Canonical Ltd

I did actually, I just had it hanging around in another branch for a long time.
> -- Docstring and 2 blank spaces for the module, and a small docstring
> for the _debug() function, please.

OK

>
> > +
> > +def _debug(signal_number, interrupted_frame):
> > +    import pdb
> > +    import sys
> > +    sys.stderr.write("** SIGQUIT received, entering debugger\n"
> > +            "** Type 'c' to continue or 'q' to stop the process\n")
> > +    pdb.set_trace()
> > +
>
> ^- Is there a way to make sure 'pdb' is running in the original frame,
> rather than running in the _debug() frame? (it may be the case already,
> I haven't actually tried this)

I looked but couldn't see a way.  You can invoke pdb on a traceback
but then it's just in postmortem mode.  The good thing about set_trace
is that you can then continue the program.
> pdb doesn't attach to the terminal? (It only attaches to stdin/stdout?)
> Interesting.

Yes, it does, fortunately for me trying to test it. :-)

-- 
Martin



More information about the bazaar mailing list