This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug breakpoints/19474] "break LINE_NUM" set breakpoint on file other than current source file
- From: "palves at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Tue, 09 Feb 2016 12:43:54 +0000
- Subject: [Bug breakpoints/19474] "break LINE_NUM" set breakpoint on file other than current source file
- Auto-submitted: auto-generated
- References: <bug-19474-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19474
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com
--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
> 3. "-source f.c -line 12", as gdb doc "explicit location" says, "The value
> specifies the source file name. To differentiate between files with the same
> base name, prepend as many directories as is necessary to uniquely identify
> the desired file, e.g., foo/bar/baz.c. Otherwise gdb will use the first file
> it finds with the given base name.", so GDB should set one breakpoint
> location,
>
> (gdb) break -source f.c -line 12
> Breakpoint 7 at 0x4006b8: -source f.c -line 12. (2 locations)
> (gdb) info breakpoints
> Num Type Disp Enb Address What
> 7 breakpoint keep y <MULTIPLE>
> 7.1 y 0x00000000004006b8 in bar_in_main at f.c:12
> 7.2 y 0x00007ffff7bd869f in bar_in_solib at
> f.c:12
>
> GDB is incorrect.
I'd say this one is correct.
Both files are named "f.c", so the -source specified failed to "prepend as many
directories as is necessary to uniquely identify the desired file".
I wouldn't say that "Otherwise gdb will use the first file it finds with the
given base name." is desirable, as it's brittle, depends on which symtab gdb
happens to expand first. I think in that case, it's the docs that should be
updated.
--
You are receiving this mail because:
You are on the CC list for the bug.