From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] Fix bug in set substitute-patch
Date: Fri, 12 Jan 2007 04:02:00 -0000 [thread overview]
Message-ID: <20070112040310.GI537@adacore.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 529 bytes --]
This should fix a bug reported by Daniel when the source file is
compiled using absolute filenames.
% gcc -c -o foo /path/to/foo.c
As Daniel reported, what happens in this case is that the compiler
puts the filename full path into the filename, and then leaves the
dirname empty.
2007-01-12 Joel Brobecker <brobecker@adacore.com>
* source.c (find_and_open_source): Try rewriting the source
path inside filename if dirname is NULL.
Tested on x86-linux, no regression.
OK to apply?
Thanks,
--
Joel
[-- Attachment #2: subst.diff --]
[-- Type: text/plain, Size: 888 bytes --]
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.77
diff -u -p -r1.77 source.c
--- source.c 9 Jan 2007 17:58:58 -0000 1.77
+++ source.c 12 Jan 2007 04:01:21 -0000
@@ -1001,6 +1001,18 @@ find_and_open_source (struct objfile *ob
strcat (path + len, source_path + len + cdir_len); /* After $cdir */
}
}
+ else
+ {
+ /* If dirname is NULL, chances are the path is embedded in
+ the filename. Try the source path substitution on it. */
+ char *rewritten_filename = rewrite_source_path (filename);
+
+ if (rewritten_filename != NULL)
+ {
+ make_cleanup (xfree, rewritten_filename);
+ filename = rewritten_filename;
+ }
+ }
result = openp (path, OPF_SEARCH_IN_PATH, filename, OPEN_MODE, 0, fullname);
if (result < 0)
next reply other threads:[~2007-01-12 4:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-12 4:02 Joel Brobecker [this message]
2007-01-20 20:34 ` Daniel Jacobowitz
2007-01-24 0:03 ` Joel Brobecker
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=20070112040310.GI537@adacore.com \
--to=brobecker@adacore.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