diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 410b31a..e6716d6 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,11 @@ +2014-10-01 Mark Wielaard + + * dwarf_aggregate_size.c (aggregate_size): Return CU address_size + for sizeless DW_TAG_pointer_type, DW_TAG_reference_type or + DW_TAG_rvalue_reference_type. + 2014-09-12 Petr Machata * memory-access.h (read_ubyte_unaligned_inc): Allow only 4- and 8-byte quantities. Consequently, rename to... (read_addr_unaligned_inc): ... this. diff --git a/libdw/dwarf_aggregate_size.c b/libdw/dwarf_aggregate_size.c index 07c53a2..5d23541 100644 --- a/libdw/dwarf_aggregate_size.c +++ b/libdw/dwarf_aggregate_size.c @@ -1,7 +1,7 @@ /* Compute size of an aggregate type from DWARF. - Copyright (C) 2010 Red Hat, Inc. + Copyright (C) 2010, 2014 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify it under the terms of either @@ -203,10 +203,18 @@ aggregate_size (Dwarf_Die *die, Dwarf_Word *size, Dwarf_Die *type_mem) return aggregate_size (get_type (die, &attr_mem, type_mem), size, type_mem); /* Tail call. */ case DW_TAG_array_type: return array_size (die, size, &attr_mem, type_mem); + + /* Assume references and pointers have pointer size if not given an + explicit DW_AT_byte_size. */ + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_rvalue_reference_type: + *size = die->cu->address_size; + return 0; } /* Most types must give their size directly. */ return -1; }