From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sergio Durigan Junior Newsgroups: gmane.emacs.bugs Subject: bug#14847: 24.1; gdb-mi.el does not handle backslashes as quotes Date: Fri, 12 Jul 2013 12:51:24 -0300 Message-ID: <87k3kvzshv.fsf@riseup.net> References: <87r4f4qvuv.fsf@riseup.net> <83hag05fhi.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1373644331 28085 80.91.229.3 (12 Jul 2013 15:52:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Jul 2013 15:52:11 +0000 (UTC) Cc: 14847@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 12 17:52:12 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uxfdk-00024I-23 for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2013 17:52:12 +0200 Original-Received: from localhost ([::1]:49187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxfdj-0001Ke-Ib for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Jul 2013 11:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxfdd-0001HD-1K for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2013 11:52:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uxfda-0001Qd-9B for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2013 11:52:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uxfda-0001QS-5t for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2013 11:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UxfdZ-0005NB-SO for bug-gnu-emacs@gnu.org; Fri, 12 Jul 2013 11:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Sergio Durigan Junior Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Jul 2013 15:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14847 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14847-submit@debbugs.gnu.org id=B14847.137364429320605 (code B ref 14847); Fri, 12 Jul 2013 15:52:01 +0000 Original-Received: (at 14847) by debbugs.gnu.org; 12 Jul 2013 15:51:33 +0000 Original-Received: from localhost ([127.0.0.1]:50680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uxfd6-0005MG-8g for submit@debbugs.gnu.org; Fri, 12 Jul 2013 11:51:32 -0400 Original-Received: from mx1.riseup.net ([198.252.153.129]:43565) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uxfd4-0005M7-C3 for 14847@debbugs.gnu.org; Fri, 12 Jul 2013 11:51:31 -0400 Original-Received: from fulvetta.riseup.net (fulvetta-pn.riseup.net [10.0.1.75]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Gandi Standard SSL CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id C02BD4A958; Fri, 12 Jul 2013 08:51:28 -0700 (PDT) Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sergiodj@fulvetta.riseup.net) with ESMTPSA id 5AB451C2 X-URL: http://sergiodj.net/blog In-Reply-To: <83hag05fhi.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 12 Jul 2013 11:50:33 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) X-Virus-Scanned: clamav-milter 0.97.8 at mx1 X-Virus-Status: Clean X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76285 Archived-At: On Friday, July 12 2013, Eli Zaretskii wrote: > Your patch doesn't seem to work for me. I tried on GNU/Linux and on > MS-Windows, and in both cases I get the same error. Here's the recipe > I tried (after applying your latest patch and rebuilding Emacs): > > emacs -Q > M-x gdb RET > gdb -i=mi ./src/emacs RET > (gdb) break main > (gdb) run \ > -Q > > When I type RET after "-Q", I get an error: > > Undefined MI command: Q > > What am I doing wrong? Hi Eli, Thanks for testing! You're doing nothing wrong, the patch is the culprit. `gdb-send' checks for commands starting with "-", but this check should be disabled when a command is being continued. Could you please try the following version? Thanks, -- Sergio diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 2c4d6a0..10472ec 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -1759,6 +1759,9 @@ static char *magick[] = { As long as GDB is in the recursive reading loop, it does not expect commands to be prefixed by \"-interpreter-exec console\".") +(defun gdb-strip-string-backslash (string) + (replace-regexp-in-string "\\\\$" "" string)) + (defun gdb-send (proc string) "A comint send filter for gdb." (with-current-buffer gud-comint-buffer @@ -1766,10 +1769,15 @@ commands to be prefixed by \"-interpreter-exec console\".") (remove-text-properties (point-min) (point-max) '(face)))) ;; mimic key to repeat previous command in GDB (if (not (string= "" string)) - (setq gdb-last-command string) - (if gdb-last-command (setq string gdb-last-command))) - (if (or (string-match "^-" string) - (> gdb-control-level 0)) + (if gdb-continuation + (setq gdb-last-command (concat gdb-continuation + (gdb-strip-string-backslash string) + " ")) + (setq gdb-last-command (gdb-strip-string-backslash string))) + (if gdb-last-command (setq string gdb-last-command)) + (setq gdb-continuation nil)) + (if (and (not gdb-continuation) (or (string-match "^-" string) + (> gdb-control-level 0))) ;; Either MI command or we are feeding GDB's recursive reading loop. (progn (setq gdb-first-done-or-error t) @@ -1779,10 +1787,13 @@ commands to be prefixed by \"-interpreter-exec console\".") (setq gdb-control-level (1- gdb-control-level)))) ;; CLI command (if (string-match "\\\\$" string) - (setq gdb-continuation (concat gdb-continuation string "\n")) + (setq gdb-continuation + (concat gdb-continuation (gdb-strip-string-backslash + string) + " ")) (setq gdb-first-done-or-error t) (let ((to-send (concat "-interpreter-exec console " - (gdb-mi-quote string) + (gdb-mi-quote (concat gdb-continuation string " ")) "\n"))) (if gdb-enable-debug (push (cons 'mi-send to-send) gdb-debug-log))