mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-25 11:12:14 +00:00
c0a31b48c7
While working on something else, I noticed that the abilint tool would crash when trying to write information relative to some symbol information. It turned out that invoking corpus::get_fun_symbol_map() or corpus::get_var_symbol_map() on a corpus that has an empty function (or variable) symbol map yields a crash. This patch fixes that. To test the fix I had to extend the test-read-write.cc test harness to teach it to load corpus files too; up to now it was only loading simple translation unit files (named Binary Instrumentation files). I then created a native xml corpus file using the abidw tool on a simple shared library I created. That corpus file does have an empty variable symbol section which triggers the crash on a non-fixed tree. * src/abg-corpus.cc (corpus::{get_fun_symbol_map_sptr, get_var_symbol_map_sptr}): Make sure the symbol map is always constructed, even if it's empty. * tests/data/test-read-write/test26.xml: New test input data. * tests/test-read-write.cc (in_out_spec): Add this new test input data to the list of input data to run the harness on. (main): Support reading and writing corpus files alongside translation unit files that we were handling already. * tests/data/Makefile.am: Add the new test input data to source distribution. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
33 lines
2.5 KiB
XML
33 lines
2.5 KiB
XML
<abi-corpus path='libtest-v0.so'>
|
|
<elf-function-symbols>
|
|
<elf-symbol name='_fini' type='func-type' binding='global-binding' is-defined='yes'/>
|
|
<elf-symbol name='_init' type='func-type' binding='global-binding' is-defined='yes'/>
|
|
<elf-symbol name='foo' type='func-type' binding='global-binding' is-defined='yes'/>
|
|
</elf-function-symbols>
|
|
<abi-instr version='1.0' address-size='64' path='test-v0.c'>
|
|
<class-decl name='public_type' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/tests/test-interfaces-v0.h' line='2' column='1' id='type-id-1'>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<var-decl name='priv_' type-id='type-id-2' visibility='default' filepath='/home/dodji/tests/test-interfaces-v0.h' line='4' column='1'/>
|
|
</data-member>
|
|
</class-decl>
|
|
<class-decl name='private_data' size-in-bits='32' is-struct='yes' visibility='default' filepath='/home/dodji/tests/test-v0.c' line='3' column='1' id='type-id-3'>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<var-decl name='private_data0' type-id='type-id-4' visibility='default' filepath='/home/dodji/tests/test-v0.c' line='5' column='1'/>
|
|
</data-member>
|
|
</class-decl>
|
|
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-4'/>
|
|
<pointer-type-def type-id='type-id-3' size-in-bits='64' alignment-in-bits='64' id='type-id-2'/>
|
|
<pointer-type-def type-id='type-id-1' size-in-bits='64' alignment-in-bits='64' id='type-id-5'/>
|
|
<class-decl name='another_public_type' size-in-bits='32' is-struct='yes' visibility='default' filepath='/home/dodji/tests/test-interfaces-v0.h' line='7' column='1' id='type-id-6'>
|
|
<data-member access='public' layout-offset-in-bits='0'>
|
|
<var-decl name='i' type-id='type-id-4' visibility='default' filepath='/home/dodji/tests/test-interfaces-v0.h' line='9' column='1'/>
|
|
</data-member>
|
|
</class-decl>
|
|
<pointer-type-def type-id='type-id-6' size-in-bits='64' alignment-in-bits='64' id='type-id-7'/>
|
|
<function-decl name='foo' mangled-name='foo' filepath='/home/dodji/tests/test-v0.c' line='9' column='1' visibility='default' binding='global' size-in-bits='64' alignment-in-bits='64' elf-symbol-id='foo'>
|
|
<parameter type-id='type-id-5' name='p' filepath='/home/dodji/tests/test-v0.c' line='9' column='1'/>
|
|
<parameter type-id='type-id-7' name='t' filepath='/home/dodji/tests/test-v0.c' line='10' column='1'/>
|
|
</function-decl>
|
|
</abi-instr>
|
|
</abi-corpus>
|