http://bugs.winehq.org/show_bug.cgi?id=2257
Summary: Crash due to _fini Product: Wine Version: 20040505 Platform: Other OS/Version: other Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-binary AssignedTo: wine-bugs@winehq.org ReportedBy: rajeevb@interrait.com
Test Program :
#include <dlfcn.h> #include <direct.h> #include <math.h> #include <stdio.h>
main() { char *a; char *b; double d; void *mod, *ker; const char *error; mod=dlopen("msvcrt.dll.so",RTLD_LAZY); ker=dlopen("kernel32.dll.so",RTLD_LAZY); if(mod) {
if ((error = dlerror())) { printf("Couldn't find getcwd: %s\n", error); }
if(dlsym(mod, "getcwd")){ printf("found"); b=getcwd(a,20); }
dlclose(mod); dlclose(ker); } //end if return (0); } //end main
Build command :
g++ -g -Wall -c -I/home/timex/wine/wine-20040505/include -I. - I/home/timex/wine/wine-20040505/include/msvcrt test.cpp g++ -g -ldl /home/timex/wine/wine-20040505/dlls/msvcrt.dll.so test.o
Debugger output
[me@cvs TUCP]$ gdb -n GNU gdb Red Hat Linux (5.2.1-4) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux". (gdb) file ./a.out Reading symbols from ./a.out...done. (gdb) break test.cpp:10 Breakpoint 1 at 0x80486cc: file test.cpp, line 10. (gdb) run Starting program: /home/a.out
Breakpoint 1, main () at test.cpp:14 14 mod=dlopen("msvcrt.dll.so",RTLD_LAZY); (gdb) next 15 ker=dlopen("kernel32.dll.so",RTLD_LAZY); (gdb) disp mod 1: mod = (void *) 0x40013578 (gdb) disp ker 2: ker = (void *) 0x4026cc40 (gdb) next 16 if(mod) 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 19 if(dlsym(mod, "getcwd")) 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 20 {printf("found"); 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) next 21 b=getcwd(a,20); 2: ker = (void *) 0x8049b60 1: mod = (void *) 0x40013578 (gdb) step getcwd (buf=0x4026cc40 "T\v\022", size=20) at direct.h:73 73 static inline char* getcwd(char * buf, int size) { return _getcwd(buf, size); } (gdb) step _getcwd (buf=0x4026cc40 "T\v\022", size=20) at dir.c:424 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); Current language: auto; currently c (gdb) step 422 { (gdb) step 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); (gdb) step 422 { (gdb) step 424 int dir_len = GetCurrentDirectoryA(MAX_PATH,dir); (gdb) step
Program received signal SIGTRAP, Trace/breakpoint trap. 0x40062179 in _fini () from /home/timex/wine/wine-20040505/dlls/msvcrt.dll.so (gdb) bt #0 0x40062179 in _fini () from /home/timex/wine/wine- 20040505/dlls/msvcrt.dll.so #1 0x08048790 in getcwd (buf=0x4026cc40 "T\v\022", size=20) at direct.h:73 #2 0x08048730 in main () at test.cpp:21 #3 0x40161b84 in __libc_start_main () from /lib/libc.so.6 (gdb)