| OLD | NEW |
| 1 /* QNX Neutrino specific low level interface, for the remote server | 1 /* QNX Neutrino specific low level interface, for the remote server |
| 2 for GDB. | 2 for GDB. |
| 3 Copyright (C) 2009-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2009-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 |
| 20 | 20 |
| 21 #include "server.h" | 21 #include "server.h" |
| 22 #include "gdbthread.h" |
| 22 #include "nto-low.h" | 23 #include "nto-low.h" |
| 23 | 24 |
| 24 #include <limits.h> | 25 #include <limits.h> |
| 25 #include <fcntl.h> | 26 #include <fcntl.h> |
| 26 #include <spawn.h> | 27 #include <spawn.h> |
| 27 #include <sys/procfs.h> | 28 #include <sys/procfs.h> |
| 28 #include <sys/auxv.h> | 29 #include <sys/auxv.h> |
| 29 #include <stdarg.h> | 30 #include <stdarg.h> |
| 30 #include <sys/iomgr.h> | 31 #include <sys/iomgr.h> |
| 31 #include <sys/neutrino.h> | 32 #include <sys/neutrino.h> |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 sigwaitinfo (&set, &info); | 525 sigwaitinfo (&set, &info); |
| 525 devctl (nto_inferior.ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), | 526 devctl (nto_inferior.ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), |
| 526 0); | 527 0); |
| 527 } | 528 } |
| 528 nto_find_new_threads (&nto_inferior); | 529 nto_find_new_threads (&nto_inferior); |
| 529 | 530 |
| 530 if (status.flags & _DEBUG_FLAG_SSTEP) | 531 if (status.flags & _DEBUG_FLAG_SSTEP) |
| 531 { | 532 { |
| 532 TRACE ("SSTEP\n"); | 533 TRACE ("SSTEP\n"); |
| 533 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 534 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 534 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 535 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 535 } | 536 } |
| 536 /* Was it a breakpoint? */ | 537 /* Was it a breakpoint? */ |
| 537 else if (status.flags & trace_mask) | 538 else if (status.flags & trace_mask) |
| 538 { | 539 { |
| 539 TRACE ("STOPPED\n"); | 540 TRACE ("STOPPED\n"); |
| 540 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 541 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 541 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 542 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 542 } | 543 } |
| 543 else if (status.flags & _DEBUG_FLAG_ISTOP) | 544 else if (status.flags & _DEBUG_FLAG_ISTOP) |
| 544 { | 545 { |
| 545 TRACE ("ISTOP\n"); | 546 TRACE ("ISTOP\n"); |
| 546 switch (status.why) | 547 switch (status.why) |
| 547 { | 548 { |
| 548 case _DEBUG_WHY_SIGNALLED: | 549 case _DEBUG_WHY_SIGNALLED: |
| 549 TRACE (" SIGNALLED\n"); | 550 TRACE (" SIGNALLED\n"); |
| 550 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 551 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 551 ourstatus->value.sig = | 552 ourstatus->value.sig = |
| 552 » target_signal_from_host (status.info.si_signo); | 553 » gdb_signal_from_host (status.info.si_signo); |
| 553 nto_inferior.exit_signo = ourstatus->value.sig; | 554 nto_inferior.exit_signo = ourstatus->value.sig; |
| 554 break; | 555 break; |
| 555 case _DEBUG_WHY_FAULTED: | 556 case _DEBUG_WHY_FAULTED: |
| 556 TRACE (" FAULTED\n"); | 557 TRACE (" FAULTED\n"); |
| 557 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 558 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 558 if (status.info.si_signo == SIGTRAP) | 559 if (status.info.si_signo == SIGTRAP) |
| 559 { | 560 { |
| 560 ourstatus->value.sig = 0; | 561 ourstatus->value.sig = 0; |
| 561 nto_inferior.exit_signo = 0; | 562 nto_inferior.exit_signo = 0; |
| 562 } | 563 } |
| 563 else | 564 else |
| 564 { | 565 { |
| 565 ourstatus->value.sig = | 566 ourstatus->value.sig = |
| 566 » » target_signal_from_host (status.info.si_signo); | 567 » » gdb_signal_from_host (status.info.si_signo); |
| 567 nto_inferior.exit_signo = ourstatus->value.sig; | 568 nto_inferior.exit_signo = ourstatus->value.sig; |
| 568 } | 569 } |
| 569 break; | 570 break; |
| 570 | 571 |
| 571 case _DEBUG_WHY_TERMINATED: | 572 case _DEBUG_WHY_TERMINATED: |
| 572 { | 573 { |
| 573 int waitval = 0; | 574 int waitval = 0; |
| 574 | 575 |
| 575 TRACE (" TERMINATED\n"); | 576 TRACE (" TERMINATED\n"); |
| 576 waitpid (ptid_get_pid (ptid), &waitval, WNOHANG); | 577 waitpid (ptid_get_pid (ptid), &waitval, WNOHANG); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 587 ourstatus->value.integer = WEXITSTATUS (waitval); | 588 ourstatus->value.integer = WEXITSTATUS (waitval); |
| 588 } | 589 } |
| 589 nto_inferior.exit_signo = 0; | 590 nto_inferior.exit_signo = 0; |
| 590 break; | 591 break; |
| 591 } | 592 } |
| 592 | 593 |
| 593 case _DEBUG_WHY_REQUESTED: | 594 case _DEBUG_WHY_REQUESTED: |
| 594 TRACE ("REQUESTED\n"); | 595 TRACE ("REQUESTED\n"); |
| 595 /* We are assuming a requested stop is due to a SIGINT. */ | 596 /* We are assuming a requested stop is due to a SIGINT. */ |
| 596 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 597 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 597 » ourstatus->value.sig = TARGET_SIGNAL_INT; | 598 » ourstatus->value.sig = GDB_SIGNAL_INT; |
| 598 nto_inferior.exit_signo = 0; | 599 nto_inferior.exit_signo = 0; |
| 599 break; | 600 break; |
| 600 } | 601 } |
| 601 } | 602 } |
| 602 | 603 |
| 603 return ptid_build (status.pid, status.tid, 0); | 604 return ptid_build (status.pid, status.tid, 0); |
| 604 } | 605 } |
| 605 | 606 |
| 606 /* Fetch inferior's registers for currently selected thread (CURRENT_INFERIOR). | 607 /* Fetch inferior's registers for currently selected thread (CURRENT_INFERIOR). |
| 607 If REGNO is -1, fetch all registers, or REGNO register only otherwise. */ | 608 If REGNO is -1, fetch all registers, or REGNO register only otherwise. */ |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 set_breakpoint_data (the_low_target.breakpoint, | 951 set_breakpoint_data (the_low_target.breakpoint, |
| 951 the_low_target.breakpoint_len); | 952 the_low_target.breakpoint_len); |
| 952 | 953 |
| 953 /* We use SIGUSR1 to gain control after we block waiting for a process. | 954 /* We use SIGUSR1 to gain control after we block waiting for a process. |
| 954 We use sigwaitevent to wait. */ | 955 We use sigwaitevent to wait. */ |
| 955 sigemptyset (&set); | 956 sigemptyset (&set); |
| 956 sigaddset (&set, SIGUSR1); | 957 sigaddset (&set, SIGUSR1); |
| 957 sigprocmask (SIG_BLOCK, &set, NULL); | 958 sigprocmask (SIG_BLOCK, &set, NULL); |
| 958 } | 959 } |
| 959 | 960 |
| OLD | NEW |