Index: gnu/gdb/gdb/ChangeLog.linux diff -u gnu/gdb/gdb/ChangeLog.linux:1.12 gnu/gdb/gdb/ChangeLog.linux:1.13 --- gnu/gdb/gdb/ChangeLog.linux:1.12 Sun Jan 24 18:48:01 1999 +++ gnu/gdb/gdb/ChangeLog.linux Wed Feb 3 16:22:26 1999 @@ -1,3 +1,18 @@ +Wed Feb 3 07:17:41 1999 H.J. Lu + + * Makefile.in (VERSION): Updated to "4.17.0.10 with Linux + support". + + * lnx-thread.c (stop_thread): Send linuxthreads_sig_restart + to the suspended thread if linuxthreads_sig_debug > 0. + (update_stop_threads): Likewise. + (linuxthreads_wait): Allocate wstatus only once. + (linuxthreads_kill): Wait for all threads to exit after killing + them. + + * i386lnx-nat.c (i386_delete_watchpoint): Remove all hardware + watchpoints with the matching watchpoint number. + Sun Jan 24 18:32:22 1999 H.J. Lu * Makefile.in (VERSION): Updated to "4.17.0.9 with Linux Index: gnu/gdb/gdb/Makefile.in diff -u gnu/gdb/gdb/Makefile.in:1.11 gnu/gdb/gdb/Makefile.in:1.12 --- gnu/gdb/gdb/Makefile.in:1.11 Sun Jan 24 18:48:01 1999 +++ gnu/gdb/gdb/Makefile.in Wed Feb 3 16:22:27 1999 @@ -187,7 +187,7 @@ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION=4.17.0.9 with Linux support +VERSION=4.17.0.10 with Linux support DIST=gdb LINT=/usr/5bin/lint Index: gnu/gdb/gdb/i386lnx-nat.c diff -u gnu/gdb/gdb/i386lnx-nat.c:1.6 gnu/gdb/gdb/i386lnx-nat.c:1.7 --- gnu/gdb/gdb/i386lnx-nat.c:1.6 Sun Jan 24 18:48:01 1999 +++ gnu/gdb/gdb/i386lnx-nat.c Wed Feb 3 16:22:27 1999 @@ -739,13 +739,17 @@ int num; { int i; + int retval = -1; for (i = 0; i < DR_LASTADDR - DR_FIRSTADDR + 1; i++) - if (address_lookup[i].number == num) - return i386_remove_watchpoint (pid, num, - address_lookup[i].address, 0); + if (address_lookup[i].number == num + && address_lookup[i].address != 0) + { + i386_remove_watchpoint (pid, num, address_lookup[i].address, 0); + retval = 0; + } - return -1; + return retval; } /* Check if stopped by a watchpoint. */ Index: gnu/gdb/gdb/lnx-thread.c diff -u gnu/gdb/gdb/lnx-thread.c:1.4 gnu/gdb/gdb/lnx-thread.c:1.5 --- gnu/gdb/gdb/lnx-thread.c:1.4 Sun Jan 24 18:48:01 1999 +++ gnu/gdb/gdb/lnx-thread.c Wed Feb 3 16:22:27 1999 @@ -1,6 +1,6 @@ /* Low level interface for debugging GNU/Linux threads for GDB, the GNU debugger. - Copyright 1998 Free Software Foundation, Inc. + Copyright 1998, 1999 Free Software Foundation, Inc. This file is part of GDB. @@ -422,6 +422,11 @@ if (!linuxthreads_attach_pending) printf_unfiltered ("[New %s]\n", target_pid_to_str (pid)); add_thread (pid); + if (linuxthreads_sig_debug) + /* After a new thread in glibc 2.1 signals gdb its existence, + it suspends itself and wait for linuxthreads_sig_restart, + now we can wake up it. */ + kill (pid, linuxthreads_sig_restart); } else perror_with_name ("ptrace in stop_thread"); @@ -521,6 +526,13 @@ printf_unfiltered ("[New %s]\n", target_pid_to_str (test_pid)); add_thread (test_pid); + if (linuxthreads_sig_debug + && inferior_pid == test_pid) + /* After a new thread in glibc 2.1 signals gdb its + existence, it suspends itself and wait for + linuxthreads_sig_restart, now we can wake up + it. */ + kill (test_pid, linuxthreads_sig_restart); } } iterate_active_threads (stop_thread, 0); @@ -1007,6 +1019,9 @@ int last; int *wstatus; + if (linuxthreads_max && !linuxthreads_breakpoints_inserted) + wstatus = alloca (LINUXTHREAD_NSIG * sizeof (int)); + for (;;) { if (!linuxthreads_max) @@ -1018,7 +1033,6 @@ else if (pid < 0) pid = inferior_pid; last = rpid = 0; - wstatus = alloca (LINUXTHREAD_NSIG * sizeof (int)); } else if (pid < 0 && linuxthreads_wait_last >= 0) { @@ -1329,6 +1343,15 @@ if (!WIFEXITED(status)) ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0); } + + /* Wait for all threads. */ + do + rpid = waitpid (-1, &status, __WCLONE | WNOHANG); + while (rpid > 0 || errno == EINTR); + + do + rpid = waitpid (-1, &status, WNOHANG); + while (rpid > 0 || errno == EINTR); linuxthreads_mourn_inferior (); }