From what I have usually seen emitted by GCC, a "this pointer" is
represented by a DW_TAG_pointer_type. If the "this pointer" is for a
const method, then it points to a const class type DIE.
But in, in this problem report, I am seeing a "this pointer"
represented by a DW_TAG_const_type that points to a
DW_TAG_pointer_type, which is itself points to a class type DIE.
The code of die_this_pointer_is_const needs to be adjusted so that it
doesn't expect only a DW_TAG_pointer_type.
This is what this patch does.
* src/abg-dwarf-reader.cc (die_this_pointer_is_const): If the DIE
is not a DW_TAG_pointer_type then don't crash.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
die_this_pointer_is_const(Dwarf_Die* die)
{
assert(die);
- assert(dwarf_tag(die) == DW_TAG_pointer_type);
- Dwarf_Die pointed_to_type_die;
- if (die_die_attribute(die, DW_AT_type, pointed_to_type_die))
- if (dwarf_tag(&pointed_to_type_die) == DW_TAG_const_type)
- return true;
+ if (dwarf_tag(die) == DW_TAG_pointer_type)
+ {
+ Dwarf_Die pointed_to_type_die;
+ if (die_die_attribute(die, DW_AT_type, pointed_to_type_die))
+ if (dwarf_tag(&pointed_to_type_die) == DW_TAG_const_type)
+ return true;
+ }
return false;
}