Eric Pouech : dbghelp/dwarf: Support enumeration as index type for arrays.

Alexandre Julliard julliard at winehq.org
Tue Sep 21 15:59:04 CDT 2021


Module: wine
Branch: master
Commit: 44bcae3f8d93efc7fda455646595ea7e7309c55f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=44bcae3f8d93efc7fda455646595ea7e7309c55f

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Sep 21 08:00:18 2021 +0200

dbghelp/dwarf: Support enumeration as index type for arrays.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 41abb91f33b..2d4f13b8281 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));




More information about the wine-cvs mailing list