[LLVMdev] probleam about ThreadLocalImpl of llvm

bang bang shenoubang at gmail.com
Sun Jun 3 20:37:11 PDT 2012


Hi, everyone:
   I am very sorry to trouble you, but I need your help about my problem
about ThreadLocalImpl in llvm of 2.8 version. I have compiled it in Windows
xp with mingw, and have compiled skyeye(an open source project about
simulator) as it uses llvm. But when I run a testcase ---- arm_hello, it
came out segment fault. I used gdb.exe to trace it, it gave the following
infomation:

$ gdb.exe /opt/skyeye/bin/skyeye
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) set args -n -e arm_hello
(gdb) run
Starting program: C:/msys/1.0/opt/skyeye/bin/skyeye.exe -n -e arm_hello
[New thread 1696.0xec]

Program received signal SIGSEGV, Segmentation fault.
0x7c809f42 in KERNEL32!IsBadWritePtr () from
C:\WINDOWS\system32\kernel32.dll
(gdb) bt
#0  0x7c809f42 in KERNEL32!IsBadWritePtr ()
   from C:\WINDOWS\system32\kernel32.dll
#1  0x00000001 in ?? ()
#2  0xbaadf00d in ?? ()
#3  0x0002020b in ?? ()
#4  0x0022f904 in ?? ()
#5  0x0022f8b4 in ?? ()
#6  0x7c9301c0 in ntdll!RtlAppendStringToString ()
   from C:\WINDOWS\system32\ntdll.dll
#7  0x0022fb08 in ?? ()
#8  0x7c839ac0 in ValidateLocale () from C:\WINDOWS\system32\kernel32.dll
#9  0x71065fd0 in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll
#10 0x71066000 in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll
#11 0x71066c5a in msys-1!cfsetispeed () from C:\msys\1.0\bin\msys-1.0.dll
#12 0x7104129a in pthread_key_create () from C:\msys\1.0\bin\msys-1.0.dll
#13 0x66594055 in llvm::sys::ThreadLocalImpl::ThreadLocalImpl ()
   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll
#14 0x77c04ee5 in msvcrt!__doserrno () from C:\WINDOWS\system32\msvcrt.dll
#15 0x66081133 in atexit () from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll
#16 0x660810e1 in DllMainCRTStartup at 12 ()
   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll
#17 0x7c92118a in ntdll!LdrSetAppCompatDllRedirectionCallback ()
   from C:\WINDOWS\system32\ntdll.dll
#18 0x66080000 in ?? ()
#19 0x00000001 in ?? ()
#20 0x66081060 in __dll_exit ()
   from C:\msys\1.0\opt\skyeye\bin\libcommon-0.dll
#21 0x7c93c4da in ntdll!LdrHotPatchRoutine ()
   from C:\WINDOWS\system32\ntdll.dll
#22 0x7c941194 in ntdll!RtlMapGenericMask ()
   from C:\WINDOWS\system32\ntdll.dll
#23 0x7c94108f in ntdll!RtlMapGenericMask ()
   from C:\WINDOWS\system32\ntdll.dll
#24 0x7c92e437 in ntdll!LdrCreateOutOfProcessImage ()
   from C:\WINDOWS\system32\ntdll.dll
(gdb)

At last, I print some information in ThreadLocalImpl function:
 44 ThreadLocalImpl::ThreadLocalImpl() : data(0) {
 45   pthread_key_t* key = new pthread_key_t;
 46   printf("IN %s, line = %d key: 0x%x\n", __FUNCTION__, __LINE__, key);
 47   int errorcode = pthread_key_create(key, NULL);
 48   printf("In %s, line = %d\n", __FUNCTION__, __LINE__);
 49   assert(errorcode == 0);
 50   (void) errorcode;
 51   data = (void*)key;
 52 }


It print the following information:

$ /opt/skyeye/bin/skyeye.exe -n -e arm_hello
IN ThreadLocalImpl, line = 46 key: 0x3e2c68
-- 
ADDRESS:清华大学FIT楼4-308
TEL: 156-1166-2737
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120604/0f525e1a/attachment.html>


More information about the llvm-dev mailing list