[PATCH 4/6] dbghelp/dwarf: Use the word size of the target process.

Zebediah Figura z.figura12 at gmail.com
Tue Jul 31 11:17:37 CDT 2018


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45490
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/dbghelp/dwarf.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 1dc2dc1..31c008a 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -820,9 +820,9 @@ compute_location(dwarf2_traverse_context_t* ctx, struct location* loc,
             if (hproc)
             {
                 DWORD_PTR addr = stack[stk--];
-                DWORD_PTR deref;
+                DWORD_PTR deref = 0;
 
-                if (!ReadProcessMemory(hproc, (void*)addr, &deref, sizeof(deref), NULL))
+                if (!ReadProcessMemory(hproc, (void*)addr, &deref, ctx->word_size, NULL))
                 {
                     WARN("Couldn't read memory at %lx\n", addr);
                     return loc_err_cant_read;
@@ -3117,7 +3117,8 @@ static ULONG_PTR eval_expression(const struct module* module, struct cpu_stack_w
         case DW_OP_constu:      stack[++sp] = dwarf2_leb128_as_unsigned(&ctx); break;
         case DW_OP_consts:      stack[++sp] = dwarf2_leb128_as_signed(&ctx); break;
         case DW_OP_deref:
-            if (!sw_read_mem(csw, stack[sp], &tmp, sizeof(tmp)))
+            tmp = 0;
+            if (!sw_read_mem(csw, stack[sp], &tmp, ctx.word_size))
             {
                 ERR("Couldn't read memory at %s\n", wine_dbgstr_longlong(stack[sp]));
                 tmp = 0;
@@ -3200,7 +3201,7 @@ static void apply_frame_state(const struct module* module, struct cpu_stack_walk
     {
     case RULE_EXPRESSION:
         *cfa = eval_expression(module, csw, (const unsigned char*)state->cfa_offset, context);
-        if (!sw_read_mem(csw, *cfa, cfa, sizeof(*cfa)))
+        if (!sw_read_mem(csw, *cfa, cfa, csw->cpu->word_size))
         {
             WARN("Couldn't read memory at %s\n", wine_dbgstr_longlong(*cfa));
             return;
-- 
2.7.4




More information about the wine-devel mailing list