Subject: Re: 23.1; pdbtrack isn't parsing valid pdb output or creating an interactive debugging buffer (python.el)

From: Jeremy Whitlock <[email-masked]>
Date: Fri, 9 Apr 2010 19:11:49 -0600

Attached is a patch that fixes this issue.  Basically, Python (pdb) is passing strings to Emacs with ^M in them.  My patch, attached and pasted in this email just in case, strip the carriage return from the string and after that, pdb starts working as expected.  Here is the patch, generated from "git format-patch":

From 375d82016d8bd518603c909b651de16fa1b31b1f Mon Sep 17 00:00:00 2001
From: Jeremy Whitlock <[email-masked]>
Date: Fri, 9 Apr 2010 18:33:15 -0600
Subject: [PATCH] Fixes problem in pdb where no prompt is ever displayed.  (Issue 5653)

Python's pdb was outputing strings with the carriage return in them and the
gud pdb regexps were not matching them.  This commit removes the carriage
returns and fixes pdb support.
---
 lisp/progmodes/gud.el |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index da38a08..652a843 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -1575,7 +1575,10 @@ and source-file directory for your debugger."
 ;; beginning of a marker, we save it here between calls to the
 ;; filter.
 (defun gud-pdb-marker-filter (string)
-  (setq gud-marker-acc (concat gud-marker-acc string))
+  ;; Remove \r character from pdb output
+  (setq tstring (replace-regexp-in-string "\r" "" string))
+
+  (setq gud-marker-acc (concat gud-marker-acc tstring))
   (let ((output ""))
 
     ;; Process all the complete markers in this chunk.
-- 
1.6.5.3

I wouldn't be surprised if my lisp could be done a different way but I can confirm that this does fix the issue.

Take care,
-----------------------------------------------------------------------------
Jeremy Whitlock | Software Engineer | CollabNet, Inc.
8000 Marina Blvd. Suite 600 | Brisbane, CA 94005 | USA
O 650.228.2516 | C 970.430.5295 | [email-masked]