public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Dave Korn" <dave.korn@artimi.com>
To: "'Craig Jeffree'" <craig.jeffree@preston.net>,
	"'Bob Rossi'" <bob@brasko.net>
Cc: <gdb@sources.redhat.com>
Subject: RE: trouble locating source files through relative paths
Date: Tue, 23 Aug 2005 09:20:00 -0000	[thread overview]
Message-ID: <SERRANOIPkrILUHjIyp00000205@SERRANO.CAM.ARTIMI.COM> (raw)
In-Reply-To: <1124773410.3749.38.camel@norman>

----Original Message----
>From: Craig Jeffree
>Sent: 23 August 2005 06:03


>> Have you tried using the cdir command? That might work.
> 
> (gdb) help cdir
> Undefined command: "cdir".  Try "help".
> 
> What's cdir?  What version of gdb is it available in?

  I think he's probably just referring to 'cd'.

> That is what I would expect because the binary is not in the current
> working directory.  Since the path shown in the stat64 (above) for
> GeAttribute.H is the correct relative path compared to the binary
> location I expect that I should be able to specify the binary's location
> using dir:
> 
> dir /staff/taam/taam/bin/x86-Linux/nostrip/
> 
> and then see gdb search with this as one of the starting points for the
> relative path to GeAttribute.H.  However strace now shows the following:
> 
> stat64("/staff/taam/taam/bin/x86-Linux/nostrip/GeAttribute.H",
> 0xbfffed8c) = -1 ENOENT (No such file or directory)
> stat64("../../../include/General/GeAttribute.H", 0xbfffed8c) = -1 ENOENT
> (No such file or directory)
> stat64("/staff/cjeffree/taam/GeAttribute.H", 0xbfffed8c) = -1 ENOENT (No
> such file or directory)
> 
> 
> So as you can see the newly specified path is now searched, but not with
> the full relative path specified in the debug symbols added to it.
> Instead gdb strips off the path and just adds the filename.  I would
> expect to see a stat64 call looking for "/staff/taam/taam/bin/x86-
> Linux/nostrip/../../../include/General/GeAttribute.H".  At least that's
> what the gdb documentation promises.


> I then looked inside the function find_and_open_source() in gdb/source.c
> at the first call to openp.  Stepping through this code in gdb you get
> to see that find_and_open_source() is given char
> *filename="GeAttribute.H" and char *dirname="../../../include/General/"
> separately.  'dirname' is then added to the source search path in place
> of $cdir, so it now looks like this: "/staff/taam/taam/bin/x86-
> Linux/nostrip:../../../include/General:$cwd".  The call to openp would
> work if 'dirname' was not separated from 'filename' and added to
> 'path'.
> 
> Is this a bug in gdb?  


  I believe you have identified a real bug.  I recall someone having a
problem getting directory concatenation to work a while ago, and it looks to
me like you've identified the problem.  The solution needs a bit of thinking
about; it may suffice to notice when we have a relative path, and in those
cases try calling find_and_open_source (fullpath, NULL or "" as appropriate)
before splitting it and trying again if the first attempt fails, but I
haven't looked at the source yet.



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

  reply	other threads:[~2005-08-23  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-19  7:25 Craig Jeffree
2005-08-19 12:43 ` Bob Rossi
2005-08-23  5:04   ` Craig Jeffree
2005-08-23  9:20     ` Dave Korn [this message]
2005-08-23 11:31     ` Bob Rossi
2005-08-23 11:40       ` Bob Rossi
2005-08-23 14:49         ` Daniel Jacobowitz
2005-08-23 15:24           ` Bob Rossi
2005-08-24  6:55         ` Craig Jeffree
2005-08-24 11:24           ` Bob Rossi
2005-08-25  0:07             ` Craig Jeffree
2005-08-25 13:14               ` Bob Rossi
2005-08-25 23:43                 ` Craig Jeffree
2005-08-26  2:20                   ` Bob Rossi
2005-08-26  3:35                     ` Craig Jeffree

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=SERRANOIPkrILUHjIyp00000205@SERRANO.CAM.ARTIMI.COM \
    --to=dave.korn@artimi.com \
    --cc=bob@brasko.net \
    --cc=craig.jeffree@preston.net \
    --cc=gdb@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).