Fwd: [PATCH 2/4] covoar: Use DWARF to map addresses to source files and lines.

Vijay Kumar Banerjee vijaykumar9597 at gmail.com
Mon May 7 18:11:41 UTC 2018


On Mon, 7 May 2018, 23:26 Joel Sherrill, <joel at rtems.org> wrote:

> Hi
>
> I have attached a workaround. It seems that libgen.h has this:
>
> ========================================================
> /* Return final component of PATH.
>
>    This is the weird XPG version of this function.  It sometimes will
>    modify its argument.  Therefore we normally use the GNU version (in
>    <string.h>) and only if this header is included make the XPG
>    version available under the real name.  */
> extern char *__xpg_basename (char *__path) __THROW;
> #define basename        __xpg_basename
> ========================================================
>
> Chris has used basename as a method name and even though that should
> be perfectly acceptable, the macro above gets expanded, the name
> gets changed (in some places) to rld::path::__xpg_basename()
>
>       r.lowSourceLine = rld::path::basename (location);
>
> IMO the fix is to add dirname to rld-files, use rld basename and dirname
> exclusively, and avoid libgen.h at all costs.
>
> I didn't do that much work. I got lucky in a couple of files by removing
> the
> include of libgen.h since it wasn't needed but I had to leave it in one
> place.
>
> $ grep dirname *.cc
> GcovData.cc:    dirname( path );
>
> Hopefully this lets you all proceed with Chris' patches and my slight hack
> in place.
>
> Ultimate solution is probably simple. We just need to hear from Chris.
>
> --joel
>
This will hopefully fix it, unfortunately I can't test it now, as I'm on
mobile. Hopefully Cillian can try building with the diff applied.

>

>
> On Mon, May 7, 2018 at 12:42 PM, Joel Sherrill <joel at rtems.org> wrote:
>
>>
>>
>> On Mon, May 7, 2018 at 12:36 PM, Vijay Kumar Banerjee <
>> vijaykumar9597 at gmail.com> wrote:
>>
>>>
>>> On Mon, 7 May 2018, 22:57 Cillian O'Donnell, <cpodonnell8 at gmail.com>
>>> wrote:
>>>
>>>> Yeah I'm seeing the same as Joel, at least were further then we were :).
>>>>
>>>> I've been mostly working on the rtems-tester support, so just to give
>>>> an update. I spent all day Saturday and today on it. It's taking longer
>>>> than expected, re-orienting myself and deciding what is needed and not
>>>> needed now with the changes in covoar. The problems are not difficult, it's
>>>> just taking some time re-organizing everything. My time is limited during
>>>> the week, so it'll probably be next weekend before I can finish it off.
>>>> Vijay if you have time during the week I could push what I have and you
>>>> could take a stab at some of them and then I could it finish off next
>>>> weekend if you haven't already.
>>>>
>>> please send them, I can look into them for sure.
>>>
>>
>> Keep plugging away.
>>
>> I think there is something wrong in rld related to basename. My first
>> thought was that the undefined symbol was because we didn't include the
>> library. Now I think it is because something got misconfigured on
>> Centos/Fedora/etc. Looking into this.
>>
>>
>>>
>>>> On 7 May 2018 at 15:40, Joel Sherrill <joel at rtems.org> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, May 7, 2018 at 6:01 AM, Vijay Kumar Banerjee <
>>>>> vijaykumar9597 at gmail.com> wrote:
>>>>>
>>>>>> I have added the path to libdwarf here
>>>>>>
>>>>>
>>>>> That worked for me to build but not to link.
>>>>>
>>>>> I'm not sure why this rld symbol turned up missing on Centos 7.
>>>>>
>>>>> ====================================================
>>>>>
>>>>> $ ./waf -v
>>>>> Waf: Entering directory `/home/joel/rtems-work/rtems-tools/build'
>>>>> [228/229] Linking build/tester/covoar/trace-converter
>>>>> 09:38:25 runner ['/usr/bin/g++',
>>>>> 'tester/covoar/TraceConverter.cc.2.o', 'tester/covoar/TraceList.cc.2.o',
>>>>> 'tester/covoar/TraceReaderBase.cc.2.o',
>>>>> 'tester/covoar/TraceReaderLogQEMU.cc.2.o',
>>>>> 'tester/covoar/TraceWriterBase.cc.2.o',
>>>>> 'tester/covoar/TraceWriterQEMU.cc.2.o',
>>>>> '-o/home/joel/rtems-work/rtems-tools/build/tester/covoar/trace-converter',
>>>>> '-Wl,-Bstatic', '-Ltester/covoar', '-Lrtemstoolkit', '-lccovoar', '-lrld',
>>>>> '-ldwarf', '-lelf', '-liberty', '-Wl,-Bdynamic']
>>>>> [229/229] Linking build/tester/covoar/covoar
>>>>> 09:38:25 runner ['/usr/bin/g++', 'tester/covoar/covoar.cc.3.o',
>>>>> '-o/home/joel/rtems-work/rtems-tools/build/tester/covoar/covoar',
>>>>> '-Wl,-Bstatic', '-Ltester/covoar', '-Lrtemstoolkit', '-lccovoar', '-lrld',
>>>>> '-ldwarf', '-lelf', '-liberty', '-Wl,-Bdynamic']
>>>>> tester/covoar/libccovoar.a(DesiredSymbols.cc.1.o): In function
>>>>> `Coverage::DesiredSymbols::determineSourceLines(Coverage::CoverageRanges*,
>>>>> Coverage::ExecutableInfo*)':
>>>>> /home/joel/rtems-work/rtems-tools/build/../tester/covoar/DesiredSymbols.cc:413:
>>>>> undefined reference to `rld::path::__xpg_basename(std::string const&)'
>>>>> /home/joel/rtems-work/rtems-tools/build/../tester/covoar/DesiredSymbols.cc:415:
>>>>> undefined reference to `rld::path::__xpg_basename(std::string const&)'
>>>>> collect2: error: ld returned 1 exit status
>>>>>
>>>>> tester/covoar/libccovoar.a(DesiredSymbols.cc.1.o): In function
>>>>> `Coverage::DesiredSymbols::determineSourceLines(Coverage::CoverageRanges*,
>>>>> Coverage::ExecutableInfo*)':
>>>>> /home/joel/rtems-work/rtems-tools/build/../tester/covoar/DesiredSymbols.cc:413:
>>>>> undefined reference to `rld::path::__xpg_basename(std::string const&)'
>>>>> /home/joel/rtems-work/rtems-tools/build/../tester/covoar/DesiredSymbols.cc:415:
>>>>> undefined reference to `rld::path::__xpg_basename(std::string const&)'
>>>>> collect2: error: ld returned 1 exit status
>>>>>
>>>>> Waf: Leaving directory `/home/joel/rtems-work/rtems-tools/build'
>>>>> Build failed
>>>>>  -> task in 'trace-converter' failed with exit status 1:
>>>>>         {task 34721616: cxxprogram
>>>>> TraceConverter.cc.2.o,TraceList.cc.2.o,TraceReaderBase.cc.2.o,TraceReaderLogQEMU.cc.2.o,TraceWriterBase.cc.2.o,TraceWriterQEMU.cc.2.o
>>>>> -> trace-converter}
>>>>> ['/usr/bin/g++', 'tester/covoar/TraceConverter.cc.2.o',
>>>>> 'tester/covoar/TraceList.cc.2.o', 'tester/covoar/TraceReaderBase.cc.2.o',
>>>>> 'tester/covoar/TraceReaderLogQEMU.cc.2.o',
>>>>> 'tester/covoar/TraceWriterBase.cc.2.o',
>>>>> 'tester/covoar/TraceWriterQEMU.cc.2.o',
>>>>> '-o/home/joel/rtems-work/rtems-tools/build/tester/covoar/trace-converter',
>>>>> '-Wl,-Bstatic', '-Ltester/covoar', '-Lrtemstoolkit', '-lccovoar', '-lrld',
>>>>> '-ldwarf', '-lelf', '-liberty', '-Wl,-Bdynamic']
>>>>>  -> task in 'covoar' failed with exit status 1:
>>>>>         {task 34820256: cxxprogram covoar.cc.3.o -> covoar}
>>>>> ['/usr/bin/g++', 'tester/covoar/covoar.cc.3.o',
>>>>> '-o/home/joel/rtems-work/rtems-tools/build/tester/covoar/covoar',
>>>>> '-Wl,-Bstatic', '-Ltester/covoar', '-Lrtemstoolkit', '-lccovoar', '-lrld',
>>>>> '-ldwarf', '-lelf', '-liberty', '-Wl,-Bdynamic']
>>>>> ====================================================
>>>>>
>>>>>
>>>>>>
>>>>>> ---
>>>>>>
>>>>>> diff --git a/tester/covoar/wscript b/tester/covoar/wscript
>>>>>> index 55d5ec9..dd4ad83 100644
>>>>>> --- a/tester/covoar/wscript
>>>>>> +++ b/tester/covoar/wscript
>>>>>> @@ -63,6 +63,7 @@ def build(bld):
>>>>>>      rtl_includes = [rtemstoolkit,
>>>>>>  		    rtemstoolkit + '/elftoolchain/libelf',
>>>>>>  		    rtemstoolkit + '/elftoolchain/common',
>>>>>> +		    rtemstoolkit + '/elftoolchain/libdwarf',
>>>>>>  		    rtemstoolkit + '/libiberty']
>>>>>>      if bld.env.DEST_OS == 'win32':
>>>>>>          rtl_includes += [rtemstoolkit + '/win32']
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- vijay
>>>>>>
>>>>>> On 7 May 2018 at 13:30, Vijay Kumar Banerjee <
>>>>>> vijaykumar9597 at gmail.com> wrote:
>>>>>>
>>>>>>>
>>>>>>> On 6 May 2018 at 13:29, Chris Johns <chrisj at rtems.org> wrote:
>>>>>>>
>>>>>>>> On 6/5/18 5:28 pm, Vijay Kumar Banerjee wrote:
>>>>>>>>
>>>>>>>>> On 6 May 2018 at 08:54, Chris Johns <chrisj at rtems.org <mailto:
>>>>>>>>> chrisj at rtems.org>> wrote:
>>>>>>>>>
>>>>>>>>>         Would you please try `waf clean build` to see if rebuilding
>>>>>>>>>         everything fixes this?
>>>>>>>>>
>>>>>>>>> still getting the same error .
>>>>>>>>> I'm using g++ 7.3.1 on fedora 27.
>>>>>>>>>
>>>>>>>>
>>>>>>>> OK
>>>>>>>>
>>>>>>>> If you have changed something in the code, can you please send a
>>>>>>>>> patch for the same ?
>>>>>>>>>
>>>>>>>>
>>>>>>>> I have not changed anything. I do not have a Linux box to try.
>>>>>>>>
>>>>>>>> I tried to do it afresh as well, it's still failing to build.
>>>>>>> Can someone please try to build it in a linux system ?
>>>>>>>
>>>>>>>> Chris
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> devel mailing list
>>>>>> devel at rtems.org
>>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> devel mailing list
>>>>> devel at rtems.org
>>>>> http://lists.rtems.org/mailman/listinfo/devel
>>>>>
>>>>
>>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20180507/52b05e42/attachment-0001.html>


More information about the devel mailing list