]> git.ipfire.org Git - ipfire-3.x.git/blob - gdb/patches/gdb-6.6-step-thread-exit.patch
22afbea0c0e95d30f442c42df149203ae9088de9
[ipfire-3.x.git] / gdb / patches / gdb-6.6-step-thread-exit.patch
1 Index: gdb-7.2.50.20101116/gdb/linux-nat.c
2 ===================================================================
3 --- gdb-7.2.50.20101116.orig/gdb/linux-nat.c 2010-11-16 07:58:15.000000000 +0100
4 +++ gdb-7.2.50.20101116/gdb/linux-nat.c 2010-11-16 07:59:06.000000000 +0100
5 @@ -1863,16 +1863,18 @@ resume_set_callback (struct lwp_info *lp
6
7 static void
8 linux_nat_resume (struct target_ops *ops,
9 - ptid_t ptid, int step, enum target_signal signo)
10 + ptid_t ptid, int step_int, enum target_signal signo)
11 {
12 sigset_t prev_mask;
13 struct lwp_info *lp;
14 int resume_many;
15 + enum resume_step step = step_int;
16
17 if (debug_linux_nat)
18 fprintf_unfiltered (gdb_stdlog,
19 "LLR: Preparing to %s %s, %s, inferior_ptid %s\n",
20 - step ? "step" : "resume",
21 + (step == RESUME_STEP_NEEDED
22 + ? "needed" : (step ? "step" : "resume")),
23 target_pid_to_str (ptid),
24 (signo != TARGET_SIGNAL_0
25 ? strsignal (target_signal_to_host (signo)) : "0"),
26 @@ -3171,10 +3173,34 @@ linux_nat_filter_event (int lwpid, int s
27
28 if (num_lwps (GET_PID (lp->ptid)) > 1)
29 {
30 + enum resume_step step = lp->step;
31 + pid_t pid = GET_PID (lp->ptid);
32 +
33 /* If there is at least one more LWP, then the exit signal
34 was not the end of the debugged application and should be
35 ignored. */
36 exit_lwp (lp);
37 +
38 + if (step == RESUME_STEP_USER)
39 + {
40 + /* Now stop the closest LWP's ... */
41 + lp = find_lwp_pid (pid_to_ptid (pid));
42 + if (!lp)
43 + lp = lwp_list;
44 + gdb_assert (lp != NULL);
45 + errno = 0;
46 + ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
47 + (void *) (unsigned long) SIGSTOP);
48 + if (debug_linux_nat)
49 + fprintf_unfiltered (gdb_stdlog,
50 + "PTRACE_CONT %s, 0, 0 (%s)\n",
51 + target_pid_to_str (lp->ptid),
52 + errno ? safe_strerror (errno)
53 + : "OK");
54 + /* Avoid the silent `delayed SIGSTOP' handling. */
55 + lp->signalled = 0;
56 + }
57 +
58 return NULL;
59 }
60 }