| 1 | /* Native debugging support for GNU/Linux (LWP layer). |
| 2 | |
| 3 | Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 |
| 4 | Free Software Foundation, Inc. |
| 5 | |
| 6 | This file is part of GDB. |
| 7 | |
| 8 | This program is free software; you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation; either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 | Boston, MA 02110-1301, USA. */ |
| 22 | |
| 23 | #include "target.h" |
| 24 | |
| 25 | /* Structure describing an LWP. */ |
| 26 | |
| 27 | struct lwp_info |
| 28 | { |
| 29 | /* The process id of the LWP. This is a combination of the LWP id |
| 30 | and overall process id. */ |
| 31 | ptid_t ptid; |
| 32 | |
| 33 | /* Non-zero if this LWP is cloned. In this context "cloned" means |
| 34 | that the LWP is reporting to its parent using a signal other than |
| 35 | SIGCHLD. */ |
| 36 | int cloned; |
| 37 | |
| 38 | /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report |
| 39 | it back yet). */ |
| 40 | int signalled; |
| 41 | |
| 42 | /* Non-zero if this LWP is stopped. */ |
| 43 | int stopped; |
| 44 | |
| 45 | /* Non-zero if this LWP will be/has been resumed. Note that an LWP |
| 46 | can be marked both as stopped and resumed at the same time. This |
| 47 | happens if we try to resume an LWP that has a wait status |
| 48 | pending. We shouldn't let the LWP run until that wait status has |
| 49 | been processed, but we should not report that wait status if GDB |
| 50 | didn't try to let the LWP run. */ |
| 51 | int resumed; |
| 52 | |
| 53 | /* If non-zero, a pending wait status. */ |
| 54 | int status; |
| 55 | |
| 56 | /* Non-zero if we were stepping this LWP. */ |
| 57 | int step; |
| 58 | |
| 59 | /* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus |
| 60 | for this LWP's last event. This may correspond to STATUS above, |
| 61 | or to a local variable in lin_lwp_wait. */ |
| 62 | struct target_waitstatus waitstatus; |
| 63 | |
| 64 | /* Next LWP in list. */ |
| 65 | struct lwp_info *next; |
| 66 | }; |
| 67 | |
| 68 | |
| 69 | /* Find process PID's pending signal set from /proc/pid/status. */ |
| 70 | void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored); |
| 71 | |
| 72 | /* linux-nat functions for handling fork events. */ |
| 73 | extern void linux_record_stopped_pid (int pid); |
| 74 | extern void linux_enable_event_reporting (ptid_t ptid); |
| 75 | extern ptid_t linux_handle_extended_wait (int pid, int status, |
| 76 | struct target_waitstatus *ourstatus); |
| 77 | |
| 78 | /* Iterator function for lin-lwp's lwp list. */ |
| 79 | struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *, |
| 80 | void *), |
| 81 | void *data); |
| 82 | |
| 83 | /* Create a prototype generic Linux target. The client can override |
| 84 | it with local methods. */ |
| 85 | struct target_ops * linux_target (void); |