* [RFA] Fix bug in set substitute-patch
@ 2007-01-12 4:02 Joel Brobecker
2007-01-20 20:34 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2007-01-12 4:02 UTC (permalink / raw)
To: gdb-patches
[-- 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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Fix bug in set substitute-patch
2007-01-12 4:02 [RFA] Fix bug in set substitute-patch Joel Brobecker
@ 2007-01-20 20:34 ` Daniel Jacobowitz
2007-01-24 0:03 ` Joel Brobecker
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2007-01-20 20:34 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
On Fri, Jan 12, 2007 at 08:03:10AM +0400, Joel Brobecker wrote:
> 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?
OK, and thanks.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Fix bug in set substitute-patch
2007-01-20 20:34 ` Daniel Jacobowitz
@ 2007-01-24 0:03 ` Joel Brobecker
0 siblings, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2007-01-24 0:03 UTC (permalink / raw)
To: gdb-patches
> > 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?
>
> OK, and thanks.
Thanks, Daniel. Now checked in.
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-01-24 0:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-12 4:02 [RFA] Fix bug in set substitute-patch Joel Brobecker
2007-01-20 20:34 ` Daniel Jacobowitz
2007-01-24 0:03 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox