- Fix for non-threaded watchpoints.

This commit is contained in:
Jeff Johnston 2005-01-18 16:37:00 +00:00
parent 6edd3c8153
commit bc60002377
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,73 @@
2005-01-17 Jeff Johnston <jjohnstn@redhat.com>
* linux-nat.c (iterate_over_lwps): Add logic to handle
non-threaded applications using this function for watchpoints.
(linux_nat_inferior_created): New observer.
(_initialize_linux_nat): Register new observer.
--- gdb-6.3/gdb/linux-nat.c.fix Mon Jan 17 19:35:43 2005
+++ gdb-6.3/gdb/linux-nat.c Mon Jan 17 19:37:58 2005
@@ -1,6 +1,6 @@
/* GNU/Linux native-dependent code common to multiple platforms.
- Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GDB.
@@ -802,11 +802,23 @@ iterate_over_lwps (int (*callback) (stru
{
struct lwp_info *lp, *lpnext;
- for (lp = lwp_list; lp; lp = lpnext)
+ if (lwp_list != NULL)
{
- lpnext = lp->next;
+ for (lp = lwp_list; lp; lp = lpnext)
+ {
+ lpnext = lp->next;
+ if ((*callback) (lp, data))
+ return lp;
+ }
+ }
+ else
+ {
+ /* We are calling iterate_over_lwps for a non-threaded program.
+ Initialize the lwp list to the inferior's ptid. */
+ lp = add_lwp (BUILD_LWP (GET_PID (inferior_ptid),
+ GET_PID (inferior_ptid)));
if ((*callback) (lp, data))
- return lp;
+ return lp;
}
return NULL;
@@ -3103,6 +3115,17 @@ linux_proc_pending_signals (int pid, sig
fclose (procfile);
}
+/* Observer function for an inferior creation event. This is needed
+ because if iterate_over_lwps is called for a non-threaded program
+ to handle watchpoints, the lwp list gets initialized but there is
+ no corresponding clean-up if the program gets rerun or a new
+ program is run. */
+static void
+linux_nat_inferior_created (struct target_ops *objfile, int from_tty)
+{
+ init_lwp_list ();
+}
+
void
_initialize_linux_nat (void)
{
@@ -3120,7 +3143,9 @@ Specify any of the following keywords fo
stat -- list a bunch of random process info.\n\
status -- list a different bunch of random process info.\n\
all -- list all available /proc info.");
-
+
+ observer_attach_inferior_created (linux_nat_inferior_created);
+
init_linux_nat_ops ();
add_target (&linux_nat_ops);
thread_db_init (&linux_nat_ops);

View File

@ -11,7 +11,7 @@ Name: gdb
Version: 6.3.0.0
# The release always contains a leading reserved number, start it at 0.
Release: 0.2
Release: 0.3
License: GPL
Group: Development/Debuggers
@ -148,6 +148,9 @@ Patch126: gdb-6.3-ppcmalloc-20041124.patch
# Enable PPC CFI support.
Patch127: gdb-6.3-ppccfi-20041104.patch
# Fix for non-threaded watchpoints.
Patch128: gdb-6.3-nonthreaded-wp-20050117.patch
%ifarch ia64
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3
%else
@ -214,6 +217,7 @@ and printing their data.
%patch126 -p1
%patch127 -p1
%patch128 -p1
# Change the version that gets printed at GDB startup, so it is RedHat
# specific.
@ -382,6 +386,9 @@ fi
# don't include the files in include, they are part of binutils
%changelog
* Mon Jan 17 2005 Jeff Johnston <jjohnstn@redhat.com> 6.3.0.0-0.3
- Fix for non-threaded watchpoints.
* Mon Jan 17 2005 Andrew Cagney <cagney@redhat.com> 6.3.0.0-0.2
- Enable PPC CFI, remove merged ppc patches.