[PATCH] Add DWARF support to rtemstoolkit and use it in covoar

Cillian O'Donnell cpodonnell8 at gmail.com
Sat May 5 15:56:35 UTC 2018


Hi Chris,

Getting some build errors here. It complains about dwarf.h and libdwarf.h
so theres 2 packages that I can get them from but both end up producing
some problems. 'Elf' has a previous declaration in one and missing typedef
for the other. Is there a particular version of these libraries that you
are using?

sudo apt-get install libdwarf-freebsd-dev

Theres a typedef error for Dwarf_Handler and Dwarf_Sig8

cpod at cpod ~/development/rtems/test/rtems-tools $ ./waf
Waf: Entering directory
`/home/cpod/development/rtems/test/rtems-tools/build'
[188/229] Compiling tester/covoar/app_common.cc
[189/229] Compiling tester/covoar/CoverageFactory.cc
[193/229] Compiling tester/covoar/CoverageReaderBase.cc
[194/229] Compiling tester/covoar/CoverageReaderQEMU.cc
In file included from ../rtemstoolkit/rld-dwarf.h:29:0,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageFactory.h:12,
                 from ../tester/covoar/CoverageFactory.cc:13:
../rtemstoolkit/rld-dwarf-types.h:39:15: error: ‘Dwarf_Handler’ in
namespace ‘::’ does not name a type
     typedef ::Dwarf_Handler  dwarf_handler;
               ^
../rtemstoolkit/rld-dwarf-types.h:50:15: error: ‘Dwarf_Sig8’ in namespace
‘::’ does not name a type
     typedef ::Dwarf_Sig8     dwarf_sig8;
               ^

In file included from ../rtemstoolkit/rld-dwarf.h:29:0,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageReaderBase.cc:8:
../rtemstoolkit/rld-dwarf-types.h:39:15: error: ‘Dwarf_Handler’ in
namespace ‘::’ does not name a type
     typedef ::Dwarf_Handler  dwarf_handler;
               ^
../rtemstoolkit/rld-dwarf-types.h:50:15: error: ‘Dwarf_Sig8’ in namespace
‘::’ does not name a type
     typedef ::Dwarf_Sig8     dwarf_sig8;
               ^

In file included from ../rtemstoolkit/rld-dwarf.h:29:0,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/app_common.cc:40:
../rtemstoolkit/rld-dwarf-types.h:39:15: error: ‘Dwarf_Handler’ in
namespace ‘::’ does not name a type
     typedef ::Dwarf_Handler  dwarf_handler;
               ^
../rtemstoolkit/rld-dwarf-types.h:50:15: error: ‘Dwarf_Sig8’ in namespace
‘::’ does not name a type
     typedef ::Dwarf_Sig8     dwarf_sig8;
               ^

In file included from ../rtemstoolkit/rld-dwarf.h:29:0,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/CoverageReaderQEMU.cc:14:
../rtemstoolkit/rld-dwarf-types.h:39:15: error: ‘Dwarf_Handler’ in
namespace ‘::’ does not name a type
     typedef ::Dwarf_Handler  dwarf_handler;
               ^
../rtemstoolkit/rld-dwarf-types.h:50:15: error: ‘Dwarf_Sig8’ in namespace
‘::’ does not name a type
     typedef ::Dwarf_Sig8     dwarf_sig8;
               ^

Waf: Leaving directory `/home/cpod/development/rtems/test/rtems-tools/build'
Build failed
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
--------------------------------------------------------------------------------------------------------------


If I chose

sudo apt-get install libdwarf-dev theres a conflict with 'Elf' having a
previous declaration.

Waf: Entering directory
`/home/cpod/development/rtems/test/rtems-tools/build'
[138/229] Linking build/rtemstoolkit/libdwarf.a
[177/229] Linking build/linkers/rtems-ld
[179/229] Linking build/linkers/rtems-ra
[181/229] Linking build/linkers/rtems-tld
[183/229] Linking build/linkers/rtems-syms
[189/229] Linking build/linkers/rtems-rap
[190/229] Linking build/linkers/rtems-exeinfo
[191/229] Compiling tester/covoar/app_common.cc
[192/229] Compiling tester/covoar/CoverageFactory.cc
[193/229] Compiling tester/covoar/CoverageReaderBase.cc
[194/229] Compiling tester/covoar/CoverageReaderQEMU.cc
In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/app_common.cc:40:
/usr/include/libdwarf.h:66:8: error: using typedef-name ‘Elf’ after ‘struct’
 struct Elf;
        ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/app_common.cc:40:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^
In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/app_common.cc:40:
/usr/include/libdwarf.h:67:16: error: using typedef-name ‘Elf’ after
‘struct’
 typedef struct Elf* dwarf_elf_handle;
                ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/app_common.cc:40:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^

In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageFactory.h:12,
                 from ../tester/covoar/CoverageFactory.cc:13:
/usr/include/libdwarf.h:66:8: error: using typedef-name ‘Elf’ after ‘struct’
 struct Elf;
        ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageFactory.h:12,
                 from ../tester/covoar/CoverageFactory.cc:13:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^
In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageFactory.h:12,
                 from ../tester/covoar/CoverageFactory.cc:13:
/usr/include/libdwarf.h:67:16: error: using typedef-name ‘Elf’ after
‘struct’
 typedef struct Elf* dwarf_elf_handle;
                ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageFactory.h:12,
                 from ../tester/covoar/CoverageFactory.cc:13:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^

In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageReaderBase.cc:8:
/usr/include/libdwarf.h:66:8: error: using typedef-name ‘Elf’ after ‘struct’
 struct Elf;
        ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageReaderBase.cc:8:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^
In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageReaderBase.cc:8:
/usr/include/libdwarf.h:67:16: error: using typedef-name ‘Elf’ after
‘struct’
 typedef struct Elf* dwarf_elf_handle;
                ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/CoverageReaderBase.h:10,
                 from ../tester/covoar/CoverageReaderBase.cc:8:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^

In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/CoverageReaderQEMU.cc:14:
/usr/include/libdwarf.h:66:8: error: using typedef-name ‘Elf’ after ‘struct’
 struct Elf;
        ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/CoverageReaderQEMU.cc:14:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^
In file included from ../rtemstoolkit/rld-dwarf-types.h:29:0,
                 from ../rtemstoolkit/rld-dwarf.h:29,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/CoverageReaderQEMU.cc:14:
/usr/include/libdwarf.h:67:16: error: using typedef-name ‘Elf’ after
‘struct’
 typedef struct Elf* dwarf_elf_handle;
                ^
In file included from ../rtemstoolkit/elftoolchain/libelf/gelf.h:32:0,
                 from ../rtemstoolkit/rld-elf-types.h:29,
                 from ../rtemstoolkit/rld.h:72,
                 from ../rtemstoolkit/rld-dwarf.h:28,
                 from ../tester/covoar/ExecutableInfo.h:14,
                 from ../tester/covoar/DesiredSymbols.h:17,
                 from ../tester/covoar/app_common.h:11,
                 from ../tester/covoar/CoverageReaderQEMU.cc:14:
../rtemstoolkit/elftoolchain/libelf/libelf.h:43:21: note: ‘Elf’ has a
previous declaration here
 typedef struct _Elf Elf;
                     ^

Waf: Leaving directory `/home/cpod/development/rtems/test/rtems-tools/build'
Build failed
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)
 -> task in 'ccovoar' failed with exit status 1 (run with -v to display
more information)


On 5 May 2018 at 09:40, Chris Johns <chrisj at rtems.org> wrote:

> Hi
>
> The patch series adds a DWARF framework to the rtemstoolkit to access the
> source file and line given an address in an executable. This allows
> us to remove exec'ing addr2line.
>
> The patches build and the source line details are loaded from the DWARF
> debug info. I however do not have any coverage data to check the change
> cleanly replaces the existing addr2line calls.
>
> If someone can run the existing covoar and then this build of covoar and
> confirm the source files and lines match. If there are issues please let
> me know.
>
> Chris
> _______________________________________________
> 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/20180505/ffeb230e/attachment-0002.html>


More information about the devel mailing list