[pacman-dev] [PATCH] makepkg: Include more source files in debug packages.

Allan McRae allan at archlinux.org
Mon Feb 24 05:56:58 UTC 2020


On 20/2/20 11:51 am, Austin Lund wrote:
> Currently only the file pointed to by the DW_AT_name is included as a source
> file in debug packages.  This means many files that are useful for debugging are
> not included.  For example, no header files are included but yet these may by
> referenced in the .debug_line section.
> 
> This sed script converts into shell variables the debug dump information from
> readelf about compilation units, directory tables and file tables.  This can be
> used to get the full path of all the source files from within the package being
> compiled that are referenced in the debugging information.  Also, placeholder
> symbols (e.g. <builtin>) and paths outside the current source (e.g. linked
> libraries) will be more consistently ignored from inclusion in the debug
> packages.
> 
> Signed-off-by: Austin Lund <austin.lund at gmail.com>
> ---


So...  that sed script is horrendous!  But let me see if I understand
this correctly.


We currently only look at the .debug_info section, finding
DW_AT_name/DW_AT_comp_dir pair to grab file names.  That appears to get
the main compilation units, but misses header files.  It looks like your
sed does something slightly different to get that info, although I can't
tell if there is a functional difference.

Your patch additionally looks at the .debug_line section.  This section
has a table of directories that source files come from (which can be
filtered to remove system directories), and a file name table with files
from each directory.   This does not include the files we currently grab.

But there must be something I am missing...  For the example of "ls" I
see "selinux.h" in from directory "./lib/selinux" in that .debug_line
output.   Your script does not include this file.  Using the rpmtool
"debugedit -l" does include that file in its file list.  There are quite
a few other examples.

Am I on the right track?   Can you clarify what I am missing here?

Thanks,
Allan


More information about the pacman-dev mailing list