From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Dzhus Newsgroups: gmane.emacs.bugs Subject: bug#3845: Several other problems in gdb-mi [RE: bug#3794: Error in json from gdb-ui] Date: Tue, 14 Jul 2009 17:46:28 +0400 Message-ID: <87zlb71iob.fsf@sphinx.net.ru> References: <87r5wosm7m.fsf@sphinx.net.ru> Reply-To: Dmitry Dzhus , 3845@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1247579873 12204 80.91.229.12 (14 Jul 2009 13:57:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jul 2009 13:57:53 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, 3794@emacsbugs.donarmstrong.com, dima@sphinx.net.ru To: Herbert Euler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 14 15:57:45 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MQiVs-0005YS-7Z for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Jul 2009 15:57:44 +0200 Original-Received: from localhost ([127.0.0.1]:40707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQiVr-00053P-Oe for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Jul 2009 09:57:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQiVm-00052z-0W for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:57:38 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQiVg-00051v-G7 for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:57:36 -0400 Original-Received: from [199.232.76.173] (port=60555 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQiVg-00051r-Ab for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:57:32 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:37654) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MQiVf-00011X-6g for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:57:31 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6EDvScJ031844; Tue, 14 Jul 2009 06:57:28 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n6EDt6Qf031192; Tue, 14 Jul 2009 06:55:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Dmitry Dzhus Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 14 Jul 2009 13:55:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3845 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.124757924430137 (code B ref -1); Tue, 14 Jul 2009 13:55:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 14 Jul 2009 13:47:24 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n6EDlJ9l030132 for ; Tue, 14 Jul 2009 06:47:20 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQiLn-0002gD-5q for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:47:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQiLg-0002df-VB for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:47:18 -0400 Original-Received: from [199.232.76.173] (port=59850 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQiLg-0002db-Jp for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:47:12 -0400 Original-Received: from sphinx.net.ru ([82.146.58.194]:60241) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MQiLf-0006yD-V1 for bug-gnu-emacs@gnu.org; Tue, 14 Jul 2009 09:47:12 -0400 Original-Received: from blizzard (93-81-184-65.broadband.corbina.ru [93.81.184.65]) (authenticated bits=0) by sphinx.net.ru (8.14.3/8.14.2) with ESMTP id n6EDkrmn074809; Tue, 14 Jul 2009 17:46:54 +0400 (MSD) (envelope-from dima@sphinx.net.ru) In-Reply-To: (Herbert Euler's message of "Tue, 14 Jul 2009 09:58:51 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Tue, 14 Jul 2009 09:57:36 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:29404 Archived-At: --=-=-= Herbert Euler wrote: >> > I tried M-x gdb to run emacs under gdb. The command line was >> > >> > gdb -i=mi ~/src/emacs/src/emacs >> > >> > and I got the error '(json-object-format ":" 44). Here is the backtrace: >> >> I could reproduce your problem and I wrote a workaround which fixes the >> bug for me. Could you please try the attached patch for gdb-mi.el? > > That patch works for me, too. Thanks. It's in the trunk now. > 2. The command "shell" is broken: In M-x gdb, > > shell ps aux | grep emacs > > results in no output; but in a "real" gdb, the output looks like this: > > shell ps aux | grep emacs > &"shell ps aux | grep emacs\n" > xgp 4886 1.3 0.1 80796 25900 pts/1 T 09:38 0:08 emacs > xgp 4936 0.3 0.1 77688 22568 pts/10 T+ 09:39 0:02 ./emacs > xgp 5209 0.0 0.1 28128 16548 pts/6 Ss+ 09:46 0:00 /usr/local/bin/gdb -i=mi emacs > xgp 5353 0.4 0.1 28184 16584 pts/1 S+ 09:49 0:00 gdb -i=mi emacs > xgp 5354 0.0 0.0 52800 976 pts/1 S+ 09:49 0:00 bash -c ps aux | grep emacs > xgp 5356 0.0 0.0 51124 688 pts/1 S+ 09:49 0:00 grep emacs > ^done Output of GDB's shell command goes as is straight to the terminal without being prefixed by stream identifier (~, @, & etc.) Thus it's harder to distinguish where this output should go (to GUD buffer, to MI parser etc.) I managed to produce a small patch which does the trick for simple shell commands like yours, but don't expect it to work with `top(1)` for example. I've attached the patch. Let me know if you notice that it breaks something. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gdb-shell.patch Content-Description: Print shell command output in GUD buffer (gdbmi-record-list, gdb-shell): Redirect shell command output to GUD buffer (Emacs bug #3794) diff -r 3ba511c84066 gdb-mi.el --- a/gdb-mi.el +++ b/gdb-mi.el @@ -1418,7 +1418,8 @@ (gdb-stopped . "\\*stopped,?\\(.*?\n\\)") (gdb-running . "\\*running,\\(.*?\n\\)") (gdb-thread-created . "=thread-created,\\(.*?\n\\)") - (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)"))) + (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)") + (gdb-shell . "\\(\\(?:^.+\n\\)+\\)"))) (defun gud-gdbmi-marker-filter (string) "Filter GDB/MI output." @@ -1476,7 +1477,10 @@ gdb-filter-output)) (defun gdb-gdb (output-field)) - +(defun gdb-shell (output-field) + (let ((gdb-output-sink gdb-output-sink)) + (setq gdb-filter-output + (concat output-field gdb-filter-output)))) ;; gdb-invalidate-threads is defined to accept 'update-threads signal (defun gdb-thread-created (output-field)) (defun gdb-thread-exited (output-field) --=-=-= > 3. Previously, typing directly RET at the M-x gdb prompt repeats the > last command in history. This is also what a "real" gdb does. But in > the new implementation, this does nothing now. I've fixed the code which mimicks RET behaviour for GUD buffer. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gdb-send-ret.patch Content-Description: Repeat last command on RET properly (gdb-send): Repeat last command on RET properly (Emacs bug #3794). diff -r b45e93199252 gdb-mi.el --- a/gdb-mi.el +++ b/gdb-mi.el @@ -1267,7 +1267,7 @@ (let ((inhibit-read-only t)) (remove-text-properties (point-min) (point-max) '(face)))) ;; mimic key to repeat previous command in GDB - (if (not (string-match "^\\s+$" string)) + (if (not (string= "" string)) (setq gdb-last-command string) (if gdb-last-command (setq string gdb-last-command))) (if gdb-enable-debug --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > As Nick said, this implementation is still in developing. Should I > wait then? It's GSoC project, see http://emacswiki.org/emacs/GDB-MI/ for some details. Don't wait, report bugs of Emacs trunk version as soon as you encounter them, but _please_ file *different* reports for different bugs. I first put really bleeding changes to my Mercurial repo, then commit them to Emacs upstream for further testing. Non-stop debugging support will hit the trunk by the end of this week. --=20 Happy Hacking. http://sphinx.net.ru =E3=82=80 --=-=-=--