Eric Pouech : dbghelp/dwarf: Fix computation of some location attributes.

Alexandre Julliard julliard at winehq.org
Mon Nov 15 16:01:29 CST 2021


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

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Mon Nov 15 18:26:21 2021 +0100

dbghelp/dwarf: Fix computation of some location attributes.

Dwarf4 clarified that only FORM_sec_offset can refer to location
lists, fix dwarf2_compute_location_attr accordingly.

This fixes the 'fixme:dwarf2_parse_udt_member: Found register, while
not expecting it' messages.

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

---

 dlls/dbghelp/dwarf.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index d6b8de7400a..9d60aeb5ad4 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1059,18 +1059,31 @@ static BOOL dwarf2_compute_location_attr(dwarf2_parse_context_t* ctx,
 
     switch (xloc.form)
     {
+    case DW_FORM_data4:
+        if (ctx->head.version < 4)
+        {
+            loc->kind = loc_dwarf2_location_list;
+            loc->reg = Wine_DW_no_register;
+            loc->offset = xloc.u.uvalue;
+            return TRUE;
+        }
+        /* fall through */
     case DW_FORM_data1: case DW_FORM_data2:
     case DW_FORM_udata: case DW_FORM_sdata:
         loc->kind = loc_absolute;
         loc->reg = 0;
         loc->offset = xloc.u.uvalue;
         return TRUE;
-    case DW_FORM_data4:
-        loc->kind = loc_dwarf2_location_list;
-        loc->reg = Wine_DW_no_register;
-        loc->offset = xloc.u.uvalue;
-        return TRUE;
-    case DW_FORM_data8: case DW_FORM_sec_offset:
+    case DW_FORM_data8:
+        if (ctx->head.version >= 4)
+        {
+            loc->kind = loc_absolute;
+            loc->reg = 0;
+            loc->offset = xloc.u.lluvalue;
+            return TRUE;
+        }
+        /* fall through */
+    case DW_FORM_sec_offset:
         loc->kind = loc_dwarf2_location_list;
         loc->reg = Wine_DW_no_register;
         loc->offset = xloc.u.lluvalue;
@@ -1701,8 +1714,9 @@ static void dwarf2_parse_udt_member(dwarf2_debug_info_t* di,
     {
         if (loc.kind != loc_absolute)
         {
-           FIXME("Found register, while not expecting it\n");
-           loc.offset = 0;
+            FIXME("Unexpected offset computation for member %s in %ls!%s\n",
+                  name.u.string, di->unit_ctx->module_ctx->module->modulename, parent->hash_elt.name);
+            loc.offset = 0;
         }
         else
             TRACE("found member_location at %s -> %lu\n",




More information about the wine-cvs mailing list