[RFC] libdw: prepend current directory in read_srclines
Fri May 5 13:37:00 GMT 2017
On Wed, 2017-05-03 at 22:34 +0200, Torsten Polle wrote:
> I compile the simple program relative.c:
> int main()
> return 0;
> with the command "gcc -g ../2017-05-03-elfutils/relative.c -o relative“.
> When I run systemtap with the command
> /opt/tooling/adit/systemtap/bin/stap -g -a i386 -B CROSS_COMPILE=i586-poky-linux- -r /home/polle/work/build/poky/build/tmp/work/qemux86-poky-linux/linux-yocto/4.8.12+gitAUTOINC+926c93ae07_021b4aef55-r0/build --sysroot=/home/polle/work/build/poky/build/tmp/work/qemux86-poky-linux/core-image-sato/1.0-r0/rootfs -L 'process("/bin/relative").function("main").call‘
> I get the following output:
> But running nm returns the following.
> nm -l | grep relative
> 080483eb T main /home/polle/work/issues/2017-05-03-elfutils/../2017-05-03-elfutils/relative.c:1
> I hope this helps.
Yes. But I think it is an systemtap issue, not an elfutils issue.
So systemtap mailinglist CCed.
If I understand the systemtap sources correctly then the above comes
from either dwarf_decl_file (Dwarf_Die *). Which returns the file name
as recorded in the DIE. If that name doesn't start with '/' then if a
full path is needed then the compile unit comp_dir needs to be prefixed:
dwarf_formstring (dwarf_attr (dwarf_diecu (die, ...), DW_AT_comp_dir, ...));
If the name already started with a '/' then it is already a full path.
It might make the systemtap output more consistent if it did that. But
since the file names are also used to match against regular expressions
you might need a bit careful where you do or don't add the full path.
More information about the Elfutils-devel