This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Pending breakpoints on lines that don't exist
On 01/04/2012 08:49 PM, Tom Tromey wrote:
"Marc" == Marc Khouzam<marc.khouzam@ericsson.com> writes:
Marc> (gdb) b 2
Marc> No line 2 in the current file.
Marc> Make breakpoint pending on future shared library load? (y or [n]) y
Marc> Breakpoint 1 (2) pending.
This is intended, but I wonder whether it would make sense to have
different behavior in the case where the file is implicit.
That is, "b 2" would just give the old error, but "b currentfile.c:2"
would prompt for a pending breakpoint.
The rationale for this would be that, in the implicit filename case, the
user is presumably asking for exactly the current file.
It sounds tempting, but it goes back to guessing user's intentions?
I'm left wondering if the real problem isn't that
> No line 2 in the current file.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (2) pending.
Isn't super clear that "2" doesn't actually mean "line 2 in any file",
but currentfile.c:2. Or does it not?
Note (debugging gdb):
(top-gdb) b 56
No line 56 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 4 (56) pending.
(top-gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000006a419a in internal_error at ../../src/gdb/utils.c:1046
2 breakpoint keep y 0x00000000004ccc49 in info_command at ../../src/gdb/cli/cli-cmds.c:229
silent
return
4 breakpoint keep y <PENDING> 56
(top-gdb)
When read this, I go "where will breakpoint 4 resolve again?". It feels like gdb should show
the (normalized) spec back to the user. "What" isn't exactly that.
I find myself confused like that with e.g., `*' breakpoints. As in,
was that a * breakpoint I set there, or not?:
(top-gdb) b *main
Breakpoint 5 at 0x455314: file ../../src/gdb/gdb.c, line 26.
(top-gdb) info breakpoints 5
Num Type Disp Enb Address What
5 breakpoint keep y 0x0000000000455314 in main at ../../src/gdb/gdb.c:26
(top-gdb) b main
Breakpoint 6 at 0x455323: file ../../src/gdb/gdb.c, line 29.
(top-gdb) info breakpoints 5-6
Num Type Disp Enb Address What
5 breakpoint keep y 0x0000000000455314 in main at ../../src/gdb/gdb.c:26
6 breakpoint keep y 0x0000000000455323 in main at ../../src/gdb/gdb.c:29
--
Pedro Alves