Eric Pouech : dbghelp/dwarf: Support DW_FORM_ref_addr in type DIE lookup using the new cross-CU DIE mechanisms.

Alexandre Julliard julliard at winehq.org
Wed Sep 15 16:21:32 CDT 2021


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

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Wed Sep 15 10:38:17 2021 +0200

dbghelp/dwarf: Support DW_FORM_ref_addr in type DIE lookup using the new cross-CU DIE mechanisms.

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

---

 dlls/dbghelp/dwarf.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index a2ee234f79f..eb0cfaf2f50 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1044,8 +1044,21 @@ static struct symt* dwarf2_lookup_type(dwarf2_parse_context_t* ctx,
         return ctx->module_ctx->symt_cache[sc_void];
     if (!(type = sparse_array_find(&ctx->debug_info_table, attr.u.uvalue)))
     {
-        FIXME("Unable to find back reference to type %lx\n", attr.u.uvalue);
-        return ctx->module_ctx->symt_cache[sc_unknown];
+        if (attr.form == DW_FORM_ref_addr)
+        {
+            dwarf2_parse_context_t* ref_ctx = dwarf2_locate_cu(ctx->module_ctx, attr.u.uvalue);
+            /* ensure CU is fully loaded */
+            if (ref_ctx && dwarf2_parse_compilation_unit(ref_ctx))
+            {
+                type = sparse_array_find(&ref_ctx->debug_info_table, attr.u.uvalue);
+                if (type) TRACE("Found type ref %lx in another CU %s\n", attr.u.uvalue, dwarf2_debug_ctx(ref_ctx));
+            }
+        }
+        if (!type)
+        {
+            FIXME("Unable to find back reference to type 0x%lx (form=0x%lx)\n", attr.u.uvalue, attr.form);
+            return ctx->module_ctx->symt_cache[sc_unknown];
+        }
     }
     if (type == di)
     {
@@ -2454,7 +2467,7 @@ unsigned dwarf2_cache_cuhead(struct dwarf2_module_info_s* module, struct symt_co
     return TRUE;
 }
 
-static inline dwarf2_parse_context_t* dwarf2_locate_cu(dwarf2_parse_module_context_t* module_ctx, ULONG_PTR ref)
+static dwarf2_parse_context_t* dwarf2_locate_cu(dwarf2_parse_module_context_t* module_ctx, ULONG_PTR ref)
 {
     unsigned i;
     dwarf2_parse_context_t* ctx;




More information about the wine-cvs mailing list