https://sourceware.org/bugzilla/show_bug.cgi?id=34666
Bug ID: 34666
Summary: srcfiles missing main source in some cases
Product: elfutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libdw
Assignee: unassigned at sourceware dot org
Reporter: ross at burtonini dot com
CC: elfutils-devel at sourceware dot org
Target Milestone: ---
Say I have a silly C test.c that just includes two files with symbols in:
test.c:
#include "1.h"
#include "2.h"
where 1.h and 2.h are also trivial:
1.h:
int one = 1;
2.h:
int two = 2;
If I compile this to an object and then use eu-srcfiles to list the sources, it
doesn't include test.c:
$ gcc -g test.c -c
$ eu-srcfiles -e test.o
/home/rosbur01/Mess/dwarf/1.h
/home/rosbur01/Mess/dwarf/2.h
Adding a definition to test.c (such as int foo;) causes test.c appear in the
list:
/home/rosbur01/Mess/dwarf/1.h
/home/rosbur01/Mess/dwarf/2.h
/home/rosbur01/Mess/dwarf/test.c
I'm guessing the srclist is based entirely on where symbols come from and this
doesn't handle the case where the original source file doesn't actually have
any declarations in.
Also potentially relevant: this only happens with dwarf5. -g has the same
behaviour as -gdwarf-5 but a definition-free test.c has the correct output if
-gdwarf-3 is passed:
$ cat test.c
#include "1.h"
#include "2.h"
$ gcc -gdwarf-5 test.c -c
$ eu-srcfiles -e test.o
/home/rosbur01/Mess/dwarf/1.h
/home/rosbur01/Mess/dwarf/2.h
$ gcc -gdwarf-3 test.c -c
$ eu-srcfiles -e test.o
/home/rosbur01/Mess/dwarf/1.h
/home/rosbur01/Mess/dwarf/2.h
/home/rosbur01/Mess/dwarf/test.c
--
You are receiving this mail because:
You are on the CC list for the bug.