DbgHelp: Fix for Includes with Relative Paths
Robert Shearman
rob at codeweavers.com
Tue Aug 24 12:35:44 CDT 2004
Eric Pouech wrote:
> which means that:
> - we create a new compilation unit (for example) on 2205 => this gives
> the source directory
> - we start the main compilation unit on 2206 =>
> /home/dm/wine/dlls/dbghelp/elf_module.c
> - in this CU, we start a new include file (on xxxx), =>
> /home/dm/wine/dlls/dbghelp/../../include/winbase.h
> - ...
> - we close the CU on 4978
> Basically, as I wrote, you don't need two different beasts: currpath
> and srcpath. They refer to the same object, but the code is wrong.
>
> We should:
> - store the current directory on first SO (or the SO ended by a '/',
> which would be better)
> - on a non NULL SO, not ended by a '/' create a new compilation unit
> by concatening curr dir and the file name (or if file name is
> absolute, use the filename)
> - for each SOL, get the file name by concatening the curr dir with the
> file name (this operation is the same as above).
> - nuke the curr dir when getting a NULL SO
>
> current code is wrong as it creates two compilands for each
> compilation unit (one for each non NULL SO)
How does the attached patch look?
Rob
-------------- next part --------------
Index: wine/dlls/dbghelp/stabs.c
===================================================================
RCS file: /home/wine/wine/dlls/dbghelp/stabs.c,v
retrieving revision 1.8
diff -u -p -r1.8 stabs.c
--- wine/dlls/dbghelp/stabs.c 23 Aug 2004 17:56:07 -0000 1.8
+++ wine/dlls/dbghelp/stabs.c 24 Aug 2004 17:33:07 -0000
@@ -1085,8 +1085,8 @@ SYM_TYPE stabs_parse(struct module* modu
struct symt_function* curr_func = NULL;
struct symt_block* block = NULL;
struct symt_compiland* compiland = NULL;
- char currpath[PATH_MAX];
- char srcpath[PATH_MAX];
+ char currpath[PATH_MAX]; /* path to current file */
+ char srcpath[PATH_MAX]; /* path to directory source file is in */
int i, j;
int nstab;
const char* ptr;
@@ -1387,20 +1387,17 @@ SYM_TYPE stabs_parse(struct module* modu
}
else
{
- stabs_reset_includes();
- if (*ptr != '/')
+ int len = strlen(ptr);
+ if (ptr[len-1] != '/')
{
strcpy(currpath, srcpath);
strcat(currpath, ptr);
+ stabs_reset_includes();
compiland = symt_new_compiland(module, currpath);
source_idx = source_new(module, currpath);
}
else
- {
strcpy(srcpath, ptr);
- compiland = symt_new_compiland(module, srcpath);
- source_idx = source_new(module, srcpath);
- }
}
break;
case N_SOL:
More information about the wine-devel
mailing list