From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16748 invoked by alias); 4 Oct 2005 01:24:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16716 invoked by uid 22791); 4 Oct 2005 01:24:07 -0000 Received: from chfw.preston.net (HELO universe.preston.net) (202.14.89.130) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 04 Oct 2005 01:24:07 +0000 Received: from norman (norman.preston.net [202.14.10.82]) by universe.preston.net (8.11.6/8.11.6) with ESMTP id j941O0j30596 for ; Tue, 4 Oct 2005 11:24:00 +1000 Subject: Re: [PATCH] Relative source file search From: Craig Jeffree To: gdb-patches@sources.redhat.com In-Reply-To: <1127806796.32709.17.camel@norman> References: <1127806796.32709.17.camel@norman> Content-Type: multipart/mixed; boundary="=-B13j5tJXFXNXY8HT4GfO" Date: Tue, 04 Oct 2005 01:24:00 -0000 Message-Id: <1128389039.32709.128.camel@norman> Mime-Version: 1.0 X-SW-Source: 2005-10/txt/msg00039.txt.bz2 --=-B13j5tJXFXNXY8HT4GfO Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 686 Hi all, What needs to occur for a patch like this to be accepted? Is anyone able to look at it and possibly commit it? Cheers, Craig. On Tue, 2005-09-27 at 17:39 +1000, Craig Jeffree wrote: > A while ago I reported problems locating source files that are specified > with relative paths in the compile line, detailed here: > > http://sourceware.org/ml/gdb/2005-08/msg00066.html > > Since then I've had a play around with the code and come up with the > attached diff which seems to solve the problem for me. I couldn't see > any side effects as a result. > > Can someone run a second set of eyes over this so that it can get > accepted to the mainline. > > Thanks, > Craig. > --=-B13j5tJXFXNXY8HT4GfO Content-Disposition: attachment; filename=relsrcsrch.diff Content-Type: text/x-patch; name=relsrcsrch.diff; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1657 Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.70 diff -c -p -r1.70 source.c *** source.c 29 Aug 2005 12:57:49 -0000 1.70 --- source.c 27 Sep 2005 07:27:26 -0000 *************** find_and_open_source (struct objfile *ob *** 893,901 **** --- 893,917 ---- int open_source_file (struct symtab *s) { + char *filename; + if (!s) return -1; + /* Use the concatenation of dirname and filename if dirname isn't absolute */ + if (s->filename && s->dirname && !IS_ABSOLUTE_PATH (s->dirname)) + { + filename = (char *) + alloca (strlen (s->dirname) + strlen (SLASH_STRING) + + strlen (s->filename) + 1); + + strcpy(filename, s->dirname); + strcat(filename, SLASH_STRING); + strcat(filename, s->filename); + + return find_and_open_source (s->objfile, filename, NULL, &s->fullname); + } + return find_and_open_source (s->objfile, s->filename, s->dirname, &s->fullname); } Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.7365 diff -c -p -r1.7365 ChangeLog *** ChangeLog 26 Sep 2005 22:31:16 -0000 1.7365 --- ChangeLog 27 Sep 2005 07:27:31 -0000 *************** *** 1,3 **** --- 1,8 ---- + 2005-09-27 Craig Jeffree + + * source.c (open_source_file): Handle relative dirname during source + file search. + 2005-09-26 Nick Roberts * Makefile.in (HFILES_NO_SRCDIR): Remove minimon.h, symfile-mem.h. --=-B13j5tJXFXNXY8HT4GfO--