This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] gdb-gdb.gdb vs. .gdbinit multi-bpt regression
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Doug Evans <dje at google dot com>
- Date: Mon, 28 Jan 2013 17:46:47 +0100
- Subject: [patch] gdb-gdb.gdb vs. .gdbinit multi-bpt regression
Hi,
Doug pointed out the GDB-inner breakpoint multiply on re-runs.
This did not happen with .gdbinit before gdb-gdb.gdb has been introduced.
$ gdb ./gdb
Breakpoint 1 at 0x8385fe: file utils.c, line 956.
Breakpoint 2 at 0x6300a8: file ./cli/cli-cmds.c, line 221.
(top-gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000008385fe in internal_error at utils.c:956
2 breakpoint keep y 0x00000000006300a8 in info_command at ./cli/cli-cmds.c:221
silent
return
(top-gdb) start
[...]
(top-gdb) shell touch gdb
(top-gdb) start
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/home/[...]/gdb/gdb' has changed; re-reading symbols.
[...]
(top-gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000008385fe in internal_error at utils.c:956
2 breakpoint keep y 0x00000000006300a8 in info_command at ./cli/cli-cmds.c:221
silent
return
4 breakpoint keep y 0x00000000008385fe in internal_error at utils.c:956
5 breakpoint keep y 0x00000000006300a8 in info_command at ./cli/cli-cmds.c:221
silent
return
(top-gdb)
I could not wrap the whole script into an if block as there are bugs in
process_next_line. Particularly:
* '(top-gdb) ' prompt trailing space gets stripped.
* 'document pdie' text block gets executed as commands (resulting in errors).
As due to it some parts get still executed each time on the GDB inferior
reload I have also kept the initial echo message there outside of the
conditional:
echo Setting up the environment for debugging gdb.\n
I will check it in, the patch is imperfect but the visible regression should
be fixed.
Thanks,
Jan
gdb/
2013-01-28 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb-gdb.gdb.in: Wrap set complaints, b internal_error, b info_command
and dir commands into an if block.
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in
index ffb7f53..05a38b2 100644
--- a/gdb/gdb-gdb.gdb.in
+++ b/gdb/gdb-gdb.gdb.in
@@ -1,19 +1,26 @@
echo Setting up the environment for debugging gdb.\n
-set complaints 1
+if !$gdb_init_done
+ set variable $gdb_init_done = 1
-b internal_error
+ set complaints 1
-b info_command
-commands
- silent
- return
+ b internal_error
+
+ b info_command
+ commands
+ silent
+ return
+ end
+
+ dir @srcdir@/../libiberty
+ dir @srcdir@/../bfd
+ dir @srcdir@
+ dir .
+
+ # Commands below are not fully compatible with wrapping into an 'if' block.
end
-dir @srcdir@/../libiberty
-dir @srcdir@/../bfd
-dir @srcdir@
-dir .
set prompt (top-gdb)
define pdie