mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-17 16:05:56 +08:00
* inf-ptrace.c: Include "gdbthread.h".
(inf_ptrace_attach): Add the main thread here. * linux-nat.c (linux_nat_attach): Don't add the main thread here. Decorate the main thread id with the lwp id.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2008-09-08 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* inf-ptrace.c: Include "gdbthread.h".
|
||||||
|
(inf_ptrace_attach): Add the main thread here.
|
||||||
|
* linux-nat.c (linux_nat_attach): Don't add the main thread here.
|
||||||
|
Decorate the main thread id with the lwp id.
|
||||||
|
|
||||||
2008-09-08 Pedro Alves <pedro@codesourcery.com>
|
2008-09-08 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* linux-nat.c (linux_nat_wait): Update inferior_ptid's ptid with
|
* linux-nat.c (linux_nat_wait): Update inferior_ptid's ptid with
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include "inf-child.h"
|
#include "inf-child.h"
|
||||||
|
#include "gdbthread.h"
|
||||||
|
|
||||||
/* HACK: Save the ptrace ops returned by inf_ptrace_target. */
|
/* HACK: Save the ptrace ops returned by inf_ptrace_target. */
|
||||||
static struct target_ops *ptrace_ops_hack;
|
static struct target_ops *ptrace_ops_hack;
|
||||||
@ -218,6 +219,11 @@ inf_ptrace_attach (char *args, int from_tty)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
inferior_ptid = pid_to_ptid (pid);
|
inferior_ptid = pid_to_ptid (pid);
|
||||||
|
|
||||||
|
/* Always add a main thread. If some target extends the ptrace
|
||||||
|
target, it should decorate the ptid later with more info. */
|
||||||
|
add_thread_silent (inferior_ptid);
|
||||||
|
|
||||||
push_target (ptrace_ops_hack);
|
push_target (ptrace_ops_hack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1345,6 +1345,7 @@ linux_nat_attach (char *args, int from_tty)
|
|||||||
{
|
{
|
||||||
struct lwp_info *lp;
|
struct lwp_info *lp;
|
||||||
int status;
|
int status;
|
||||||
|
ptid_t ptid;
|
||||||
|
|
||||||
/* FIXME: We should probably accept a list of process id's, and
|
/* FIXME: We should probably accept a list of process id's, and
|
||||||
attach all of them. */
|
attach all of them. */
|
||||||
@ -1359,18 +1360,18 @@ linux_nat_attach (char *args, int from_tty)
|
|||||||
sigdelset (&suspend_mask, SIGCHLD);
|
sigdelset (&suspend_mask, SIGCHLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The ptrace base target adds the main thread with (pid,0,0)
|
||||||
|
format. Decorate it with lwp info. */
|
||||||
|
ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
|
||||||
|
thread_change_ptid (inferior_ptid, ptid);
|
||||||
|
|
||||||
/* Add the initial process as the first LWP to the list. */
|
/* Add the initial process as the first LWP to the list. */
|
||||||
inferior_ptid = BUILD_LWP (GET_PID (inferior_ptid), GET_PID (inferior_ptid));
|
lp = add_lwp (ptid);
|
||||||
lp = add_lwp (inferior_ptid);
|
|
||||||
|
|
||||||
status = linux_nat_post_attach_wait (lp->ptid, 1, &lp->cloned,
|
status = linux_nat_post_attach_wait (lp->ptid, 1, &lp->cloned,
|
||||||
&lp->signalled);
|
&lp->signalled);
|
||||||
lp->stopped = 1;
|
lp->stopped = 1;
|
||||||
|
|
||||||
/* If this process is not using thread_db, then we still don't
|
|
||||||
detect any other threads, but add at least this one. */
|
|
||||||
add_thread_silent (lp->ptid);
|
|
||||||
|
|
||||||
/* Save the wait status to report later. */
|
/* Save the wait status to report later. */
|
||||||
lp->resumed = 1;
|
lp->resumed = 1;
|
||||||
if (debug_linux_nat)
|
if (debug_linux_nat)
|
||||||
|
Reference in New Issue
Block a user