| 1 | /* Native debugging support for GNU/Linux (LWP layer). |
| 2 | Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GDB. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | /* Structure describing an LWP. */ |
| 22 | |
| 23 | struct lwp_info |
| 24 | { |
| 25 | /* The process id of the LWP. This is a combination of the LWP id |
| 26 | and overall process id. */ |
| 27 | ptid_t ptid; |
| 28 | |
| 29 | /* Non-zero if this LWP is cloned. In this context "cloned" means |
| 30 | that the LWP is reporting to its parent using a signal other than |
| 31 | SIGCHLD. */ |
| 32 | int cloned; |
| 33 | |
| 34 | /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report |
| 35 | it back yet). */ |
| 36 | int signalled; |
| 37 | |
| 38 | /* Non-zero if this LWP is stopped. */ |
| 39 | int stopped; |
| 40 | |
| 41 | /* Non-zero if this LWP will be/has been resumed. Note that an LWP |
| 42 | can be marked both as stopped and resumed at the same time. This |
| 43 | happens if we try to resume an LWP that has a wait status |
| 44 | pending. We shouldn't let the LWP run until that wait status has |
| 45 | been processed, but we should not report that wait status if GDB |
| 46 | didn't try to let the LWP run. */ |
| 47 | int resumed; |
| 48 | |
| 49 | /* If non-zero, a pending wait status. */ |
| 50 | int status; |
| 51 | |
| 52 | /* Non-zero if we were stepping this LWP. */ |
| 53 | int step; |
| 54 | |
| 55 | /* Next LWP in list. */ |
| 56 | struct lwp_info *next; |
| 57 | }; |
| 58 | |
| 59 | /* Read/write to target memory via the Linux kernel's "proc file |
| 60 | system". */ |
| 61 | struct mem_attrib; |
| 62 | struct target_ops; |
| 63 | struct target_waitstatus; |
| 64 | |
| 65 | extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, |
| 66 | int write, struct mem_attrib *attrib, |
| 67 | struct target_ops *target); |
| 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 | extern void linux_child_post_startup_inferior (ptid_t ptid); |
| 78 | |
| 79 | /* Iterator function for lin-lwp's lwp list. */ |
| 80 | struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *, |
| 81 | void *), |
| 82 | void *data); |