This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [RFC] libdw: prepend current directory in read_srclines
- From: Mark Wielaard <mark at klomp dot org>
- To: Torsten Polle <Torsten dot Polle at gmx dot de>
- Cc: elfutils-devel at sourceware dot org, systemtap at sourceware dot org
- Date: Fri, 05 May 2017 14:11:25 +0200
- Subject: Re: [RFC] libdw: prepend current directory in read_srclines
- Authentication-results: sourceware.org; auth=none
- References: <BB17FFBB-B202-460A-8AD2-45D68D76C0C1@gmx.de> <20170327204510.GA2448@stream> <68860EF1-F2CA-4EB4-9420-F1783C4AF9F1@gmx.de> <608A6FA9-0831-4640-A3A1-9D11B9DFD930@gmx.de>
Hi Torsten,
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:
> process("/bin/relative").function("main@../2017-05-03-elfutils/relative.c:1").call
>
> 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.
Cheers,
Mark