[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No (gdb) prompt when assert

From: Liang Wang
Subject: No (gdb) prompt when assert
Date: Tue, 21 Aug 2012 17:20:31 +0800


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

#include <stdio.h>
#include <assert.h>

int main(int argc, char *argv[])
  printf ("hello, world.\n");
  return 0;

I am afraid that this problem is related to the usage of variable

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
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
285) (285 gdb-gdb nil nil 292) (292 gdb-ignored-notification
nil 466) (466 gdb-stopped
nil 651))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]