This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug threads/10227] GDB resumes inferior unexpectedly when receiving ignored signal; step/next behave as continue


------- Additional Comments From ppluzhnikov at google dot com  2009-06-02 06:36 -------
Smaller/simpler test case:

/* compile with "gcc -pthread -g t.c"
 * Test program generates an endless stream of SIGPIPE in second thread.  */

#include <unistd.h>
#include <signal.h>
#include <pthread.h>

void *fn(void *p)
{
  int fd = *(int*)p;
  while (1) {
    int x = 1;
    x++;
    x++;
    write(fd, &x, sizeof(x));
  }
}

int foo()
{
  return 42;
}

int main()
{
  int fd[2];
  pthread_t tid;

  signal(SIGPIPE, SIG_IGN);

  if (pipe(fd) == -1)
    return 1;

  close(fd[0]);
  pthread_create(&tid, 0, fn, &fd[1]);

  while (1) {
    int x = foo();
  }
  return 0;
}


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=10227

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]