Emacs and pdb after upgrading to Ubuntu Feisty

R. Bernstein rocky at panix.com
Sun May 6 20:37:52 EDT 2007


levander <levander404 at gmail.com> writes:

> I've been using pdb under emacs on an Ubuntu box to debug python
> programs.  I just upgraded from Ubuntu Edgy to Feisty and this combo
> has stopped working.  Python is at 2.5.1 now, and emacs is at 21.41.1.

If I had to take a guess the big change would be in Python 2.5.1 and
the Emacs pdb package has not kept up with that. Edgy was running
Python 2.4.x. The emacs version is about the same. (And I agree with
Alexander Schmolck that emacs 23 alpha is much much nicer).

If you were to report a problem, my guess then would be the Debian
maintainer for the Emacs pdb package. More info below.

> It used to be I could just "M-x pdb RET pdb <script-name> RET" and be
> presented with a prompt where I could debug my script, as well as an
> arrow in another source code buffer indicating where I am in the
> source code.
> 
> Now however, when I do "M-x pdb RET pdb ~/grabbers/npr-grabber.py -s
> WESUN", I get this is in a buffer called *gud*:
> 
> Current directory is /home/levander/grabbers/
> 
> No prompt or anything follows it, just that one line.  It doesn't pop
> up an arrow in the other buffer either.  None of the regular commands
> like 'n', 's', or 'l' do anything here.  So, I did a 'Ctrl-C' and got:
> 
> > /home/levander/grabbers/npr-grabber.py(24)<module>()
> -> """
> (Pdb) > /home/levander/grabbers/npr-grabber.py(30)<module>()
> -> import getopt
> (Pdb) Traceback (most recent call last):
>   File "/usr/bin/pdb", line 1213, in main
>     pdb._runscript(mainpyfile)
>   File "/usr/bin/pdb", line 1138, in _runscript
>     self.run(statement, globals=globals_, locals=locals_)
>   File "bdb.py", line 366, in run
>     exec cmd in globals, locals
>   File "<string>", line 1, in <module>
>   File "/home/levander/grabbers/npr-grabber.py", line 30, in <module>
>     import getopt
>   File "/home/levander/grabbers/npr-grabber.py", line 30, in <module>
>     import getopt
>   File "bdb.py", line 48, in trace_dispatch
>     return self.dispatch_line(frame)
>   File "bdb.py", line 66, in dispatch_line
>     self.user_line(frame)
>   File "/usr/bin/pdb", line 144, in user_line
>     self.interaction(frame, None)
>   File "/usr/bin/pdb", line 187, in interaction
>     self.cmdloop()
>   File "cmd.py", line 130, in cmdloop
>     line = raw_input(self.prompt)
> KeyboardInterrupt
> Uncaught exception. Entering post mortem debugging
> Running 'cont' or 'step' will restart the program
> > /home/levander/grabbers/cmd.py(151)cmdloop()
> -> pass
> (Pdb)
> 
> It's wierd because at the bottom of that call stack, it does look like
> it's wating for input, but no input works...  And, after I hit Ctrl-C
> I do get a prompt as you see at the bottom of that listing just
> above.  Now I type "quit" and get:

Yes, it looks like it is in its input look reading debugger commands.
If you've tried commands that produce output (e.g. "list", "where",
"print") and you are getting nothing then, yes, that's weird.  Emacs
however will gobble up and hide what it thinks is location information
from the debugger. So if you were running "step" or "next" or
"continue" I could see how output would be disappearing. 

In any event a guess for some of the problem is that the Emacs isn't
parsing the output correctly.

I've noticed subtle changes in reporting the where you are between
Python 2.4 and 2.5 such as giving a module name when that's known. The
emacs regular expressions no doubt haven't been updated for knowing
this and matching the location is and probably needs to be a little
bit fussy.

> 
> Post mortem debugger finished. The /home/cponder/grabbers/npr-
> grabber.py will be restarted
> 
> Anybody can tell me who to get pdb working under emacs on Ubuntu
> Feisty?

I haven't tried pdb, but another Alex, Oleksandr Moskale, has a Debian
package for pydb which gets filtered down to Edgy and Feisty, and I've
used that and it works. ;-) And it also works with ipython in the way
that 'as mentioned too.



More information about the Python-list mailing list