This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/19474] "break LINE_NUM" set breakpoint on file other than current source file


https://sourceware.org/bugzilla/show_bug.cgi?id=19474

--- Comment #3 from Yao Qi <qiyao at gcc dot gnu.org> ---
There are more cases we need to think about, and I assume gdb doc is correct,

1. "f.c:12", according to linespec doc, "Specifies the line linenum in the
source file filename. If filename is a relative file name, then it will match
any source file name with the same trailing components."

(gdb) b f.c:12
Breakpoint 5 at 0x4006b8: f.c:12. (2 locations)
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
5       breakpoint     keep y   <MULTIPLE>         
5.1                         y     0x00000000004006b8 in bar_in_main at f.c:12
5.2                         y     0x00007ffff7bd869f in bar_in_solib at f.c:12

GDB is correct.

2. "/tmp/bar/f.c:12"
(gdb) b /tmp/bar/f.c:12
Breakpoint 6 at 0x4006b8: /tmp/bar/f.c:12. (2 locations)
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
6       breakpoint     keep y   <MULTIPLE>         
6.1                         y     0x00000000004006b8 in bar_in_main at f.c:12
6.2                         y     0x00007ffff7bd869f in bar_in_solib at f.c:12

GDB is incorrect.

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]