This is the mail archive of the
mailing list for the GDB project.
Re: Better realpath
On Saturday 14 June 2008 15:28:01 Eli Zaretskii wrote:
> > From: Vladimir Prus <email@example.com>
> > Date: Sat, 14 Jun 2008 10:24:41 +0400
> > GDB has a function to get real path of a file, gdb_realpath. Unfortunately,
> > that function is essentially a copy-paste of libiberty's lrealpath, with
> > the extra bonus that gdb_realpath *does not* have any Windows-specific
> > code. As result, GDB is not capable to simplify ".." in windows paths,
> > and among other problems, breakpoints set using full file names containing
> > ".." will not work.
> > This patch makes GDB use libibery's lrealpath. OK?
> There were past discussions about this; please read them before
> concluding that lrealpath is all we need.
I'm not concluding this, I'm concluding it is strictly better than
gdb_realpath in its current form. And given that currently, trying
to set a breakpoint using full path with ".." plain does not work,
I think the proposed patch is definitely an improvement.
The implications of the current behaviour are much more grave than it
seems. Presently, Eclipse uses file basename to set breakpoints by
default, which obviously breaks badly if there two files with the same
basename in the project, which is not uncommon. And if we try to use
full paths on Windows, we'll immediately hit the current limitations.
So, without gdb changes, breakpoints in Eclipse are half-broken. In
fact, breakpoints in any frontend are half broken on Windows.
> My records seem to indicate
> that a thread Re "fullname attribute for GDB/MI stack frames" in May
> 2005 on this list is one of them, but maybe there were more. You will
> find my critique of what lrealpath does on Windows in a message in
> that thread I sent on May 29, and suggested ways to improve it in a
> followup message on the same day. I think if we are going to use
> lrealpath, we should at least make its behavior consistent and correct
> on all supported platforms, including native Windows (i.e. MinGW).
Speaking of the issues you've raised in:
I think that:
1. The order of slashes is a cosmetic issue.
2. The case of filenames is also a cosmetic issues.
3. The matter of filename existance is a behaviour issue, and I think
I can modify gdb_realpath to perform a check explicitly. OTOH, it's not
clear if any code actually expects file existane check to be performed.