From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Liang Wang Newsgroups: gmane.emacs.devel Subject: No (gdb) prompt when assert Date: Tue, 21 Aug 2012 17:20:31 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1345540844 22896 80.91.229.3 (21 Aug 2012 09:20:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Aug 2012 09:20:44 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 21 11:20:45 2012 Return-path: Envelope-to: ged-emacs-devel@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 1T3kdb-00010S-E7 for ged-emacs-devel@m.gmane.org; Tue, 21 Aug 2012 11:20:39 +0200 Original-Received: from localhost ([::1]:34917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3kdZ-0002BS-MQ for ged-emacs-devel@m.gmane.org; Tue, 21 Aug 2012 05:20:37 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3kdW-0002BM-LU for emacs-devel@gnu.org; Tue, 21 Aug 2012 05:20:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3kdV-0007g3-C0 for emacs-devel@gnu.org; Tue, 21 Aug 2012 05:20:34 -0400 Original-Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:54711) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3kdV-0007fv-4D for emacs-devel@gnu.org; Tue, 21 Aug 2012 05:20:33 -0400 Original-Received: by lahd3 with SMTP id d3so3846760lah.0 for ; Tue, 21 Aug 2012 02:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=32z6zsNEWlZYmDmtDnMx4Cj2nOWvJWPjPcgIZvH5OzE=; b=B0MDVxJX+tsEnMJn+xZoCSaCIu7zp2xv5AbeyFyvzsfE6F5d9Qzm0GrFV5CjSoIBT+ 6dy/eAssU48lm6AOCfWqUxBYPowkNlcP9/DK+NC9C6HoUCJXlL3YRqmaSlRXDH/uiXL0 KDjXl8tWNneUpopXVME2ylBhVuG/RIuNlP8CAE58gGYeN8iiLngi8k47kGNDLxio50aa +nqUlOIFpjQJsGeaTMmnca81L05zAcaZmf0eNmGVxxTV6NpoI6Spnl9I+/bEIPX2CS8b y3+Vp8dJIRgANC/uQw+89eID3+6FzS08FmO3vpypgKtbuYjj391SsnAJwcCepxJD5x3e GXhg== Original-Received: by 10.112.41.161 with SMTP id g1mr4455941lbl.59.1345540831417; Tue, 21 Aug 2012 02:20:31 -0700 (PDT) Original-Received: by 10.114.67.211 with HTTP; Tue, 21 Aug 2012 02:20:31 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152706 Archived-At: Hi, With gdb MI in Emacs trunk, I lose (gdb) prompt frequently. One of test cases is after assertion happens. Here is what I do. 1. M-x gdb to start debugging 2. r RET to run and stop when assertion happens 3. R RET to restart debugging I almost always lost (gdb) prompt at step 3. Otherwise, it will happen if I keep press RET to restart. Test case is simple hello world. #include #include int main(int argc, char *argv[]) { printf ("hello, world.\n"); assert(0); return 0; } I am afraid that this problem is related to the usage of variable gdb-first-done-or-error. gdb-prompt-name, which holds string "(gdb) ", is concated into output when gdb-first-done-or-error is not nil in either gdb-done-or-error or gdb-stopped. Unfortunately, if gdb-done-or-error happens before gdb-stopped and gdb-prompt-name is not concated into output in gdb-done-or-error, it will not be concated in gdb-stopped. Here is the code in gdb-done-or-error, (when gdb-first-done-or-error (unless (or token-number gud-running no-proc) (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) (gdb-update no-proc) (setq gdb-first-done-or-error nil)) because of unless condition statement, it is possible that gdb-prompt-name is not concated into output. The following is the value of output-record-list in gud-gdbmi-marker-filter after (setq output-record-list (sort output-record-list 'gdb-car<)) is executed. You can see that gdb-done happens before gdb-stopped and token-number of gdb-done is "20". So the condition of unless is true, and gdb-prompt-name is not concated into output. Then, gud-gdbmi-marker-filter is set to nil. This cause gdb-stopped will not concat gdb-prompt-name either. ((0 gdb-ignored-notification "id=\"/lib/ld-linux.so.2\",target-name=\"/lib/ld-linux.so.2\",host-name=\"/lib/ld-linux.so.2\",symbols-loaded=\"0\",thread-group=\"i1\"" nil 141) (141 gdb-thread-selected "id=\"1\"" nil 165) (165 gdb-gdb nil nil 172) (172 gdb-done "20" "threads=[{id=\"1\",target-id=\"process 16445\",name=\"hello\",state=\"running\",core=\"3\"}],current-thread-id=\"1\"" 285) (285 gdb-gdb nil nil 292) (292 gdb-ignored-notification "id=\"/lib/i386-linux-gnu/libc.so.6\",target-name=\"/lib/i386-linux-gnu/libc.so.6\",host-name=\"/lib/i386-linux-gnu/libc.so.6\",symbols-loaded=\"0\",thread-group=\"i1\"" nil 466) (466 gdb-stopped "reason=\"signal-received\",signal-name=\"SIGABRT\",signal-meaning=\"Aborted\",frame={addr=\"0xb7fdd424\",func=\"__kernel_vsyscall\",args=[]},thread-id=\"1\",stopped-threads=[\"1\"],core=\"0\"" nil 651))