From: Earl Chew <earl_chew@agilent.com>
To: gdb-patches@sources.redhat.com, cgf@redhat.com
Subject: [RFC PATCH] Finding files in source trees (was Re: Finding source files under Cygwin)
Date: Mon, 16 Sep 2002 13:37:00 -0000 [thread overview]
Message-ID: <3D864101.2A0BCA85@agilent.com> (raw)
In-Reply-To: <3D862BD0.A5298600@agilent.com>
Christopher Faylor wrote:
> I'm sorry but it is rarely a good idea to mix functionality like this.
> You're mixing an (arguable) bug fix with an (arguable) gdb enhancement.
>
> Please submit each as a separate patch.
Ok. This patch allows files to be found in source trees.
The motivation for this addition is to accommodate large projects
where source files are scattered in large source trees. I want to
be able to point gdb at the root of the source tree, rather than have
to specify each leaf directory. Thus I can write:
gdb> dir /myproject/source
instead of:
gdb> dir /myproject/source/a/b/c:/myproject/source/z/b/d: etc
Earl
ChangeLog:
* source.c: Source file lookup changes.
(open_source_file): If the source file
/w/x/y/z.c cannot be found, try using w/x/y/z.c,
x/y/z.c, y/z.c in addition to z.c (the basename).
--- gdb-5.2.1\gdb\source.c 2002-09-16 13:08:17.000000000 -0700
+++ source.c 2002-09-16 13:09:31.000000000 -0700
@@ -753,6 +753,25 @@
result = openp_1 (path, pathlen, sep, 0, p, OPEN_MODE, 0,
&s->fullname);
}
+ if (result < 0)
+ {
+ /* Didn't work. Try lopping off prefixes from the full name. */
+ p = s->filename;
+
+ do
+ {
+ while (*p && ! IS_DIR_SEPARATOR (*p))
+ p++;
+ if (*p && *++p)
+ {
+ result = openp_1 (path, pathlen, sep, 0,
+ p, OPEN_MODE, 0, &s->fullname);
+ if (result >= 0)
+ break;
+ }
+ } while (*p);
+ }
+
if (result >= 0)
{
fullname = s->fullname;
next prev parent reply other threads:[~2002-09-16 20:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-13 17:57 Finding source files under Cygwin Earl Chew
2002-09-13 21:40 ` Finding source files under cygwin Christopher Faylor
2002-09-16 12:07 ` Finding source files under Cygwin Earl Chew
2002-09-16 12:48 ` Finding source files under cygwin Christopher Faylor
2002-09-16 13:14 ` Finding source files under Cygwin Earl Chew
2002-09-16 13:37 ` Earl Chew [this message]
2002-09-16 15:02 ` [RFC PATCH] Finding files in source trees (was Re: Finding source files under Cygwin) Daniel Jacobowitz
2002-09-16 15:17 ` Earl Chew
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=3D864101.2A0BCA85@agilent.com \
--to=earl_chew@agilent.com \
--cc=cgf@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/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