RFC: example fix to pr 2360

Daniel Jacobowitz drow@false.org
Mon Dec 17 00:44:00 GMT 2007


On Thu, Nov 15, 2007 at 03:55:41PM -0800, Douglas Evans wrote:
> To make things more concrete to what I was refering to in
> http://sourceware.org/ml/gdb/2007-11/msg00138.html I've filed pr 2360,
> and attached is an example fix.
> 
> I'm not sufficiently happy with it that I'd submit it RFA, but that's
> mostly because of perceived objections to the use of xfullpath.  Maybe
> the thing to do is write a canonicalizer like what is done in
> cli-cmds.c:cd_command (and presumably move it to a more generic
> place).
> 
> Suggestions?

Why should we canonicalize paths at all?  Definitely the use of
xfullpath is suspect on anything read from debug information.  Those
are paths on some system where the program was compiled, not paths on
the system where GDB is running; there are a variety of commands like
"dir" and "set substitute-path" designed to map the one to the other,
and this goes behind their back to look at the filesystem.

The root of the problem seems to me to be inconsistent information in
the source file.  Your debug information describes two files,
e.g. /tmp/bug2.c and //tmp/bug2.c (one via DW_AT_comp_dir, the other
via .debug_line).  There's nothing like an inode in the DWARF, so GDB
has reasonably assumed that they are different files.  Then you say
"bug2.c:2" and it happens to pick the one you didn't mean.

Are there any examples of this without #line?

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb-patches mailing list