This is the mail archive of the
mailing list for the elfutils project.
Re: [RFC] libdw: prepend current directory in read_srclines
- From: Torsten Polle <Torsten dot Polle at gmx dot de>
- To: Mark Wielaard <mark at klomp dot org>
- Cc: elfutils-devel at sourceware dot org
- Date: Wed, 3 May 2017 22:34:59 +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>
> Am 29.03.2017 um 22:15 schrieb Torsten Polle <Torsten.Polle@gmx.de>:
> Hi Mark,
>> Am 27.03.2017 um 22:45 schrieb Mark Wielaard <firstname.lastname@example.org>:
>> Hi Torsten,
>> On Sun, Mar 26, 2017 at 08:35:50PM +0200, Torsten Polle wrote:
>>> I observed that readelf and elfutils sometimes report different results.
>> Do you have an example of this? It would be good to have a testcase.
>>> PFA a patch that corrects this. I’m not sure whether the way I tackled
>>> the problem is acceptable.
>> I see why you are proposing this. The DWARF spec does say about the
>> include_directories "Each path entry is either a full path name or is
>> relative to the current directory of the compilation". So your patch
>> does make sense.
>> But it does depend on what users of dwarf_getsrclines expect.
>> Or any use of Dwarf_Line/Dwarf_Files. I think those users expect that
>> the returned file names can be relative. And that they should make them
>> absolute using index zero or the comp_dir themselves.
>> So if you do have an example where the expected output isn't what you
>> believe it should be we should examine if there is some other way to
>> do the right thing.
> thanks for the answer. I’ll come back with an example, which is SystemTap based. :-)
> Please allow for some delay. I expect to provide an example in about two weeks.
Sorry for coming back so late. Please find attached my reproduction.
I compile the simple program relative.c:
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.