Red Hat Bugzilla – Bug 337051
fpc misuses DW_AT_comp_dir and .debug_line directory and file name formats
Last modified: 2013-01-09 23:27:58 EST
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
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.
Reported upstream: http://www.freepascal.org/mantis/view.php?id=9965
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.
Upstream says this is fixed now in fpc 2.2.1.
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.
(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)
*** Bug 434195 has been marked as a duplicate of this bug. ***
fpc-2.2.0-12.fc9 has been submitted as an update for Fedora 9
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.