From: "Doug Evans" <dje@google.com>
To: gdb-patches@sourceware.org
Subject: [RFC] make handling of input path vs subfile path consistent
Date: Sat, 05 Jan 2008 22:33:00 -0000 [thread overview]
Message-ID: <e394668d0801051432t34e56abet795972d8cd688fe@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
Hi. There's something I don't understand. Why does start_subfile not
prepend dirname to name if the latter is not absolute? Since
name,dirname are added to the subfile list if there isn't a match and
then will later be used to do matches, it seems like we want to
prepend dirname to the input name before doing FILENAME_CMP.
Am I missing something?
[-- Attachment #2: gdb-080105-start-subfile-1.patch --]
[-- Type: application/octet-stream, Size: 2032 bytes --]
2008-01-05 Doug Evans <dje@google.com>
* buildsym.c (start_subfile): Treat input name like subfile->name,
prepend their compilation directory when they're relative paths.
Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.59
diff -u -p -u -p -r1.59 buildsym.c
--- buildsym.c 1 Jan 2008 22:53:09 -0000 1.59
+++ buildsym.c 5 Jan 2008 21:34:33 -0000
@@ -583,35 +583,41 @@ void
start_subfile (char *name, char *dirname)
{
struct subfile *subfile;
+ char *comparable_name = name;
+
+ if (! IS_ABSOLUTE_PATH (name)
+ && dirname != NULL)
+ comparable_name = concat (dirname, SLASH_STRING, name, NULL);
/* See if this subfile is already known as a subfile of the current
main source file. */
for (subfile = subfiles; subfile; subfile = subfile->next)
{
- char *subfile_name;
+ char *subfile_name = subfile->name;
- /* If NAME is an absolute path, and this subfile is not, then
- attempt to create an absolute path to compare. */
- if (IS_ABSOLUTE_PATH (name)
- && !IS_ABSOLUTE_PATH (subfile->name)
+ /* Combine subfile's name, dirname before comparing. */
+ if (! IS_ABSOLUTE_PATH (subfile->name)
&& subfile->dirname != NULL)
subfile_name = concat (subfile->dirname, SLASH_STRING,
subfile->name, NULL);
- else
- subfile_name = subfile->name;
- if (FILENAME_CMP (subfile_name, name) == 0)
+ if (FILENAME_CMP (subfile_name, comparable_name) == 0)
{
current_subfile = subfile;
if (subfile_name != subfile->name)
xfree (subfile_name);
+ if (comparable_name != name)
+ xfree (comparable_name);
return;
}
if (subfile_name != subfile->name)
xfree (subfile_name);
}
+ if (comparable_name != name)
+ xfree (comparable_name);
+
/* This subfile is not known. Add an entry for it. Make an entry
for this subfile in the list of all subfiles of the current main
source file. */
next reply other threads:[~2008-01-05 22:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-05 22:33 Doug Evans [this message]
2008-01-08 20:22 ` Daniel Jacobowitz
2008-01-06 5:45 Aleksandar Ristovski
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=e394668d0801051432t34e56abet795972d8cd688fe@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@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