Bug 337051 - fpc misuses DW_AT_comp_dir and .debug_line directory and file name formats
Summary: fpc misuses DW_AT_comp_dir and .debug_line directory and file name formats
Alias: None
Product: Fedora
Classification: Fedora
Component: fpc
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Joost van der Sluis
QA Contact: Fedora Extras Quality Assurance
Whiteboard: bzcl34nup
: 434195 (view as bug list)
Depends On:
Blocks: gcc43rebuildfail
TreeView+ depends on / blocked
Reported: 2007-10-18 04:04 UTC by Roland McGrath
Modified: 2013-01-10 04:27 UTC (History)
2 users (show)

Fixed In Version: F9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2008-04-18 08:07:57 UTC
Type: ---

Attachments (Terms of Use)

Description Roland McGrath 2007-10-18 04:04:55 UTC
The DWARF information that fpc generates (.debug_line) does not encode the file
and directory names correctly as defined by the DWARF spec.  This confuses
consumers like a debugger, and confuses the debugedit program that is used in
rpm builds.

The DW_AT_comp_dir attribute is being used entirely incorrectly.
It's sometimes "" and otherwise a relative directory name in fpc's output.
The spec says that this must be the current directory that the compiler runs in,
i.e. what it gets for getcwd().  Relative names in the directory and file table
refer to this to produce the complete name.

The directory table as produced has a few problems.
DWARF specifies that the table lists exactly all the directories that are
searched for included source files, i.e. for the analog of #include "file". 
This includes the directories specified with the equivalent of cc's -Idir, as
well as system-default directories analogous to C's /usr/include et al.  If a
directory name is relative it's resolved relative to DW_AT_comp_dir.
I can't tell, but it looks like maybe the first of these is going into
DW_AT_comp_dir in some cases.  Anyway, it's not clear the right list is here.
Secondly, the directory names in the table have a trailing slash; this is not a
violation of the DWARF spec, but it's not the way it's usually done, and
debugedit canonicalizes the names to remove it anyway.  You really should avoid
putting a trailing / or a leading ./ on directory names, unless the user really
specified it that way.

Comment 1 Joost van der Sluis 2007-10-18 10:40:07 UTC
Reported upstream: http://www.freepascal.org/mantis/view.php?id=9965

Comment 2 Bug Zapper 2008-04-04 14:09:36 UTC
Based on the date this bug was created, it appears to have been reported
during the development of Fedora 8. In order to refocus our efforts as
a project we are changing the version of this bug to '8'.

If this bug still exists in rawhide, please change the version back to
(If you're unable to change the bug's version, add a comment to the bug
and someone will change it for you.)

Thanks for your help and we apologize for the interruption.

The process we're following is outlined here:

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 3 Jason Tibbitts 2008-04-17 21:49:16 UTC
Upstream says this is fixed now in fpc 2.2.1.

Comment 4 Joost van der Sluis 2008-04-18 08:07:57 UTC
I hoped that the new fpc release would be in time for F9, but it isn't. So I
decided to backport the DWARF-fix to fpc-2.2.0 for F9, since fpc doesn't build
without this patch on F9.

Comment 5 Joost van der Sluis 2008-04-18 08:10:21 UTC
(fpc 2.2.1 is a snapshot/svn/unstable version which changes every day. We would
say that it's in 'rawhide'. Next release would be 2.2.2, which is delayed)

Comment 6 Joost van der Sluis 2008-04-18 08:14:03 UTC
*** Bug 434195 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2008-05-10 11:49:23 UTC
fpc-2.2.0-12.fc9 has been submitted as an update for Fedora 9

Comment 8 Fedora Update System 2008-05-13 15:27:49 UTC
fpc-2.2.0-12.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2008-07-26 06:02:54 UTC
fpc-2.2.0-12.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.