[PATCH 3/7] dbghelp: in SymGetLine* family, compute displacement relative to line_info's address

Eric Pouech eric.pouech at gmail.com
Fri Oct 29 08:37:17 CDT 2021


(was incorrectly computed relatively to the start of function)

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/dbghelp/symbol.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 43f7b3fdec2..30e1c0d2bf7 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -1853,7 +1853,7 @@ static BOOL get_line_from_addr(HANDLE hProcess, DWORD64 addr,
                                PDWORD pdwDisplacement, struct internal_line_t* intl)
 {
     struct line_info*           dli = NULL;
-    BOOL                        found = FALSE;
+    struct line_info*           found_dli = NULL;
     int                         i;
     struct module_pair          pair;
     struct symt_ht*             symt;
@@ -1870,14 +1870,14 @@ static BOOL get_line_from_addr(HANDLE hProcess, DWORD64 addr,
         dli = vector_at(&func->vlines, i);
         if (!dli->is_source_file)
         {
-            if (found || dli->u.address > addr) continue;
+            if (found_dli || dli->u.address > addr) continue;
             intl->line_number = dli->line_number;
             intl->address     = dli->u.address;
             intl->key         = dli;
-            found = TRUE;
+            found_dli = dli;
             continue;
         }
-        if (found)
+        if (found_dli)
         {
             BOOL ret;
             if (dbghelp_opt_native)
@@ -1891,7 +1891,7 @@ static BOOL get_line_from_addr(HANDLE hProcess, DWORD64 addr,
                 ret = internal_line_set_nameW(pair.pcs, intl, dospath, TRUE);
                 HeapFree( GetProcessHeap(), 0, dospath );
             }
-            if (ret) *pdwDisplacement = intl->address - func->address;
+            if (ret) *pdwDisplacement = addr - found_dli->u.address;
             return ret;
         }
     }




More information about the wine-devel mailing list