Re: [RFC] gdb_realpath causes problems with GVD

Tom Tromey
2002-03-20T22:16:24Z

>>>>> "Joel" == Joel Brobecker <brobecker@ACT-Europe.FR> writes:

Joel> The problem appears when some of the files used to build the
Joel> application are symbolic links and when GDB annotations are
Joel> activated. For us, this happens when GVD, our graphical
Joel> front-end, drives GDB.

Joel> Breakpoint 1, break_me () at toto.c:4
Joel> yy/bonn.a/brobecke/symlinks/toto.C:4:23:beg:0x804846b

Joel> As you see, GDB has translated toto.c into toto.C. This
Joel> translation causes GDB to think that the inferior stopped in a
Joel> file named toto.C (which is not known to GDB, since the compiler
Joel> used only toto.c). As a consequence, when the user tries to put
Joel> breakpoints using the GVD, GVD issues the following break
Joel> command
Joel> (gdb) break toto.C:4

gdb tells GVD that the file is "/bonn.a/brobecke/symlinks/toto.C".
Why does GVD then use just the base name?
Won't this be incorrect if there is more than one file with the same
name? (The very problem my original patch was intended to fix.)
Wouldn't changing GVD to pass the exact same file name back to gdb
give correct results in every case?

Joel> I think I found a way to keep the fix to his problem and then at
Joel> the same time fix our issue: instead of canonicalizing the
Joel> entire filename, I suggest that we only expand the directory
Joel> prefix (ie the part returned by the "dirname" unix command).

I suspect this won't be correct in all cases, but I don't have a ready
counterexample.

Tom