public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Aleksandar Ristovski <ARistovski@qnx.com>
Cc: gdb@sourceware.org, Ryan Mansfield <RMansfield@qnx.com>
Subject: Re: gdb_realpath: dealing with ./ and ../
Date: Fri, 04 Jan 2008 17:42:00 -0000	[thread overview]
Message-ID: <20080104174225.GA15473@caradoc.them.org> (raw)
In-Reply-To: <2F6320727174C448A52CEB63D85D11F40A4A@nova.ott.qnx.com>

On Fri, Jan 04, 2008 at 11:38:44AM -0500, Aleksandar Ristovski wrote:
> BUT...
> This does not solve all my problems. In fact, when debugging on linux a
> binary cross-compiled on windows, it won't work:
> 
> IS_ABSOLUTE_PATH macro will differ depending on the configured gdb host. The
> problem with this is when one is debugging binary cross-compiled on windows,
> on a unix host, IS_ABSOLUTE_PATH will return 0 on "C:.." style paths which
> is not correct. Looking at the code, in many places we concatenate directory
> and file name if IS_ABSOLUTE_PATH returns zero so in case of cross-compiled
> binary I suspect there will be many issues.

Yes, this is something I've been meaning to fix for ages, but never
had time.  We need versions of IS_ABSOLUTE_PATH, FILENAME_CMP, and the
other related macros which handle DOS pathnames regardless of the host
system.  We should give them different names, though, so that both are
available (sometimes we need to manipulate host paths).

> > > 2. Problem two - one physical file is specified with two pathnames.
> > 
> > The specific case that's important here is associating the main file
> > from a dwarf2 CU DIE with the right lines from .debug_line.  When we
> > go to create that subfile we haven't created the other subfiles yet.
> > So what we need, I think, is to handle this in dwarf2read.c by walking
> > through the filename / directory table.
> 
> dwarf2read.c calls start_subfile or start_symtab which in turn calls
> start_subfile. I think we should let our readers deal with "compiled" paths
> (i.e. as found in the binary), without conversion. In start_subfile,
> however, we can do something with paths. Currently, we do not try to
> substitute-path on paths coming from the binary, even though they are
> clearly our source paths and should be dealt with the same as with any other
> source path. 

Substitute-path is designed to convert paths coming from the binary
into paths for the host system.  I don't understand why you're calling
it this early; it doesn't matter if these files exist on the host
system or not.

I always have trouble understanding changes to this part of GDB.
It would help a lot if you could write test cases.  We can use
gdb.dwarf2/ to construct arbitrary DWARF-2 contents, with relative or
absolute paths as needed.  If you have trouble writing the test cases,
I can do it if you send me a couple of example binaries, and the
before and after expected results.

Or you might ask Joel or Eli to look at your patches.

> Note2: for some reason, my post to gdb-patches didn't go through even after
> two attempts. There I submitted only source.c change dealing with rewriting
> source path in case when NAME is an absolute path and at the same time
> DIRNAME is not NULL (which can happen).

Please try using text for patches, instead of binary attachments.
ChangeLog entries would be nice, too.

-- 
Daniel Jacobowitz
CodeSourcery

  reply	other threads:[~2008-01-04 17:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04 17:04 Aleksandar Ristovski
2008-01-04 17:42 ` Daniel Jacobowitz [this message]
2008-01-04 18:25   ` Joel Brobecker
2008-01-04 21:40 ` Doug Evans
2008-01-04 21:48   ` Daniel Jacobowitz
2008-01-04 22:23     ` Doug Evans
  -- strict thread matches above, loose matches on Subject: below --
2008-01-08 19:21 Aleksandar Ristovski
2008-01-08 16:12 Aleksandar Ristovski
2008-01-08 16:40 ` Mark Kettenis
2008-01-04 22:09 Aleksandar Ristovski
2008-01-04 20:16 Aleksandar Ristovski
2008-01-04 19:52 Aleksandar Ristovski
2008-01-04 20:30 ` Doug Evans
2008-01-03 18:30 Aleksandar Ristovski
2008-01-04 12:52 ` Daniel Jacobowitz
2008-01-03 17:07 Aleksandar Ristovski
2008-01-03 17:13 ` Daniel Jacobowitz
2008-01-07 14:33   ` Joel Brobecker
2008-01-07 17:00     ` Doug Evans
2008-01-08  5:46       ` Joel Brobecker
2008-01-08 19:54         ` Doug Evans
2008-01-03 16:39 Aleksandar Ristovski
2008-01-03 16:52 ` Daniel Jacobowitz
2008-01-03 15:25 Aleksandar Ristovski
2008-01-03 16:00 ` Daniel Jacobowitz

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=20080104174225.GA15473@caradoc.them.org \
    --to=drow@false.org \
    --cc=ARistovski@qnx.com \
    --cc=RMansfield@qnx.com \
    --cc=gdb@sourceware.org \
    /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).