[RFA] Let GDB find the right options.c

Daniel Jacobowitz dan@codesourcery.com
Wed Mar 31 16:24:00 GMT 2010


On Wed, Mar 31, 2010 at 03:59:36PM +0800, Jie Zhang wrote:
> When I was trying to set a breakpoint on a function in GCC generated
> options.c, like cl_optimization_restore, GDB always thought it's the
> options.c in gcc/fortran/ . That's because the .gdbinit in the GCC
> build directory looks like:
> 
> dir .
> dir ../../../svn/trunk/gcc
> dir ../../../svn/trunk/gcc/ada
> dir ../../../svn/trunk/gcc/cp
> dir ../../../svn/trunk/gcc/fortran
> dir ../../../svn/trunk/gcc/java
> dir ../../../svn/trunk/gcc/lto
> dir ../../../svn/trunk/gcc/objc
> dir ../../../svn/trunk/gcc/objcp
> source ../../../svn/trunk/gcc/gdbinit.in
> 
> So GDB will search ../../../svn/trunk/gcc/fortran before the build
> directory. This patch moves "dir ." after all other dir commands. So
> the build directory will be searched first.
> 
> The options.c in gcc/fortran should still be able to be found
> correctly when setting breakpoint on the functions in that file,
> since the file name for that options.c will contains "fortran/"
> 
> Is it OK?

I can't approve this, but in my opinion, it is OK.

Deleting the dir statements should also fix the problem.  I couldn't
locate the email message where they were added.  I believe it was this
patch:

2001-02-16  Gerald Pfeifer  <pfeifer@dbai.tuwien.ac.at>

        * .gdbinit: Rename to gdbinit.in.
        * gdbinit.in: New file,
        * configure.in: Generate .gdbinit from gdbinit.in.
        * configure: Regenerated.
        * Makefile.in (distclean): Always remove .gdbinit.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gcc-patches mailing list