GNU bug report logs - #13586
pdbtrack doesn't jump to the source file location on the first exception/set_trace() call

Previous Next

Package: emacs;

Reported by: Greg Novak <greg.novak <at> gmail.com>

Date: Tue, 29 Jan 2013 17:20:01 UTC

Severity: normal

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13586 in the body.
You can then email your comments to 13586 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13586; Package emacs. (Tue, 29 Jan 2013 17:20:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Greg Novak <greg.novak <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 29 Jan 2013 17:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Greg Novak <greg.novak <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: pdbtrack doesn't jump to the source file location on the first
	exception/set_trace() call
Date: Tue, 29 Jan 2013 17:37:30 +0100
[Message part 1 (text/plain, inline)]
I have attached a patch to fix this problem.

I am using the latest stable version of emacs 24.2.1, but with the version
of python.el written by Fabián E. Gallina from the latest development emacs
sources.

When running python or ipython under Emacs, when either an exception or a
call to pdb.set_trace() is encountered, pdbtrack doesn't immediately jump
to the appropriate line of the offending source file. In the case of
pdb.set_trace(), this is because a few extra lines of information are
printed involving the arguments of the present function (see below), and
the implementation of pdbtrack in python.el requires the stack information
to be on the first or second line of the most recent comint output. If I
type 'up', then 'down' to move between the stack frames, pdbtrack finds the
stack frame info and jumps to the source file as desired.

When using IPython, ipdb generally prints an entire stack trace, so it's
necessary to find the line corresponding to the _last_ stack frame printed.

I have attached a context diff of the change required to fix this behavior
so that pdbtrack immediately jumps to the desired source file, rather than
requiring me to type 'up' then 'down' to move between stack frames so that
one and only one stack frame is printed.

Below is an example of extra information printed when python encounters a
call to pdb.set_trace().  pdbtrack requires the stack frame to be on the
first or second line, but in this case the first and second lines are '1.1'
and '--Return--'  (The code in question is not printing anything to stdout).

>>> mg.jey()
1.1
--Return--
> /Users/novak/Projects/gsnpy/mg.py(17)gsn()->None
-> pdb.set_trace()
(Pdb) up
[Message part 2 (text/html, inline)]
[python.el.diff (application/octet-stream, attachment)]

Added tag(s) patch. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 09 Sep 2019 02:52:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13586; Package emacs. (Fri, 14 Aug 2020 12:31:02 GMT) Full text and rfc822 format available.

Message #10 received at 13586 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Greg Novak <greg.novak <at> gmail.com>
Cc: 13586 <at> debbugs.gnu.org
Subject: Re: bug#13586: pdbtrack doesn't jump to the source file location on
 the first exception/set_trace() call
Date: Fri, 14 Aug 2020 14:30:35 +0200
Greg Novak <greg.novak <at> gmail.com> writes:

> !               ;; When the debugger encounters a pdb.set_trace()
> !               ;; command, it prints a single stack frame.  Sometimes
> !               ;; it prints a bit of extra information about the
> !               ;; arguments of the present function.  When ipdb
> !               ;; encounters an exception, it prints the _entire_ stack
> !               ;; trace.  To handle all of these cases, we want to find
> !               ;; the _last_ stack frame printed in the most recent
> !               ;; batch of output, then jump to the corrsponding
> !               ;; file/line number.
> !               (goto-char (point-max))
> !               (when (re-search-backward python-pdbtrack-stacktrace-info-regexp nil t)
>                   (setq line-number (string-to-number
>                                      (match-string-no-properties 2)))
>                   (match-string-no-properties 1)))))

commit 6ff930c3d206417e4cec9429fa5d71bb5c9af541
Author:     Fabián Ezequiel Gallina <fgallina <at> gnu.org>
AuthorDate: Wed Jan 30 12:02:58 2013 -0300
Commit:     Fabián Ezequiel Gallina <fgallina <at> gnu.org>
CommitDate: Wed Jan 30 12:02:58 2013 -0300

    * progmodes/python.el
    (python-pdbtrack-comint-output-filter-function): Enhancements on
    stacktrace detection.  (thanks @gnovak)

I looks like this was applied (with some changes) at the time, but this
bug report wasn't closed, so I'm doing that now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 13586 <at> debbugs.gnu.org and Greg Novak <greg.novak <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 14 Aug 2020 12:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 12 Sep 2020 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 337 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.