1 /* Native debugging support for GNU/Linux (LWP layer). 2 Copyright 2000, 2001, 2002, 2003, 2004 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 #include "target.h" 22 23 /* Structure describing an LWP. */ 24 25 struct lwp_info 26 { 27 /* The process id of the LWP. This is a combination of the LWP id 28 and overall process id. */ 29 ptid_t ptid; 30 31 /* Non-zero if this LWP is cloned. In this context "cloned" means 32 that the LWP is reporting to its parent using a signal other than 33 SIGCHLD. */ 34 int cloned; 35 36 /* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report 37 it back yet). */ 38 int signalled; 39 40 /* Non-zero if this LWP is stopped. */ 41 int stopped; 42 43 /* Non-zero if this LWP will be/has been resumed. Note that an LWP 44 can be marked both as stopped and resumed at the same time. This 45 happens if we try to resume an LWP that has a wait status 46 pending. We shouldn't let the LWP run until that wait status has 47 been processed, but we should not report that wait status if GDB 48 didn't try to let the LWP run. */ 49 int resumed; 50 51 /* If non-zero, a pending wait status. */ 52 int status; 53 54 /* Non-zero if we were stepping this LWP. */ 55 int step; 56 57 /* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus 58 for this LWP's last event. This may correspond to STATUS above, 59 or to a local variable in lin_lwp_wait. */ 60 struct target_waitstatus waitstatus; 61 62 /* Next LWP in list. */ 63 struct lwp_info *next; 64 }; 65 66 /* Read/write to target memory via the Linux kernel's "proc file 67 system". */ 68 struct mem_attrib; 69 struct target_ops; 70 71 extern int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, 72 int write, struct mem_attrib *attrib, 73 struct target_ops *target); 74 75 /* Find process PID's pending signal set from /proc/pid/status. */ 76 void linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored); 77 78 /* linux-nat functions for handling fork events. */ 79 extern void linux_record_stopped_pid (int pid); 80 extern void linux_enable_event_reporting (ptid_t ptid); 81 extern ptid_t linux_handle_extended_wait (int pid, int status, 82 struct target_waitstatus *ourstatus); 83 extern void linux_child_post_startup_inferior (ptid_t ptid); 84 85 /* Iterator function for lin-lwp's lwp list. */ 86 struct lwp_info *iterate_over_lwps (int (*callback) (struct lwp_info *, 87 void *), 88 void *data); 89