Eric Pouech wrote:
Robert Shearman a écrit :
How does the attached patch look?
better, but you should to nuke srcpath (and no longer currpath) in N_SO case, when *ptr is '\0' (it's defensive code, so it shouldn't harm on normally formed stabs file). As a side effect, you don't need also to memset currpath to 0 at the beginning of func
Is the attached patch correct?
Rob
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 20:49:54 -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; @@ -1108,7 +1108,6 @@ SYM_TYPE stabs_parse(struct module* modu stab_ptr = (const struct stab_nlist*)(addr + staboff); strs = (const char*)(addr + strtaboff);
- memset(currpath, 0, sizeof(currpath)); memset(srcpath, 0, sizeof(srcpath)); memset(stabs_basic, 0, sizeof(stabs_basic));
@@ -1377,7 +1376,7 @@ SYM_TYPE stabs_parse(struct module* modu if (*ptr == '\0') /* end of N_SO file */ { /* Nuke old path. */ - currpath[0] = '\0'; + srcpath[0] = '\0'; stabs_finalize_function(module, curr_func); curr_func = NULL; source_idx = -1; @@ -1387,20 +1386,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: