DbgHelp: Fix for Includes with Relative Paths

Robert Shearman rob at codeweavers.com
Mon Aug 23 09:10:22 CDT 2004


Hi,

On startup, the debugger usually prompted me to type the path where 
"/winternl.h" can be found. This was due to the path being stored 
internally as "../../include/winternl.h", i.e. relative to the source 
directory. This patch adds the ability to store the source directory and 
then use it when encountering an include path of this type to get the 
full path, which means no more prompting.

Rob

Changelog:
Store the current source directory and use it when encountering a 
relative include so that the full path to it is stored instead.

-------------- next part --------------
Index: wine/dlls/dbghelp/stabs.c
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/stabs.c,v
retrieving revision 1.7
diff -u -p -r1.7 stabs.c
--- wine/dlls/dbghelp/stabs.c	14 Jul 2004 00:44:27 -0000	1.7
+++ wine/dlls/dbghelp/stabs.c	23 Aug 2004 04:11:45 -0000
@@ -1086,6 +1086,7 @@ SYM_TYPE stabs_parse(struct module* modu
     struct symt_block*          block = NULL;
     struct symt_compiland*      compiland = NULL;
     char                        currpath[PATH_MAX];
+    char                        srcpath[PATH_MAX];
     int                         i, j;
     int                         nstab;
     const char*                 ptr;
@@ -1108,6 +1109,7 @@ SYM_TYPE stabs_parse(struct module* modu
     strs = (const char*)(addr + strtaboff);
 
     memset(currpath, 0, sizeof(currpath));
+    memset(srcpath, 0, sizeof(srcpath));
     memset(stabs_basic, 0, sizeof(stabs_basic));
 
     /*
@@ -1385,17 +1387,30 @@ SYM_TYPE stabs_parse(struct module* modu
             }
             else
             {
+                stabs_reset_includes();
                 if (*ptr != '/')
+                {
+                    strcpy(currpath, srcpath);
                     strcat(currpath, ptr);
+                    compiland = symt_new_compiland(module, currpath);
+                    source_idx = source_new(module, currpath);
+                }
                 else
-                    strcpy(currpath, ptr);
-                stabs_reset_includes();
-                compiland = symt_new_compiland(module, currpath);
-                source_idx = source_new(module, currpath);
+                {
+                    strcpy(srcpath, ptr);
+                    compiland = symt_new_compiland(module, srcpath);
+                    source_idx = source_new(module, srcpath);
+                }
             }
             break;
         case N_SOL:
-            strcpy(currpath, ptr);
+            if (*ptr != '/')
+            {
+                strcpy(currpath, srcpath);
+                strcat(currpath, ptr);
+            }
+            else
+                strcpy(currpath, ptr);
             source_idx = source_new(module, currpath);
             break;
         case N_UNDF:


More information about the wine-patches mailing list