Eric Pouech : dbghelp: Properly manage in dbghelp interfaces local variables and parameters that are constant .

Alexandre Julliard julliard at winehq.org
Tue Jun 8 10:08:22 CDT 2010


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Mon Jun  7 21:50:46 2010 +0200

dbghelp: Properly manage in dbghelp interfaces local variables and parameters that are constant.

---

 dlls/dbghelp/dbghelp_private.h |    1 +
 dlls/dbghelp/module.c          |    1 +
 dlls/dbghelp/type.c            |   32 +++++++++++++++++++++++++++++---
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index de764ae..f4c88a0 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -347,6 +347,7 @@ struct module_format
 
 struct module
 {
+    struct process*             process;
     IMAGEHLP_MODULEW64          module;
     /* ANSI copy of module.ModuleName for efficiency */
     char                        module_name[MAX_PATH];
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index e99bd7f..89422a9 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -142,6 +142,7 @@ struct module* module_new(struct process* pcs, const WCHAR* name,
 
     pool_init(&module->pool, 65536);
 
+    module->process = pcs;
     module->module.SizeOfStruct = sizeof(module->module);
     module->module.BaseOfImage = mod_addr;
     module->module.ImageSize = size;
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c
index 2ef4bb4..e933e19 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -803,9 +803,35 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
         break;
 
     case TI_GET_VALUE:
-        if (type->tag != SymTagData || ((const struct symt_data*)type)->kind != DataIsConstant)
-            return FALSE;
-        X(VARIANT) = ((const struct symt_data*)type)->u.value;
+        if (type->tag != SymTagData) return FALSE;
+        switch (((const struct symt_data*)type)->kind)
+        {
+        case DataIsConstant: X(VARIANT) = ((const struct symt_data*)type)->u.value; break;
+        case DataIsLocal:
+        case DataIsParam:
+            {
+                struct location loc = ((const struct symt_data*)type)->u.var;
+                unsigned                i;
+                struct module_format*   modfmt;
+
+                if (loc.kind < loc_user) return FALSE;
+                for (i = 0; i < DFI_LAST; i++)
+                {
+                    modfmt = module->format_info[i];
+                    if (modfmt && modfmt->loc_compute)
+                    {
+                        modfmt->loc_compute(module->process, modfmt,
+                                            (const struct symt_function*)((const struct symt_data*)type)->container, &loc);
+                        break;
+                    }
+                }
+                if (loc.kind != loc_absolute) return FALSE;
+                X(VARIANT).n1.n2.vt = VT_UI4; /* FIXME */
+                X(VARIANT).n1.n2.n3.uiVal = loc.offset;
+            }
+            break;
+        default: return FALSE;
+        }
         break;
 
     case TI_GET_CALLING_CONVENTION:




More information about the wine-cvs mailing list