From: Aleksandar Ristovski <ARistovski@qnx.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sourceware.org, Ryan Mansfield <RMansfield@qnx.com>
Subject: RE: gdb_realpath: dealing with ./ and ../
Date: Thu, 03 Jan 2008 18:30:00 -0000 [thread overview]
Message-ID: <2F6320727174C448A52CEB63D85D11F40A41@nova.ott.qnx.com> (raw)
> An alternative would be to do some canonicalization - not
> gdb_realpath, which accesses the filesystem, but just string
> manipulation - on the subfile names iff nothing matches the main
> file. You could remove the ".." there.
Allright, I will try with the alternative.
I see two problems:
1. Problem one - relative NAME and absolute subfile->name case not covered:
In function start_subfile (buildsym.c:approx 554) we completely miss one
case: when NAME is relative path but subfile->name is absolute.
I put some instrumentation to illustrate this problem. The list below says
what is happening and specifies name, directory:
start_subfile: c:/testManagedCC/main.cc, c:/testManagedCC/Debug
creating subfile: c:/testManagedCC/main.cc, c:/testManagedCC/Debug
start_subfile: ../main.cc, c:/testManagedCC/Debug
comparing: c:/testManagedCC/main.cc, ../main.cc
creating subfile: ../main.cc, c:/testManagedCC/Debug
start_subfile: ../main.cc, c:/testManagedCC/Debug
comparing: ../main.cc, ../main.cc
Then it goes on to compare ../main.cc for each line in linetable.
Note that we created two subfiles for physically one file.
2. Problem two - one physical file is specified with two pathnames.
This is the case I was talking about. To fix it, I would try a combination
of guessing/normalizing, by inserting code for "second-best" match using
normalized path (in the same loop) if FILENAME_CMP fails to match and then
if no perfect match is found, use the second-best match. Not sure what
happens if there are more than one second-best matches (you say it's going
to be very rare)... probably at least issue a warning and behave as if no
match was found? Or resort to getting the first/last second-best match? On a
second thought, if we go with the second-best match we will never get into a
situation where two created subfile-s give more two second-best matches...
it will always be either perfect match or the second-best... this should
work.
Comments?
next reply other threads:[~2008-01-03 18:30 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 18:30 Aleksandar Ristovski [this message]
2008-01-04 12:52 ` Daniel Jacobowitz
-- strict thread matches above, loose matches on Subject: below --
2008-01-08 19:21 Aleksandar Ristovski
2008-01-08 16:12 Aleksandar Ristovski
2008-01-08 16:40 ` Mark Kettenis
2008-01-04 22:09 Aleksandar Ristovski
2008-01-04 20:16 Aleksandar Ristovski
2008-01-04 19:52 Aleksandar Ristovski
2008-01-04 20:30 ` Doug Evans
2008-01-04 17:04 Aleksandar Ristovski
2008-01-04 17:42 ` Daniel Jacobowitz
2008-01-04 18:25 ` Joel Brobecker
2008-01-04 21:40 ` Doug Evans
2008-01-04 21:48 ` Daniel Jacobowitz
2008-01-04 22:23 ` Doug Evans
2008-01-03 17:07 Aleksandar Ristovski
2008-01-03 17:13 ` Daniel Jacobowitz
2008-01-07 14:33 ` Joel Brobecker
2008-01-07 17:00 ` Doug Evans
2008-01-08 5:46 ` Joel Brobecker
2008-01-08 19:54 ` Doug Evans
2008-01-03 16:39 Aleksandar Ristovski
2008-01-03 16:52 ` Daniel Jacobowitz
2008-01-03 15:25 Aleksandar Ristovski
2008-01-03 16:00 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2F6320727174C448A52CEB63D85D11F40A41@nova.ott.qnx.com \
--to=aristovski@qnx.com \
--cc=RMansfield@qnx.com \
--cc=drow@false.org \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox