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 #6 from Yao Qi <qiyao at gcc dot gnu.org> ---
(In reply to Pedro Alves from comment #4)
> > 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.

Yes, it is hard to define "first" from user's perspective.  I agree we need to
update doc to match current GDB behaviour.  I'll do that.

-- 
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]