Regarding my previous question about GDB not defining a SIGSEGV point ,
My stream code is as follows:
void *runner(void *unused) { do { sem_wait(&x); ... if() { sem_post(&x); sleep(5); sem_wait(&x); if() { printf("LEAVING...\n"); sem_post(&x);
Main code:
sem_t x; int main(void) { sem_init(&x,0,1); ... pthread_t thrId; pthread_create(&thrId,NULL,runner,NULL); ... pthread_join(thrId,NULL); return(0); }
Edit: Having output (0) in the code of the runners stream makes the error null.
What could be causing stack damage?
GDB Output: (0xb7fe2b70 is the creeping line identifier)
LEAVING... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7fe2b70 (LWP 2604)] 0x00000011 in ?? ()
Valgrind Output:
==3076== Thread 2: ==3076== Jump to the invalid address stated on the next line ==3076== at 0x11: ??? ==3076== by 0xA26CCD: clone (clone.S:133) ==3076== Address 0x11 is not stack'd, malloc'd or (recently) free'd ==3076== ==3076== ==3076== Process terminating with default action of signal 11 (SIGSEGV) ==3076== Bad permissions for mapped region at address 0x11 ==3076== at 0x11: ??? ==3076== by 0xA26CCD: clone (clone.S:133) ==3076== Address 0x11 is not stack'd, malloc'd or (recently) free'd
user191776
source share