]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-6.6-step-thread-exit.patch
- obsolete file
[packages/gdb.git] / gdb-6.6-step-thread-exit.patch
CommitLineData
3a58abaf
AM
1Index: gdb-6.8.50.20090226/gdb/linux-nat.c
2===================================================================
3--- gdb-6.8.50.20090226.orig/gdb/linux-nat.c 2009-02-27 00:04:35.000000000 +0100
4+++ gdb-6.8.50.20090226/gdb/linux-nat.c 2009-02-27 07:51:44.000000000 +0100
5@@ -1790,15 +1790,17 @@ 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 struct lwp_info *lp;
13 int resume_all;
14+ enum resume_step step = step_int;
15
16 if (debug_linux_nat)
17 fprintf_unfiltered (gdb_stdlog,
18 "LLR: Preparing to %s %s, %s, inferior_ptid %s\n",
19- step ? "step" : "resume",
20+ (step == RESUME_STEP_NEEDED
21+ ? "needed" : (step ? "step" : "resume")),
22 target_pid_to_str (ptid),
23 signo ? strsignal (signo) : "0",
24 target_pid_to_str (inferior_ptid));
25@@ -2740,6 +2742,9 @@ linux_nat_filter_event (int lwpid, int s
26 /* Check if the thread has exited. */
27 if ((WIFEXITED (status) || WIFSIGNALED (status)) && num_lwps > 1)
28 {
29+ enum resume_step step = lp->step;
30+ pid_t pid = GET_PID (lp->ptid);
31+
32 /* If this is the main thread, we must stop all threads and
33 verify if they are still alive. This is because in the nptl
34 thread model, there is no signal issued for exiting LWPs
35@@ -2763,6 +2768,26 @@ linux_nat_filter_event (int lwpid, int s
36
37 exit_lwp (lp);
38
39+ if (step == RESUME_STEP_USER)
40+ {
41+ /* Now stop the closest LWP's ... */
42+ lp = find_lwp_pid (pid_to_ptid (pid));
43+ if (!lp)
44+ lp = lwp_list;
45+ gdb_assert (lp != NULL);
46+ errno = 0;
47+ ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0,
48+ (void *) (unsigned long) SIGSTOP);
49+ if (debug_linux_nat)
50+ fprintf_unfiltered (gdb_stdlog,
51+ "PTRACE_CONT %s, 0, 0 (%s)\n",
52+ target_pid_to_str (lp->ptid),
53+ errno ? safe_strerror (errno)
54+ : "OK");
55+ /* Avoid the silent `delayed SIGSTOP' handling. */
56+ lp->signalled = 0;
57+ }
58+
59 /* If there is at least one more LWP, then the exit signal was
60 not the end of the debugged application and should be
61 ignored. */
This page took 0.0813970000000001 seconds and 4 git commands to generate.