From: Eric Pouech Subject: [PATCH 6/9] dbghelp/dwarf: Support enumeration as index type for arrays Message-Id: <163186763087.96492.7311053443142881421.stgit@euterpe> Date: Fri, 17 Sep 2021 10:33:51 +0200 In-Reply-To: <163186755659.96492.14807608023276147451.stgit@euterpe> References: <163186755659.96492.14807608023276147451.stgit@euterpe> Signed-off-by: Eric Pouech --- dlls/dbghelp/dwarf.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index c67e88cb243..29d6a691f48 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1433,9 +1433,10 @@ static struct symt* dwarf2_parse_array_type(dwarf2_debug_info_t* di) { struct symt* ref_type; struct symt* idx_type = NULL; + struct symt* symt = NULL; struct attribute min, max, cnt; dwarf2_debug_info_t* child; - unsigned int i; + unsigned int i, j; const struct vector* children; if (di->symt) return di->symt; @@ -1467,6 +1468,28 @@ static struct symt* dwarf2_parse_array_type(dwarf2_debug_info_t* di) else if (!dwarf2_find_attribute(child, DW_AT_count, &cnt)) cnt.u.uvalue = 0; break; + case DW_TAG_enumeration_type: + symt = dwarf2_parse_enumeration_type(child); + if (symt_check_tag(symt, SymTagEnum)) + { + struct symt_enum* enum_symt = (struct symt_enum*)symt; + idx_type = enum_symt->base_type; + min.u.uvalue = ~0U; + max.u.uvalue = ~0U; + for (j = 0; j < enum_symt->vchildren.num_elts; ++j) + { + struct symt** pc = vector_at(&enum_symt->vchildren, j); + if (pc && symt_check_tag(*pc, SymTagData)) + { + struct symt_data* elt = (struct symt_data*)(*pc); + if (elt->u.value.n1.n2.n3.lVal < min.u.uvalue) + min.u.uvalue = elt->u.value.n1.n2.n3.lVal; + if (elt->u.value.n1.n2.n3.lVal > max.u.uvalue) + max.u.uvalue = elt->u.value.n1.n2.n3.lVal; + } + } + } + break; default: FIXME("Unhandled Tag type 0x%lx at %s\n", child->abbrev->tag, dwarf2_debug_di(di));