scripts: elf_helper.py: fix C++ template constexpr value processing

Some DWARF symbols for members of template classes members such as
numeric_limits<unsigned int> reference are static constexpr values
that do not have a data member location.  Avoid attempting to
dereference the value for that attribute when it isn't present.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
This commit is contained in:
Peter A. Bigot 2019-09-13 08:44:26 -05:00 committed by Anas Nashif
commit 5611beeec1

View file

@ -295,9 +295,12 @@ def analyze_die_struct(die):
for child in die.iter_children():
if child.tag != "DW_TAG_member":
continue
data_member_location = child.attributes.get("DW_AT_data_member_location")
if not data_member_location:
continue
child_type = die_get_type_offset(child)
member_offset = \
child.attributes["DW_AT_data_member_location"].value
member_offset = data_member_location.value
cname = die_get_name(child) or "<anon>"
m = AggregateTypeMember(child.offset, cname, child_type,
member_offset)