Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
I am currently working with threads using linux 2.6.11 and glibc 2.3.5
on x86. When i am trying to create thread with user defined stacks
glibc gives segmentation fault. I have written a wrapper to
pthread_create () and generated shared object for the same. When i am
trying to create any thread (for user defined stack) using this shared
object i am getting segmentation fault. If i don't create shared
object and try to create thread (with user defined stack) using same
code, it works fine. I am not able to understand this behavior. Why
creating a thread using shared object shall result in segfault. And
how to overcome this situation.
NOTE: I got same behavior when tried with linux 2.6.12 and glibc-2.3.6
on arm platform.
gdb output for the behavior is :
Loaded symbols for /lib/libgcc_s.so.1
#0 0x0018a777 in memset () from /lib/libc.so.6
(gdb) bt'
#0 0x0018a777 in memset () from /lib/libc.so.6
No symbol table info available.
#1 0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.
0
No symbol table info available.
#2 0x003e29fd in pthread_create@GLIBC_2.0 () from /lib/libpthread.so.
0
No symbol table info available.
#3 0x00ed9880 in process_create (entry_point=3D0x8048f4c
<ThreadEntryPoint>, pArg=3D0x1, pStack=3D0x82e08a8, ulStack_Size=3D16384,
ulPrio=3D127)
at multithreading.c:1916
stThAttr =3D {__size =3D "c\000\000\000\002\000\000\000j
\000\000\000\000\02 0\000\000=A8H.\b\000@", '\0' <repeats 13 times>,
__align =3D 99}
stSchedParam =3D {__sched_priority =3D 99}
pstTd =3D (ThreadData_t *) 0xedd7d8
state =3D 0
chPriority =3D 99 'c'
ulRetVal =3D 0
pRetVal =3D 0x0
__FUNCTION__ =3D "process_create"
#4 0x08049af8 in process_create_test (ulInParam=3D1) at
multithreading_test.c:539
ulIndex =3D 0
lRetVal =3D -1
ulThreadIndex =3D 1
lTestPassFlag =3D 0
stack =3D (void *) 0x82d88a8
pStack =3D (void *) 0x82e08a8
ulPrio =3D 127
stackSize =3D 16384
__FUNCTION__ =3D "process_create_test"
#5 0x0804b14b in main () at multithreading_test.c:1460
chChoice =3D "1"
lChoice =3D 1
stack =3D (void *) 0x0
stackSize =3D 0
ulPrio =3D 0
ulLoopIndex =3D 0
stTime =3D 134533384
stTimeInfo =3D {tm_sec =3D 4, tm_min =3D 53, tm_hour =3D 7, tm_mday =3D 7,
tm_mon =3D 3, tm_year =3D 74, tm_wday =3D 0, tm_yday =3D 96, tm_isdst =3D 0,
=
tm_gmtoff =3D 19800, tm_zone =3D 0x82d81b8 "IST"}
achTimebuf =3D "04/07/1974 07:53:w"
stThAttr =3D {__size =3D '\0' <repeats 13 times>, "\020", '\0' <repeats 21
times>, __align =3D 0}
lFlag =3D 1
chFlag =3D 0
lTestPassFlag =3D 0
ulThreadIndex =3D 0
ulloopIndex =3D 1
ulThreadId =3D {0, 0, 0, 0}
__FUNCTION__ =3D "main"
(gdb) f 0
#0 0x0018a777 in memset () from /lib/libc.so.6
(gdb) f 1
#1 0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.
0
(gdb)
Please let me know if someone can help me.
Thanks,
Ashish
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.