Package: gdb
Version: 6.8-1
Severity: normal
Tags: upstream

Hello,

please note I am not the original reporter of this bug, I just confirmed it.

If I compile the attached source, start debugging, break in print_pokus() and then run a lot of steps (eg. run step and hold enter), the program jumps somewhere out of the code and segfaults.

According to the original reproter, this is because gdb installs a breakpoint (int 3) in a function, then the threads switch and the other thread uses the code with the breakpoint (which is corrupted).

Also, it didn't happen with gdb 6.7 and lower.

Regards
    Jiri Palecek
#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

void* print_pokus(void *unused)
{
  while(1)
  {
	printf(" %s\n", (char *)unused);
  }

  return(NULL);
}

int main()
{
  pthread_t thread_id1;
  pthread_t thread_id2;
  pthread_t thread_id3;
 
  pthread_create(&thread_id1, NULL, &print_pokus, "1");
  pthread_create(&thread_id2, NULL, &print_pokus, "2");
  pthread_create(&thread_id3, NULL, &print_pokus, "3");

   while(1)
   {
 	sleep(1);
   }

   return(0);
}

Reply via email to