Re: [PATCH] Relative source file search

Bob Rossi
2005-10-10T16:46:08Z

On Mon, Oct 10, 2005 at 02:56:04PM +1000, Craig Jeffree wrote:
> On Thu, 2005-10-06 at 20:25 -0400, Bob Rossi wrote:
> > Craig, you should be able to put your patch into
> > source.c:find_and_open_source in the part where it checks for
> > if (dirname != NULL)
> > {
> > ...
> > }
> >
> > instead of appending to the source_path, simply change the filename and
> > leave the source_path alone. Run this through the testsuite, are there
> > any errors?
>
> Attached is a new patch with the change in find_and_open_source. I
> haven't had any luck with the testsuite though, I kept getting a build
> error, then I did a cvs update to make sure I had the latest, now the
> whole thing won't build. Does the cvs head build today? I'm getting
>
> make[4]: Entering directory `/staff/cjeffree/gdb/gdb-cvs/src/opcodes/po'
> make[4]: *** No rule to make target `ga.po', needed by `ga.gmo'. Stop.

I'm don't get this error, so I can't help you there. If it helps, I
check out GDB like this,
cvs -d ':ext:username@sources.redhat.com:/cvs/src' co gdb+dejagnu

I ran this through the testsuite, and everything looks good. Below is the
only notable differences, hopefully someone else can elaborate on them.

Also, this change got my example working with a header file having an
inline in a relative search directory. The GDB on my system does not
find the header file, but it does after your patch. (This is of after
adding the directory of the original executable location with the 'dir'
command).

AFAIK, this patch seems good. The last problem is to find out why
sometimes the dirname is relative and the filename isn't, OR the
filename is relative and the dirname isn't. Elena Zannoni is the general
symtab maintainer, and probably knows a good deal about this. Hopefully,
she'll let us know if she thinks this is an OK patch. I'd hate to have
the patch accepted simply because it's working by coincidence.

Finally, this patch seems to fix GDB when the dirname is relative to the
executable. What about when the dirname is relative and is linked into a
library? Then the library (from another directory) is linked into the
executable? Does that example continue to work?

Thanks,
Bob Rossi

--- original/objdir/gdb/testsuite/gdb.sum 2005-10-10 07:07:17.000000000 -0400
+++ path/builddir/gdb/testsuite/gdb.sum 2005-10-10 07:03:42.000000000 -0400
@@ -1,4 +1,4 @@
-Test Run By bob on Mon Oct 10 06:56:48 2005
+Test Run By bob on Mon Oct 10 06:52:26 2005
Native configuration is i686-pc-linux-gnu

=== gdb tests ===
@@ -9202,15 +9202,24 @@
PASS: gdb.gdb/selftest.exp: set listsize to 1
PASS: gdb.gdb/selftest.exp: run until breakpoint at captured_main
PASS: gdb.gdb/selftest.exp: printed version as string
+PASS: gdb.gdb/selftest.exp: step over context initialization
PASS: gdb.gdb/selftest.exp: step over argc initialization
PASS: gdb.gdb/selftest.exp: step over argv initialization
+PASS: gdb.gdb/selftest.exp: step over symarg initialization
+PASS: gdb.gdb/selftest.exp: step over execarg initialization
+PASS: gdb.gdb/selftest.exp: step over corearg initialization
+PASS: gdb.gdb/selftest.exp: step over cdarg initialization
+PASS: gdb.gdb/selftest.exp: step over ttyarg initialization
PASS: gdb.gdb/selftest.exp: next over get_run_time and everything it calls
PASS: gdb.gdb/selftest.exp: next over setlocale LC_MESSAGES
PASS: gdb.gdb/selftest.exp: next over setlocale LC_CTYPE
PASS: gdb.gdb/selftest.exp: next over bindtextdomain
PASS: gdb.gdb/selftest.exp: next over textdomain PACKAGE
PASS: gdb.gdb/selftest.exp: next over lim_at_start initialization
+PASS: gdb.gdb/selftest.exp: step over cmdsize initialization
PASS: gdb.gdb/selftest.exp: next over cmdarg initialization via xmalloc
+PASS: gdb.gdb/selftest.exp: next over ncmd initialization
+PASS: gdb.gdb/selftest.exp: next over dirsize initialization
PASS: gdb.gdb/selftest.exp: print a string
PASS: gdb.gdb/selftest.exp: step into xmalloc call
PASS: gdb.gdb/selftest.exp: xgdb is at prompt
@@ -11173,7 +11184,7 @@
PASS: gdb.threads/watchthreads.exp: watch args[1]
FAIL: gdb.threads/watchthreads.exp: threaded watch loop
PASS: gdb.threads/watchthreads.exp: first watchpoint on args[0] hit
-PASS: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit
+FAIL: gdb.threads/watchthreads.exp: first watchpoint on args[1] hit
FAIL: gdb.threads/watchthreads.exp: watchpoint on args[0] hit in thread
FAIL: gdb.threads/watchthreads.exp: watchpoint on args[1] hit in thread
FAIL: gdb.threads/watchthreads.exp: combination of threaded watchpoints = 30
@@ -11318,13 +11329,13 @@

=== gdb Summary ===

-# of expected passes 10701
-# of unexpected failures 161
+# of expected passes 10713
+# of unexpected failures 160
# of unexpected successes 1
# of expected failures 41
# of unknown successes 4
# of known failures 42
# of untested testcases 7
# of unsupported tests 6
-/home/bob/cvs/gdb/original/objdir/gdb/testsuite/../../gdb/gdb version 6.3.50.20051010-cvs -nx
+/home/bob/cvs/gdb/path/builddir/gdb/testsuite/../../gdb/gdb version 6.3.50.20051010-cvs -nx