1157571Sjmg/* Internal interfaces for the GNU/Linux specific target code for gdbserver. 2157571Sjmg Copyright 2002, 2004 Free Software Foundation, Inc. 3157571Sjmg 4157571Sjmg This file is part of GDB. 5157571Sjmg 6157571Sjmg This program is free software; you can redistribute it and/or modify 7157571Sjmg it under the terms of the GNU General Public License as published by 8157571Sjmg the Free Software Foundation; either version 2 of the License, or 9157571Sjmg (at your option) any later version. 10157571Sjmg 11157571Sjmg This program is distributed in the hope that it will be useful, 12157571Sjmg but WITHOUT ANY WARRANTY; without even the implied warranty of 13157571Sjmg MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14157571Sjmg GNU General Public License for more details. 15157571Sjmg 16157571Sjmg You should have received a copy of the GNU General Public License 17157571Sjmg along with this program; if not, write to the Free Software 18157571Sjmg Foundation, Inc., 59 Temple Place - Suite 330, 19157571Sjmg Boston, MA 02111-1307, USA. */ 20157571Sjmg 21157574Sjmg/* 22157574Sjmg * $FreeBSD$ 23157574Sjmg */ 24157574Sjmg 25157571Sjmgtypedef void (*regset_fill_func) (void *); 26157571Sjmgtypedef void (*regset_store_func) (const void *); 27157571Sjmgenum regset_type { 28157571Sjmg GENERAL_REGS, 29157571Sjmg FP_REGS, 30157571Sjmg EXTENDED_REGS, 31157571Sjmg}; 32157571Sjmg 33157571Sjmgstruct regset_info 34157571Sjmg{ 35157571Sjmg int get_request, set_request; 36157571Sjmg int size; 37157571Sjmg enum regset_type type; 38157571Sjmg regset_fill_func fill_function; 39157571Sjmg regset_store_func store_function; 40157571Sjmg}; 41157571Sjmgextern struct regset_info target_regsets[]; 42157571Sjmg 43157574Sjmgstruct fbsd_target_ops 44157571Sjmg{ 45157571Sjmg int num_regs; 46157571Sjmg int *regmap; 47157571Sjmg int (*cannot_fetch_register) (int); 48157571Sjmg 49157571Sjmg /* Returns 0 if we can store the register, 1 if we can not 50157571Sjmg store the register, and 2 if failure to store the register 51157571Sjmg is acceptable. */ 52157571Sjmg int (*cannot_store_register) (int); 53157571Sjmg CORE_ADDR (*get_pc) (void); 54157571Sjmg void (*set_pc) (CORE_ADDR newpc); 55157571Sjmg const char *breakpoint; 56157571Sjmg int breakpoint_len; 57157571Sjmg CORE_ADDR (*breakpoint_reinsert_addr) (void); 58157571Sjmg 59157571Sjmg 60157571Sjmg int decr_pc_after_break; 61157571Sjmg int (*breakpoint_at) (CORE_ADDR pc); 62157571Sjmg}; 63157571Sjmg 64157574Sjmgextern struct fbsd_target_ops the_low_target; 65157571Sjmg 66157571Sjmg#define get_process(inf) ((struct process_info *)(inf)) 67157571Sjmg#define get_thread_process(thr) (get_process (inferior_target_data (thr))) 68157571Sjmg#define get_process_thread(proc) ((struct thread_info *) \ 69157571Sjmg find_inferior_id (&all_threads, \ 70157571Sjmg get_process (proc)->tid)) 71157571Sjmg 72157571Sjmgstruct process_info 73157571Sjmg{ 74157571Sjmg struct inferior_list_entry head; 75157571Sjmg int thread_known; 76157571Sjmg int lwpid; 77157571Sjmg int tid; 78157571Sjmg 79157571Sjmg /* If this flag is set, the next SIGSTOP will be ignored (the process will 80157571Sjmg be immediately resumed). */ 81157571Sjmg int stop_expected; 82157571Sjmg 83157571Sjmg /* If this flag is set, the process is known to be stopped right now (stop 84157571Sjmg event already received in a wait()). */ 85157571Sjmg int stopped; 86157571Sjmg 87157571Sjmg /* If this flag is set, we have sent a SIGSTOP to this process and are 88157571Sjmg waiting for it to stop. */ 89157571Sjmg int sigstop_sent; 90157571Sjmg 91157571Sjmg /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet 92157571Sjmg been reported. */ 93157571Sjmg int status_pending_p; 94157571Sjmg int status_pending; 95157571Sjmg 96157571Sjmg /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */ 97157571Sjmg int pending_is_breakpoint; 98157571Sjmg CORE_ADDR pending_stop_pc; 99157571Sjmg 100157571Sjmg /* If this is non-zero, it is a breakpoint to be reinserted at our next 101157571Sjmg stop (SIGTRAP stops only). */ 102157571Sjmg CORE_ADDR bp_reinsert; 103157571Sjmg 104157571Sjmg /* If this flag is set, the last continue operation on this process 105157571Sjmg was a single-step. */ 106157571Sjmg int stepping; 107157571Sjmg 108157571Sjmg /* If this is non-zero, it points to a chain of signals which need to 109157571Sjmg be delivered to this process. */ 110157571Sjmg struct pending_signals *pending_signals; 111157571Sjmg 112157571Sjmg /* A link used when resuming. It is initialized from the resume request, 113157574Sjmg and then processed and cleared in fbsd_resume_one_process. */ 114157571Sjmg 115157571Sjmg struct thread_resume *resume; 116157571Sjmg}; 117157571Sjmg 118157571Sjmgextern struct inferior_list all_processes; 119157571Sjmg 120157574Sjmgvoid fbsd_attach_lwp (int pid, int tid); 121157571Sjmg 122157571Sjmgint thread_db_init (void); 123