gdb/gdb-6.6-step-thread-exit.patch
Jan Kratochvil e3c8b47c74 - Remove `gdb-6.3-nonthreaded-wp-20050117.patch' as obsoleted + regressing
now.
- Make the GDB quit processing non-abortable to cleanup everything
    properly.
- Support DW_TAG_constant for Fortran in recent Fedora/RH GCCs.
- Fix crash on DW_TAG_module for Fortran in recent Fedora/RH GCCs.
- Readd resolving of bare names of constructors and destructors.
- Include various vendor testcases:
- Leftover zombie process (BZ 243845).
- Multithreaded watchpoints (`gdb.threads/watchthreads2.exp').
- PIE testcases (`gdb.pie/*').
- C++ contructors/destructors (`gdb.cp/constructortest.exp').
2008-08-27 11:07:47 +00:00

77 lines
2.6 KiB
Diff

diff -up -rup gdb-6.8-clean/gdb/linux-nat.c gdb-6.8-new/gdb/linux-nat.c
--- gdb-6.8-clean/gdb/linux-nat.c 2008-08-26 00:04:08.000000000 +0200
+++ gdb-6.8-new/gdb/linux-nat.c 2008-08-26 00:04:50.000000000 +0200
@@ -1083,15 +1083,17 @@ resume_set_callback (struct lwp_info *lp
}
static void
-linux_nat_resume (ptid_t ptid, int step, enum target_signal signo)
+linux_nat_resume (ptid_t ptid, int step_int, enum target_signal signo)
{
struct lwp_info *lp;
int resume_all;
+ enum resume_step step = step_int;
if (debug_linux_nat)
fprintf_unfiltered (gdb_stdlog,
"LLR: Preparing to %s %s, %s, inferior_ptid %s\n",
- step ? "step" : "resume",
+ (step == RESUME_STEP_NEEDED
+ ? "needed" : (step ? "step" : "resume")),
target_pid_to_str (ptid),
signo ? strsignal (signo) : "0",
target_pid_to_str (inferior_ptid));
@@ -2076,6 +2078,9 @@ retry:
/* Check if the thread has exited. */
if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
{
+ enum resume_step step = lp->step;
+ pid_t pid = GET_PID (lp->ptid);
+
/* If this is the main thread, we must stop all threads and
verify if they are still alive. This is because in the nptl
thread model, there is no signal issued for exiting LWPs
@@ -2096,6 +2101,10 @@ retry:
fprintf_unfiltered (gdb_stdlog,
"LLW: %s exited.\n",
target_pid_to_str (lp->ptid));
+ /* Backward compatibility with:
+ gdb-6.3-step-thread-exit-20050211.patch */
+ if (step == RESUME_STEP_USER)
+ printf_unfiltered ("[Stepped over thread exit]\n");
exit_lwp (lp);
@@ -2104,8 +2113,29 @@ retry:
ignored. */
if (num_lwps > 0)
{
- /* Make sure there is at least one thread running. */
- gdb_assert (iterate_over_lwps (running_callback, NULL));
+ if (step == RESUME_STEP_USER)
+ {
+ /* Now stop the closest LWP's ... */
+ lp = find_lwp_pid (pid_to_ptid (pid));
+ if (!lp)
+ lp = lwp_list;
+ errno = 0;
+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
+ (void *) (unsigned long) SIGSTOP);
+ if (debug_linux_nat)
+ fprintf_unfiltered (gdb_stdlog,
+ "PTRACE_CONT %s, 0, 0 (%s)\n",
+ target_pid_to_str (lp->ptid),
+ errno ? safe_strerror (errno)
+ : "OK");
+ /* Avoid the silent `delayed SIGSTOP' handling. */
+ lp->signalled = 0;
+ }
+ else
+ {
+ /* Make sure there is at least one thread running. */
+ gdb_assert (iterate_over_lwps (running_callback, NULL));
+ }
/* Discard the event. */
status = 0;