[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 |
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))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- No (gdb) prompt when assert,
Liang Wang <=