GNU Binutils with patches for OS216
修訂 | fe7d6a8db01f2a71520578267df7cd2d780ececb (tree) |
---|---|
時間 | 2020-06-19 07:11:57 |
作者 | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
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.
@@ -1,5 +1,18 @@ | ||
1 | 1 | 2020-06-18 Pedro Alves <palves@redhat.com> |
2 | 2 | |
3 | + * darwin-nat.c (darwin_nat_target::decode_message): Don't write to | |
4 | + inferior_ptid. | |
5 | + (darwin_nat_target::stop_inferior, darwin_nat_target::kill): Avoid | |
6 | + inferior_ptid. | |
7 | + (darwin_attach_pid): Use switch_to_no_thread instead of writing to | |
8 | + inferior_ptid directly. | |
9 | + (darwin_nat_target::init_thread_list): Switch to thread, instead | |
10 | + of writing to inferior_ptid. | |
11 | + (darwin_nat_target::attach): Don't write to inferior_ptid. | |
12 | + (darwin_nat_target::get_ada_task_ptid): Avoid inferior_ptid. | |
13 | + | |
14 | +2020-06-18 Pedro Alves <palves@redhat.com> | |
15 | + | |
3 | 16 | * gnu-nat.c (gnu_nat_target::create_inferior): Switch to the added |
4 | 17 | thread. |
5 | 18 | (gnu_nat_target::attach): Don't write to inferior_ptid directly. |
@@ -1111,8 +1111,7 @@ darwin_nat_target::decode_message (mach_msg_header_t *hdr, | ||
1111 | 1111 | /* Looks necessary on Leopard and harmless... */ |
1112 | 1112 | wait4 (inf->pid, &wstatus, 0, NULL); |
1113 | 1113 | |
1114 | - inferior_ptid = ptid_t (inf->pid, 0, 0); | |
1115 | - return inferior_ptid; | |
1114 | + return ptid_t (inf->pid); | |
1116 | 1115 | } |
1117 | 1116 | else |
1118 | 1117 | { |
@@ -1402,7 +1401,7 @@ darwin_nat_target::stop_inferior (inferior *inf) | ||
1402 | 1401 | /* Wait until the process is really stopped. */ |
1403 | 1402 | while (1) |
1404 | 1403 | { |
1405 | - ptid = wait_1 (inferior_ptid, &wstatus); | |
1404 | + ptid = wait_1 (ptid_t (inf->pid), &wstatus); | |
1406 | 1405 | if (wstatus.kind == TARGET_WAITKIND_STOPPED |
1407 | 1406 | && wstatus.value.sig == GDB_SIGNAL_STOP) |
1408 | 1407 | break; |
@@ -1527,13 +1526,13 @@ darwin_nat_target::kill () | ||
1527 | 1526 | |
1528 | 1527 | darwin_resume_inferior (inf); |
1529 | 1528 | |
1530 | - ptid = wait_1 (inferior_ptid, &wstatus); | |
1529 | + ptid = wait_1 (ptid_t (inf->pid), &wstatus); | |
1531 | 1530 | } |
1532 | 1531 | else if (errno != ESRCH) |
1533 | 1532 | warning (_("Failed to kill inferior: kill (%d, 9) returned [%s]"), |
1534 | 1533 | inf->pid, safe_strerror (errno)); |
1535 | 1534 | |
1536 | - target_mourn_inferior (inferior_ptid); | |
1535 | + target_mourn_inferior (ptid_t (inf->pid)); | |
1537 | 1536 | } |
1538 | 1537 | |
1539 | 1538 | static void |
@@ -1653,7 +1652,7 @@ darwin_attach_pid (struct inferior *inf) | ||
1653 | 1652 | catch (const gdb_exception &ex) |
1654 | 1653 | { |
1655 | 1654 | exit_inferior (inf); |
1656 | - inferior_ptid = null_ptid; | |
1655 | + switch_to_no_thread (); | |
1657 | 1656 | |
1658 | 1657 | throw; |
1659 | 1658 | } |
@@ -1692,7 +1691,7 @@ darwin_nat_target::init_thread_list (inferior *inf) | ||
1692 | 1691 | struct thread_info *first_thread |
1693 | 1692 | = thread_info_from_private_thread_info (first_pti); |
1694 | 1693 | |
1695 | - inferior_ptid = first_thread->ptid; | |
1694 | + switch_to_thread (first_thread); | |
1696 | 1695 | } |
1697 | 1696 | |
1698 | 1697 | /* 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) | ||
2027 | 2026 | error (_("Can't attach to process %d: %s (%d)"), |
2028 | 2027 | pid, safe_strerror (errno), errno); |
2029 | 2028 | |
2030 | - inferior_ptid = ptid_t (pid); | |
2031 | 2029 | inf = current_inferior (); |
2032 | 2030 | inferior_appeared (inf, pid); |
2033 | 2031 | inf->attach_flag = 1; |
@@ -2439,7 +2437,7 @@ darwin_nat_target::get_ada_task_ptid (long lwp, long thread) | ||
2439 | 2437 | names_count * sizeof (mach_port_t)); |
2440 | 2438 | |
2441 | 2439 | if (res) |
2442 | - return ptid_t (inferior_ptid.pid (), 0, res); | |
2440 | + return ptid_t (current_inferior ()->pid, 0, res); | |
2443 | 2441 | else |
2444 | 2442 | return null_ptid; |
2445 | 2443 | } |