public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Aleksandar Ristovski <ARistovski@qnx.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb@sourceware.org, Ryan Mansfield <RMansfield@qnx.com>,
	 	Joel Brobecker <brobecker@adacore.com>
Subject: RE: gdb_realpath: dealing with ./ and ../
Date: Fri, 04 Jan 2008 19:52:00 -0000	[thread overview]
Message-ID: <2F6320727174C448A52CEB63D85D11F40A4E@nova.ott.qnx.com> (raw)

> 
> 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).
>

Submitted a patch:
http://sourceware.org/ml/gdb-patches/2008-01/msg00062.html

 
> 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.
 
It is a good idea to have test cases. I, unfortunately, know very little
about writing tests, and would really appreciate if you wrote the tests.

Attached is a binary that illustrates the problem I talked about, but to
summarize and break-down the problem into independent pieces I will list
test cases I can think of. We need combinations of DW_AT_name,
DW_AT_comp_dir, and directory table (in .debug_line section).  I am not 100%
sure how are you going to test this, but my testcase is to set a breakpoint
using file name, i.e.
(gdb) break main.c:11
Or something like that. I expect testcase 2 to fail. Test 1 and 3 should be
o.k. When testing Na) versions of testcases (DOS paths, linux host), I would
expect all of them to fail.

1. Currently covered case:
DW_AT_name = /foo/bar/main.c
No DW_AT_comp_dir or DW_AT_comp_dir equal to DW_AT_name
The Directory Table:
(empty)
The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c

2. Case where DW_AT_name is absolute path, DW_AT_comp_dir is given as a
different absolute path and line info is given relative to comp_dir:
 
DW_AT_name = /foo/bar/main.c
DW_AT_comp_dir = /foo/bar/Debug
The Directory Table:
 ..

The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c

3. DW_AT_name relative to DW_AT_comp_dir

DW_AT_name = ../main.c
DW_AT_comp_dir = /foo/bar/Debug

The Directory Table:
 ..

The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c


========= Cross-compiled on windows case =============
The following testcases are basically the same as above, except now we use
DOS style paths. The tests are meaningful only when testing on POSIX host.
Otherwise they default to the above tests.

1a. Currently covered case:
DW_AT_name = C:/foo/bar/main.c
No DW_AT_comp_dir or DW_AT_comp_dir equal to DW_AT_name
The Directory Table:
(empty)
The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c

2a. Case where DW_AT_name is absolute path, DW_AT_comp_dir is given as a
different absolute path and line info is given relative to comp_dir:
 
DW_AT_name = C:/foo/bar/main.c
DW_AT_comp_dir = C:/foo/bar/Debug
The Directory Table:
 ..

The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c

3a. DW_AT_name relative to DW_AT_comp_dir

DW_AT_name = ../main.c
DW_AT_comp_dir = C:/foo/bar/Debug

The Directory Table:
 ..

The File Name Table:
 Entry	Dir	Time	Size	Name
 1		1	0	0	main.c



Thank you,

Aleksandar Ristovski
QNX Software Systems

             reply	other threads:[~2008-01-04 19:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-04 19:52 Aleksandar Ristovski [this message]
2008-01-04 20:30 ` 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 17:04 Aleksandar Ristovski
2008-01-04 17:42 ` Daniel Jacobowitz
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
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=2F6320727174C448A52CEB63D85D11F40A4E@nova.ott.qnx.com \
    --to=aristovski@qnx.com \
    --cc=RMansfield@qnx.com \
    --cc=brobecker@adacore.com \
    --cc=drow@false.org \
    --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).