all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Liang Wang <netcasper@gmail.com>
To: emacs-devel@gnu.org
Subject: No (gdb) prompt when assert
Date: Tue, 21 Aug 2012 17:20:31 +0800	[thread overview]
Message-ID: <CAO+NnCaSEvH6G2B-pnwDSKTFvR9MBfaR_fOpPX=0URv_w4BYPg@mail.gmail.com> (raw)

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 <stdio.h>
#include <assert.h>

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))



                 reply	other threads:[~2012-08-21  9:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAO+NnCaSEvH6G2B-pnwDSKTFvR9MBfaR_fOpPX=0URv_w4BYPg@mail.gmail.com' \
    --to=netcasper@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.