Eric Pouech : dbghelp: dwarf debug info: a few more fixes to dwarf parsing.

Alexandre Julliard julliard at winehq.org
Thu Aug 26 11:42:02 CDT 2010


Module: wine
Branch: master
Commit: 1e0af22ad2ed5a0dc9bf7f39814b00b223ce453f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1e0af22ad2ed5a0dc9bf7f39814b00b223ce453f

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Wed Aug 25 21:43:46 2010 +0200

dbghelp: dwarf debug info: a few more fixes to dwarf parsing.

---

 dlls/dbghelp/dbghelp_private.h |    1 +
 dlls/dbghelp/dwarf.c           |   16 ++++++++++++++++
 programs/winedbg/memory.c      |    5 ++++-
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index f4c88a0..531a740 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -132,6 +132,7 @@ enum location_error {loc_err_internal = -1,     /* internal while computing */
                      loc_err_too_complex = -2,  /* couldn't compute location (even at runtime) */
                      loc_err_out_of_scope = -3, /* variable isn't available at current address */
                      loc_err_cant_read = -4,    /* couldn't read memory at given address */
+                     loc_err_no_location = -5,  /* likely optimized away (by compiler) */
 };
 
 struct location
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index a0fcc12..d67c72a 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1511,6 +1511,22 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
         di->symt = &symt_new_constant(subpgm->ctx->module, subpgm->compiland,
                                       name.u.string, param_type, &v)->symt;
     }
+    else
+    {
+        /* variable has been optimiezd away... report anyway */
+        loc.kind = loc_error;
+        loc.reg = loc_err_no_location;
+        if (subpgm->func)
+        {
+            symt_add_func_local(subpgm->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", name.u.string);
+        }
+    }
     if (is_pmt && subpgm->func && subpgm->func->type)
         symt_add_function_signature_parameter(subpgm->ctx->module,
                                               (struct symt_function_signature*)subpgm->func->type,
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index 7d6112a..1c8388c 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -676,7 +676,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
     const struct dbg_internal_var*  div;
 
     /* negative register values are wine's dbghelp hacks
-     * see dlls/dbghelp/dbghelp_internal.h for the details      
+     * see dlls/dbghelp/dbghelp_private.h for the details
      */
     switch (regno)
     {
@@ -692,6 +692,9 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
     case -4:
         if (buffer) snprintf(buffer, len, "<couldn't read memory>");
         return FALSE;
+    case -5:
+        if (buffer) snprintf(buffer, len, "<has been optimized away by compiler>");
+        return FALSE;
     }
 
     for (div = be_cpu->context_vars; div->name; div++)




More information about the wine-cvs mailing list