Eric Pouech : dbghelp/dwarf: Fix incorrect WARN.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 16:01:57 CDT 2021


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

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Sep 28 17:21:30 2021 +0200

dbghelp/dwarf: Fix incorrect WARN.

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

---

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

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 33c3b7fc467..51789f8591e 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1948,18 +1948,22 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
     }
     else
     {
-        /* variable has been optimized away... report anyway */
-        loc.kind = loc_error;
-        loc.reg = loc_err_no_location;
         if (subpgm->func)
         {
+            /* local variable has been optimized away... report anyway */
+            loc.kind = loc_error;
+            loc.reg = loc_err_no_location;
             symt_add_func_local(subpgm->ctx->module_ctx->module, subpgm->func,
                                 is_pmt ? DataIsParam : DataIsLocal,
                                 &loc, block, param_type, name.u.string);
         }
         else
         {
-            WARN("dropping global variable %s which has been optimized away\n", debugstr_a(name.u.string));
+            struct attribute is_decl;
+            /* only warn when di doesn't represent a declaration */
+            if (!dwarf2_find_attribute(di, DW_AT_declaration, &is_decl) ||
+                !is_decl.u.uvalue || is_decl.gotten_from != attr_direct)
+                WARN("dropping global variable %s which has been optimized away\n", debugstr_a(name.u.string));
         }
     }
     if (is_pmt && subpgm->func && symt_check_tag(subpgm->func->type, SymTagFunctionType))




More information about the wine-cvs mailing list