From 7ee98c29f42cee28fabe18971a8ad8f1edf0f932 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Thu, 4 May 2017 16:08:52 +0200 Subject: [PATCH] Fix array subranges (wrongly) having the same lower bound In some case, some array subranges would all have the same lower bound. Fixed thus. * src/abg-dwarf-reader.cc (build_subranges_from_array_type_die): Consider the 'lower_bound' parameter as the default lower bound for each sub-ranges. Signed-off-by: Dodji Seketeli --- src/abg-dwarf-reader.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/abg-dwarf-reader.cc b/src/abg-dwarf-reader.cc index f1029d3d..840a8a36 100644 --- a/src/abg-dwarf-reader.cc +++ b/src/abg-dwarf-reader.cc @@ -11859,17 +11859,18 @@ build_function_type(read_context& ctxt, /// @param die the DIE of tag DW_TAG_array_type which contains /// children DIEs that represent the sub-ranges. /// -/// @param lower_bound the lower bound to consider given our context. +/// @param default_lower_bound the default lower bound to consider +/// given our context. /// /// @param subranges out parameter. This is set to the sub-ranges /// that are built from @p die. static void build_subranges_from_array_type_die(Dwarf_Die* die, - uint64_t lower_bound, + uint64_t default_lower_bound, array_type_def::subranges_type& subranges) { Dwarf_Die child; - uint64_t upper_bound = 0; + uint64_t upper_bound = 0, lower_bound = 0; uint64_t count = 0; if (dwarf_child(die, &child) == 0) @@ -11879,6 +11880,7 @@ build_subranges_from_array_type_die(Dwarf_Die* die, int child_tag = dwarf_tag(&child); if (child_tag == DW_TAG_subrange_type) { + lower_bound = default_lower_bound; // The DWARF 4 specifications says, in [5.11 Subrange // Type Entries]: //