| OLD | NEW |
| 1 /* Machine independent support for QNX Neutrino /proc (process file system) | 1 /* Machine independent support for QNX Neutrino /proc (process file system) |
| 2 for GDB. Written by Colin Burgess at QNX Software Systems Limited. | 2 for GDB. Written by Colin Burgess at QNX Software Systems Limited. |
| 3 | 3 |
| 4 Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc. | 4 Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc. |
| 5 | 5 |
| 6 Contributed by QNX Software Systems Ltd. | 6 Contributed by QNX Software Systems Ltd. |
| 7 | 7 |
| 8 This file is part of GDB. | 8 This file is part of GDB. |
| 9 | 9 |
| 10 This program is free software; you can redistribute it and/or modify | 10 This program is free software; you can redistribute it and/or modify |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 update_thread_private_data_name (new_thread, tn->name_buf); | 306 update_thread_private_data_name (new_thread, tn->name_buf); |
| 307 | 307 |
| 308 pti = (struct private_thread_info *) new_thread->private; | 308 pti = (struct private_thread_info *) new_thread->private; |
| 309 pti->tid = tid; | 309 pti->tid = tid; |
| 310 pti->state = state; | 310 pti->state = state; |
| 311 pti->flags = flags; | 311 pti->flags = flags; |
| 312 #endif /* _NTO_VERSION */ | 312 #endif /* _NTO_VERSION */ |
| 313 } | 313 } |
| 314 | 314 |
| 315 void | 315 static void |
| 316 procfs_find_new_threads (struct target_ops *ops) | 316 procfs_find_new_threads (struct target_ops *ops) |
| 317 { | 317 { |
| 318 procfs_status status; | 318 procfs_status status; |
| 319 pid_t pid; | 319 pid_t pid; |
| 320 ptid_t ptid; | 320 ptid_t ptid; |
| 321 pthread_t tid; | 321 pthread_t tid; |
| 322 struct thread_info *new_thread; | 322 struct thread_info *new_thread; |
| 323 | 323 |
| 324 if (ctl_fd == -1) | 324 if (ctl_fd == -1) |
| 325 return; | 325 return; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 sigset_t set; | 725 sigset_t set; |
| 726 siginfo_t info; | 726 siginfo_t info; |
| 727 procfs_status status; | 727 procfs_status status; |
| 728 static int exit_signo = 0; /* To track signals that cause termination. */ | 728 static int exit_signo = 0; /* To track signals that cause termination. */ |
| 729 | 729 |
| 730 ourstatus->kind = TARGET_WAITKIND_SPURIOUS; | 730 ourstatus->kind = TARGET_WAITKIND_SPURIOUS; |
| 731 | 731 |
| 732 if (ptid_equal (inferior_ptid, null_ptid)) | 732 if (ptid_equal (inferior_ptid, null_ptid)) |
| 733 { | 733 { |
| 734 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 734 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 735 ourstatus->value.sig = TARGET_SIGNAL_0; | 735 ourstatus->value.sig = GDB_SIGNAL_0; |
| 736 exit_signo = 0; | 736 exit_signo = 0; |
| 737 return null_ptid; | 737 return null_ptid; |
| 738 } | 738 } |
| 739 | 739 |
| 740 sigemptyset (&set); | 740 sigemptyset (&set); |
| 741 sigaddset (&set, SIGUSR1); | 741 sigaddset (&set, SIGUSR1); |
| 742 | 742 |
| 743 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); | 743 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); |
| 744 while (!(status.flags & _DEBUG_FLAG_ISTOP)) | 744 while (!(status.flags & _DEBUG_FLAG_ISTOP)) |
| 745 { | 745 { |
| 746 ofunc = (void (*)()) signal (SIGINT, nto_interrupt); | 746 ofunc = (void (*)()) signal (SIGINT, nto_interrupt); |
| 747 sigwaitinfo (&set, &info); | 747 sigwaitinfo (&set, &info); |
| 748 signal (SIGINT, ofunc); | 748 signal (SIGINT, ofunc); |
| 749 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); | 749 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); |
| 750 } | 750 } |
| 751 | 751 |
| 752 if (status.flags & _DEBUG_FLAG_SSTEP) | 752 if (status.flags & _DEBUG_FLAG_SSTEP) |
| 753 { | 753 { |
| 754 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 754 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 755 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 755 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 756 } | 756 } |
| 757 /* Was it a breakpoint? */ | 757 /* Was it a breakpoint? */ |
| 758 else if (status.flags & _DEBUG_FLAG_TRACE) | 758 else if (status.flags & _DEBUG_FLAG_TRACE) |
| 759 { | 759 { |
| 760 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 760 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 761 ourstatus->value.sig = TARGET_SIGNAL_TRAP; | 761 ourstatus->value.sig = GDB_SIGNAL_TRAP; |
| 762 } | 762 } |
| 763 else if (status.flags & _DEBUG_FLAG_ISTOP) | 763 else if (status.flags & _DEBUG_FLAG_ISTOP) |
| 764 { | 764 { |
| 765 switch (status.why) | 765 switch (status.why) |
| 766 { | 766 { |
| 767 case _DEBUG_WHY_SIGNALLED: | 767 case _DEBUG_WHY_SIGNALLED: |
| 768 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 768 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 769 ourstatus->value.sig = | 769 ourstatus->value.sig = |
| 770 » target_signal_from_host (status.info.si_signo); | 770 » gdb_signal_from_host (status.info.si_signo); |
| 771 exit_signo = 0; | 771 exit_signo = 0; |
| 772 break; | 772 break; |
| 773 case _DEBUG_WHY_FAULTED: | 773 case _DEBUG_WHY_FAULTED: |
| 774 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 774 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 775 if (status.info.si_signo == SIGTRAP) | 775 if (status.info.si_signo == SIGTRAP) |
| 776 { | 776 { |
| 777 ourstatus->value.sig = 0; | 777 ourstatus->value.sig = 0; |
| 778 exit_signo = 0; | 778 exit_signo = 0; |
| 779 } | 779 } |
| 780 else | 780 else |
| 781 { | 781 { |
| 782 ourstatus->value.sig = | 782 ourstatus->value.sig = |
| 783 » » target_signal_from_host (status.info.si_signo); | 783 » » gdb_signal_from_host (status.info.si_signo); |
| 784 exit_signo = ourstatus->value.sig; | 784 exit_signo = ourstatus->value.sig; |
| 785 } | 785 } |
| 786 break; | 786 break; |
| 787 | 787 |
| 788 case _DEBUG_WHY_TERMINATED: | 788 case _DEBUG_WHY_TERMINATED: |
| 789 { | 789 { |
| 790 int waitval = 0; | 790 int waitval = 0; |
| 791 | 791 |
| 792 waitpid (PIDGET (inferior_ptid), &waitval, WNOHANG); | 792 waitpid (PIDGET (inferior_ptid), &waitval, WNOHANG); |
| 793 if (exit_signo) | 793 if (exit_signo) |
| 794 { | 794 { |
| 795 /* Abnormal death. */ | 795 /* Abnormal death. */ |
| 796 ourstatus->kind = TARGET_WAITKIND_SIGNALLED; | 796 ourstatus->kind = TARGET_WAITKIND_SIGNALLED; |
| 797 ourstatus->value.sig = exit_signo; | 797 ourstatus->value.sig = exit_signo; |
| 798 } | 798 } |
| 799 else | 799 else |
| 800 { | 800 { |
| 801 /* Normal death. */ | 801 /* Normal death. */ |
| 802 ourstatus->kind = TARGET_WAITKIND_EXITED; | 802 ourstatus->kind = TARGET_WAITKIND_EXITED; |
| 803 ourstatus->value.integer = WEXITSTATUS (waitval); | 803 ourstatus->value.integer = WEXITSTATUS (waitval); |
| 804 } | 804 } |
| 805 exit_signo = 0; | 805 exit_signo = 0; |
| 806 break; | 806 break; |
| 807 } | 807 } |
| 808 | 808 |
| 809 case _DEBUG_WHY_REQUESTED: | 809 case _DEBUG_WHY_REQUESTED: |
| 810 /* We are assuming a requested stop is due to a SIGINT. */ | 810 /* We are assuming a requested stop is due to a SIGINT. */ |
| 811 ourstatus->kind = TARGET_WAITKIND_STOPPED; | 811 ourstatus->kind = TARGET_WAITKIND_STOPPED; |
| 812 » ourstatus->value.sig = TARGET_SIGNAL_INT; | 812 » ourstatus->value.sig = GDB_SIGNAL_INT; |
| 813 exit_signo = 0; | 813 exit_signo = 0; |
| 814 break; | 814 break; |
| 815 } | 815 } |
| 816 } | 816 } |
| 817 | 817 |
| 818 return ptid_build (status.pid, 0, status.tid); | 818 return ptid_build (status.pid, 0, status.tid); |
| 819 } | 819 } |
| 820 | 820 |
| 821 /* Read the current values of the inferior's registers, both the | 821 /* Read the current values of the inferior's registers, both the |
| 822 general register set and floating point registers (if supported) | 822 general register set and floating point registers (if supported) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 static int | 945 static int |
| 946 procfs_remove_hw_breakpoint (struct gdbarch *gdbarch, | 946 procfs_remove_hw_breakpoint (struct gdbarch *gdbarch, |
| 947 struct bp_target_info *bp_tgt) | 947 struct bp_target_info *bp_tgt) |
| 948 { | 948 { |
| 949 return procfs_breakpoint (bp_tgt->placed_address, | 949 return procfs_breakpoint (bp_tgt->placed_address, |
| 950 _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1); | 950 _DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, -1); |
| 951 } | 951 } |
| 952 | 952 |
| 953 static void | 953 static void |
| 954 procfs_resume (struct target_ops *ops, | 954 procfs_resume (struct target_ops *ops, |
| 955 » ptid_t ptid, int step, enum target_signal signo) | 955 » ptid_t ptid, int step, enum gdb_signal signo) |
| 956 { | 956 { |
| 957 int signal_to_pass; | 957 int signal_to_pass; |
| 958 procfs_status status; | 958 procfs_status status; |
| 959 sigset_t *run_fault = (sigset_t *) (void *) &run.fault; | 959 sigset_t *run_fault = (sigset_t *) (void *) &run.fault; |
| 960 | 960 |
| 961 if (ptid_equal (inferior_ptid, null_ptid)) | 961 if (ptid_equal (inferior_ptid, null_ptid)) |
| 962 return; | 962 return; |
| 963 | 963 |
| 964 procfs_set_thread (ptid_equal (ptid, minus_one_ptid) ? inferior_ptid : | 964 procfs_set_thread (ptid_equal (ptid, minus_one_ptid) ? inferior_ptid : |
| 965 ptid); | 965 ptid); |
| 966 | 966 |
| 967 run.flags = _DEBUG_RUN_FAULT | _DEBUG_RUN_TRACE; | 967 run.flags = _DEBUG_RUN_FAULT | _DEBUG_RUN_TRACE; |
| 968 if (step) | 968 if (step) |
| 969 run.flags |= _DEBUG_RUN_STEP; | 969 run.flags |= _DEBUG_RUN_STEP; |
| 970 | 970 |
| 971 sigemptyset (run_fault); | 971 sigemptyset (run_fault); |
| 972 sigaddset (run_fault, FLTBPT); | 972 sigaddset (run_fault, FLTBPT); |
| 973 sigaddset (run_fault, FLTTRACE); | 973 sigaddset (run_fault, FLTTRACE); |
| 974 sigaddset (run_fault, FLTILL); | 974 sigaddset (run_fault, FLTILL); |
| 975 sigaddset (run_fault, FLTPRIV); | 975 sigaddset (run_fault, FLTPRIV); |
| 976 sigaddset (run_fault, FLTBOUNDS); | 976 sigaddset (run_fault, FLTBOUNDS); |
| 977 sigaddset (run_fault, FLTIOVF); | 977 sigaddset (run_fault, FLTIOVF); |
| 978 sigaddset (run_fault, FLTIZDIV); | 978 sigaddset (run_fault, FLTIZDIV); |
| 979 sigaddset (run_fault, FLTFPE); | 979 sigaddset (run_fault, FLTFPE); |
| 980 /* Peter V will be changing this at some point. */ | 980 /* Peter V will be changing this at some point. */ |
| 981 sigaddset (run_fault, FLTPAGE); | 981 sigaddset (run_fault, FLTPAGE); |
| 982 | 982 |
| 983 run.flags |= _DEBUG_RUN_ARM; | 983 run.flags |= _DEBUG_RUN_ARM; |
| 984 | 984 |
| 985 signal_to_pass = target_signal_to_host (signo); | 985 signal_to_pass = gdb_signal_to_host (signo); |
| 986 | 986 |
| 987 if (signal_to_pass) | 987 if (signal_to_pass) |
| 988 { | 988 { |
| 989 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); | 989 devctl (ctl_fd, DCMD_PROC_STATUS, &status, sizeof (status), 0); |
| 990 signal_to_pass = target_signal_to_host (signo); | 990 signal_to_pass = gdb_signal_to_host (signo); |
| 991 if (status.why & (_DEBUG_WHY_SIGNALLED | _DEBUG_WHY_FAULTED)) | 991 if (status.why & (_DEBUG_WHY_SIGNALLED | _DEBUG_WHY_FAULTED)) |
| 992 { | 992 { |
| 993 if (signal_to_pass != status.info.si_signo) | 993 if (signal_to_pass != status.info.si_signo) |
| 994 { | 994 { |
| 995 SignalKill (nto_node (), PIDGET (inferior_ptid), 0, | 995 SignalKill (nto_node (), PIDGET (inferior_ptid), 0, |
| 996 signal_to_pass, 0, 0); | 996 signal_to_pass, 0, 0); |
| 997 run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG; | 997 run.flags |= _DEBUG_RUN_CLRFLT | _DEBUG_RUN_CLRSIG; |
| 998 } | 998 } |
| 999 else /* Let it kill the program without telling us. */ | 999 else /* Let it kill the program without telling us. */ |
| 1000 sigdelset (&run.trace, signal_to_pass); | 1000 sigdelset (&run.trace, signal_to_pass); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 | 1333 |
| 1334 static void | 1334 static void |
| 1335 procfs_pass_signals (int numsigs, unsigned char *pass_signals) | 1335 procfs_pass_signals (int numsigs, unsigned char *pass_signals) |
| 1336 { | 1336 { |
| 1337 int signo; | 1337 int signo; |
| 1338 | 1338 |
| 1339 sigfillset (&run.trace); | 1339 sigfillset (&run.trace); |
| 1340 | 1340 |
| 1341 for (signo = 1; signo < NSIG; signo++) | 1341 for (signo = 1; signo < NSIG; signo++) |
| 1342 { | 1342 { |
| 1343 int target_signo = target_signal_from_host (signo); | 1343 int target_signo = gdb_signal_from_host (signo); |
| 1344 if (target_signo < numsigs && pass_signals[target_signo]) | 1344 if (target_signo < numsigs && pass_signals[target_signo]) |
| 1345 sigdelset (&run.trace, signo); | 1345 sigdelset (&run.trace, signo); |
| 1346 } | 1346 } |
| 1347 } | 1347 } |
| 1348 | 1348 |
| 1349 static struct tidinfo * | 1349 static struct tidinfo * |
| 1350 procfs_thread_info (pid_t pid, short tid) | 1350 procfs_thread_info (pid_t pid, short tid) |
| 1351 { | 1351 { |
| 1352 /* NYI */ | 1352 /* NYI */ |
| 1353 return NULL; | 1353 return NULL; |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 char * | 1356 static char * |
| 1357 procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) | 1357 procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) |
| 1358 { | 1358 { |
| 1359 static char buf[1024]; | 1359 static char buf[1024]; |
| 1360 int pid, tid, n; | 1360 int pid, tid, n; |
| 1361 struct tidinfo *tip; | 1361 struct tidinfo *tip; |
| 1362 | 1362 |
| 1363 pid = ptid_get_pid (ptid); | 1363 pid = ptid_get_pid (ptid); |
| 1364 tid = ptid_get_tid (ptid); | 1364 tid = ptid_get_tid (ptid); |
| 1365 | 1365 |
| 1366 n = snprintf (buf, 1023, "process %d", pid); | 1366 n = snprintf (buf, 1023, "process %d", pid); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 struct expression *cond) | 1504 struct expression *cond) |
| 1505 { | 1505 { |
| 1506 return procfs_hw_watchpoint (addr, len, type); | 1506 return procfs_hw_watchpoint (addr, len, type); |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 static int | 1509 static int |
| 1510 procfs_stopped_by_watchpoint (void) | 1510 procfs_stopped_by_watchpoint (void) |
| 1511 { | 1511 { |
| 1512 return 0; | 1512 return 0; |
| 1513 } | 1513 } |
| OLD | NEW |