From bc600023771837ca3ee2b79af771bb08c392680d Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 18 Jan 2005 16:37:00 +0000 Subject: [PATCH] - Fix for non-threaded watchpoints. --- gdb-6.3-nonthreaded-wp-20050117.patch | 73 +++++++++++++++++++++++++++ gdb.spec | 9 +++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 gdb-6.3-nonthreaded-wp-20050117.patch diff --git a/gdb-6.3-nonthreaded-wp-20050117.patch b/gdb-6.3-nonthreaded-wp-20050117.patch new file mode 100644 index 0000000..ac11166 --- /dev/null +++ b/gdb-6.3-nonthreaded-wp-20050117.patch @@ -0,0 +1,73 @@ +2005-01-17 Jeff Johnston + + * 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); diff --git a/gdb.spec b/gdb.spec index 8f5afb5..f62bdd2 100644 --- a/gdb.spec +++ b/gdb.spec @@ -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 6.3.0.0-0.3 +- Fix for non-threaded watchpoints. + * Mon Jan 17 2005 Andrew Cagney 6.3.0.0-0.2 - Enable PPC CFI, remove merged ppc patches.