mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
Don't write to inferior_ptid in darwin-nat.c
Untested. gdb/ChangeLog: 2020-06-18 Pedro Alves <palves@redhat.com> * darwin-nat.c (darwin_nat_target::decode_message): Don't write to inferior_ptid. (darwin_nat_target::stop_inferior, darwin_nat_target::kill): Avoid inferior_ptid. (darwin_attach_pid): Use switch_to_no_thread instead of writing to inferior_ptid directly. (darwin_nat_target::init_thread_list): Switch to thread, instead of writing to inferior_ptid. (darwin_nat_target::attach): Don't write to inferior_ptid. (darwin_nat_target::get_ada_task_ptid): Avoid inferior_ptid.
This commit is contained in:
@ -1,3 +1,16 @@
|
|||||||
|
2020-06-18 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* darwin-nat.c (darwin_nat_target::decode_message): Don't write to
|
||||||
|
inferior_ptid.
|
||||||
|
(darwin_nat_target::stop_inferior, darwin_nat_target::kill): Avoid
|
||||||
|
inferior_ptid.
|
||||||
|
(darwin_attach_pid): Use switch_to_no_thread instead of writing to
|
||||||
|
inferior_ptid directly.
|
||||||
|
(darwin_nat_target::init_thread_list): Switch to thread, instead
|
||||||
|
of writing to inferior_ptid.
|
||||||
|
(darwin_nat_target::attach): Don't write to inferior_ptid.
|
||||||
|
(darwin_nat_target::get_ada_task_ptid): Avoid inferior_ptid.
|
||||||
|
|
||||||
2020-06-18 Pedro Alves <palves@redhat.com>
|
2020-06-18 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added
|
* gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added
|
||||||
|
@ -1111,8 +1111,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr,
|
|||||||
/* Looks necessary on Leopard and harmless... */
|
/* Looks necessary on Leopard and harmless... */
|
||||||
wait4 (inf->pid, &wstatus, 0, NULL);
|
wait4 (inf->pid, &wstatus, 0, NULL);
|
||||||
|
|
||||||
inferior_ptid = ptid_t (inf->pid, 0, 0);
|
return ptid_t (inf->pid);
|
||||||
return inferior_ptid;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1402,7 +1401,7 @@ darwin_nat_target::stop_inferior (inferior *inf)
|
|||||||
/* Wait until the process is really stopped. */
|
/* Wait until the process is really stopped. */
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
ptid = wait_1 (inferior_ptid, &wstatus);
|
ptid = wait_1 (ptid_t (inf->pid), &wstatus);
|
||||||
if (wstatus.kind == TARGET_WAITKIND_STOPPED
|
if (wstatus.kind == TARGET_WAITKIND_STOPPED
|
||||||
&& wstatus.value.sig == GDB_SIGNAL_STOP)
|
&& wstatus.value.sig == GDB_SIGNAL_STOP)
|
||||||
break;
|
break;
|
||||||
@ -1527,13 +1526,13 @@ darwin_nat_target::kill ()
|
|||||||
|
|
||||||
darwin_resume_inferior (inf);
|
darwin_resume_inferior (inf);
|
||||||
|
|
||||||
ptid = wait_1 (inferior_ptid, &wstatus);
|
ptid = wait_1 (ptid_t (inf->pid), &wstatus);
|
||||||
}
|
}
|
||||||
else if (errno != ESRCH)
|
else if (errno != ESRCH)
|
||||||
warning (_("Failed to kill inferior: kill (%d, 9) returned [%s]"),
|
warning (_("Failed to kill inferior: kill (%d, 9) returned [%s]"),
|
||||||
inf->pid, safe_strerror (errno));
|
inf->pid, safe_strerror (errno));
|
||||||
|
|
||||||
target_mourn_inferior (inferior_ptid);
|
target_mourn_inferior (ptid_t (inf->pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1653,7 +1652,7 @@ darwin_attach_pid (struct inferior *inf)
|
|||||||
catch (const gdb_exception &ex)
|
catch (const gdb_exception &ex)
|
||||||
{
|
{
|
||||||
exit_inferior (inf);
|
exit_inferior (inf);
|
||||||
inferior_ptid = null_ptid;
|
switch_to_no_thread ();
|
||||||
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -1692,7 +1691,7 @@ darwin_nat_target::init_thread_list (inferior *inf)
|
|||||||
struct thread_info *first_thread
|
struct thread_info *first_thread
|
||||||
= thread_info_from_private_thread_info (first_pti);
|
= thread_info_from_private_thread_info (first_pti);
|
||||||
|
|
||||||
inferior_ptid = first_thread->ptid;
|
switch_to_thread (first_thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The child must synchronize with gdb: gdb must set the exception port
|
/* The child must synchronize with gdb: gdb must set the exception port
|
||||||
@ -2027,7 +2026,6 @@ darwin_nat_target::attach (const char *args, int from_tty)
|
|||||||
error (_("Can't attach to process %d: %s (%d)"),
|
error (_("Can't attach to process %d: %s (%d)"),
|
||||||
pid, safe_strerror (errno), errno);
|
pid, safe_strerror (errno), errno);
|
||||||
|
|
||||||
inferior_ptid = ptid_t (pid);
|
|
||||||
inf = current_inferior ();
|
inf = current_inferior ();
|
||||||
inferior_appeared (inf, pid);
|
inferior_appeared (inf, pid);
|
||||||
inf->attach_flag = 1;
|
inf->attach_flag = 1;
|
||||||
@ -2439,7 +2437,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread)
|
|||||||
names_count * sizeof (mach_port_t));
|
names_count * sizeof (mach_port_t));
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
return ptid_t (inferior_ptid.pid (), 0, res);
|
return ptid_t (current_inferior ()->pid, 0, res);
|
||||||
else
|
else
|
||||||
return null_ptid;
|
return null_ptid;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user