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