diff --git a/gdb-6.3-thread-step-20041207.patch b/gdb-6.3-thread-step-20041207.patch new file mode 100644 index 0000000..7737b7d --- /dev/null +++ b/gdb-6.3-thread-step-20041207.patch @@ -0,0 +1,58 @@ +2004-12-07 Jeff Johnston + + * linux-nat.c (find_singlestep_lwp_callback): New function. + (linux-nat-wait): Before waiting on any pid, check if there + is a stepping lwp and if so, wait on it specifically. + +--- gdb-6.3/gdb/linux-nat.c.fix Tue Dec 7 19:39:34 2004 ++++ gdb-6.3/gdb/linux-nat.c Tue Dec 7 19:39:46 2004 +@@ -1489,9 +1489,21 @@ count_events_callback (struct lwp_info * + return 0; + } + +-/* Select the LWP (if any) that is currently being single-stepped. */ ++/* Find an LWP (if any) that is currently being single-stepped. */ + + static int ++find_singlestep_lwp_callback (struct lwp_info *lp, void *data) ++{ ++ if (lp->step) ++ return 1; ++ else ++ return 0; ++} ++ ++/* Select the LWP with an event (if any) that is currently being ++ single-stepped. */ ++ ++static int + select_singlestep_lwp_callback (struct lwp_info *lp, void *data) + { + if (lp->step && lp->status != 0) +@@ -1774,7 +1786,25 @@ retry: + least if there are any LWPs at all. */ + gdb_assert (num_lwps == 0 || iterate_over_lwps (resumed_callback, NULL)); + +- /* First check if there is a LWP with a wait status pending. */ ++ /* Check if there is any LWP that is being single-stepped. We need to ++ wait specifically on such an LWP because the higher-level code is ++ expecting a step operation to find an event on the stepped LWP. ++ It is possible for other events to occur before the step operation ++ gets the expected trap so we don't want to wait on any LWP. ++ This has ramifications when adjustment of the PC is required which can be ++ different after a breakpoint vs a step (e.g. x86). */ ++ lp = iterate_over_lwps (find_singlestep_lwp_callback, NULL); ++ if (lp) { ++ if (debug_lin_lwp) ++ fprintf_unfiltered (gdb_stdlog, ++ "LLW: Found step lwp %s.\n", ++ target_pid_to_str (lp->ptid)); ++ ptid = lp->ptid; ++ pid = PIDGET (ptid); ++ } ++ ++ /* If any pid, check if there is a LWP with a wait status pending. */ ++ + if (pid == -1) + { + /* Any LWP that's been resumed will do. */ diff --git a/gdb.spec b/gdb.spec index b560dd4..392db10 100644 --- a/gdb.spec +++ b/gdb.spec @@ -45,15 +45,6 @@ Patch4: gdb-6.3-rh-testlibunwind1fix-20041202.patch # ------------------------------------------ -# Fix watchpoint support. -#Broken: Patch5: gdb-6.1post-watchpoint-fix.patch -# Thread fix. -#Broken: Patch6: gdb-6.1post-thread-fix.patch -# Fix to allow using libunwind 0.97 and up. -#Broken: Patch8: gdb-6.1post-libunwind.patch -# Fix to support applications calling clone directly -#Broken: Patch9: gdb-6.1post-linlwp-aug2004.patch - ####### ABI fixes and updates #Broken: Patch19: gdb-6.1post-abi-ppccfi-nov2004.patch #Broken: Patch23: gdb-6.1post-abi-ppc64main-aug2004.patch @@ -67,12 +58,6 @@ Patch50: gdb-6.1post-vsyscall-jul2004.patch #Broken: Patch51: gdb-6.1post-pie-jul2004.patch #Broken: Patch52: gdb-6.1post-test-pie-nov2004.patch -# Add java inferior call support -#Broken: Patch71: gdb-6.1post-java-infcall-aug2004.patch -# Add support for manually loaded/unloaded shlibs. -#Broken: Patch72: gdb-6.1post-unload-aug2004.patch -# Fix stepping in threads -#Broken: Patch73: gdb-6.1post-thread-step-sep2004.patch # Add threaded watchpoint support #Broken: Patch74: gdb-6.1post-threaded-watchpoints-sep2004.patch # Fix for thread_db_get_lwp @@ -146,6 +131,8 @@ Patch110: gdb-6.3-ppc64abi-20040621.patch # correct symbol is found. Patch111: gdb-6.3-ppc64displaysymbol-20041124.patch +# Fix stepping in threads +Patch112: gdb-6.3-thread-step-20041207.patch %ifarch ia64 BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu libunwind >= 0.96-3 @@ -191,6 +178,7 @@ and printing their data. %patch109 -p1 %patch110 -p1 %patch111 -p1 +%patch112 -p1 %patch50 -p1