Bug 22122 - Fail to represent 'const array'

When computing canonical DIEs, the DWARF reader mistakenly represents
'array of const' and 'const array' the same.

This patch fixes that.

	* src/abg-dwarf-reader.cc (die_is_array_type): Define new static
	function.
	(die_is_pointer_or_reference_type): Also test that the DIE can be
	an array.
	* tests/data/test-read-dwarf/PR22122-libftdc.so: New binary test input.
	* tests/data/test-read-dwarf/PR22122-libftdc.so.abi: New reference output.
	* tests/data/Makefile.am: Add the two new test files above to
	source distribution.
	* tests/test-read-dwarf.cc (in_out_specs): Run this test harness
	over the new test input.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2017-09-11 17:23:43 +02:00
parent 3e4c5cafe2
commit 74105ff84b
5 changed files with 7581 additions and 2 deletions

View File

@ -8629,14 +8629,34 @@ die_is_reference_type(Dwarf_Die* die)
return false;
}
/// Test if a DIE represents a pointer or reference type.
/// Test if a DIE represents an array type.
///
/// @param die the die to consider.
///
/// @return true iff @p die represents an array type.
static bool
die_is_array_type(Dwarf_Die* die)
{
if (!die)
return false;
int tag = dwarf_tag(die);
if (tag == DW_TAG_array_type)
return true;
return false;
}
/// Test if a DIE represents a pointer, reference or array type.
///
/// @param die the die to consider.
///
/// @return true iff @p die represents a pointer or reference type.
static bool
die_is_pointer_or_reference_type(Dwarf_Die* die)
{return (die_is_pointer_type(die) || die_is_reference_type(die));}
{return (die_is_pointer_type(die)
|| die_is_reference_type(die)
|| die_is_array_type(die));}
/// Test if a DIE represents a class type.
///

View File

@ -376,6 +376,8 @@ test-read-dwarf/test24-drop-fns-0.suppr \
test-read-dwarf/test24-drop-fns.cc \
test-read-dwarf/PR22015-libboost_iostreams.so \
test-read-dwarf/PR22015-libboost_iostreams.so.abi \
test-read-dwarf/PR22122-libftdc.so \
test-read-dwarf/PR22122-libftdc.so.abi \
\
test-annotate/test0.abi \
test-annotate/test1.abi \

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -222,6 +222,12 @@ InOutSpec in_out_specs[] =
"data/test-read-dwarf/PR22015-libboost_iostreams.so.abi",
"output/test-read-dwarf/PR22015-libboost_iostreams.so.abi",
},
{
"data/test-read-dwarf/PR22122-libftdc.so",
"",
"data/test-read-dwarf/PR22122-libftdc.so.abi",
"output/test-read-dwarf/PR22122-libftdc.so.abi",
},
// This should be the last entry.
{NULL, NULL, NULL, NULL}
};