Commit | Line | Data |
---|---|---|
58caa3dc | 1 | /* Internal interfaces for the GNU/Linux specific target code for gdbserver. |
6f0f660e | 2 | Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. |
58caa3dc DJ |
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 | |
6f0f660e EZ |
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. */ | |
58caa3dc | 20 | |
dae5f5cf DJ |
21 | #ifdef HAVE_THREAD_DB_H |
22 | #include <thread_db.h> | |
23 | #endif | |
24 | ||
58caa3dc | 25 | #ifdef HAVE_LINUX_REGSETS |
0d62e5e8 DJ |
26 | typedef void (*regset_fill_func) (void *); |
27 | typedef void (*regset_store_func) (const void *); | |
28 | enum regset_type { | |
29 | GENERAL_REGS, | |
30 | FP_REGS, | |
31 | EXTENDED_REGS, | |
32 | }; | |
33 | ||
58caa3dc DJ |
34 | struct regset_info |
35 | { | |
36 | int get_request, set_request; | |
37 | int size; | |
0d62e5e8 DJ |
38 | enum regset_type type; |
39 | regset_fill_func fill_function; | |
40 | regset_store_func store_function; | |
58caa3dc DJ |
41 | }; |
42 | extern struct regset_info target_regsets[]; | |
43 | #endif | |
2ec06d2e DJ |
44 | |
45 | struct linux_target_ops | |
46 | { | |
47 | int num_regs; | |
48 | int *regmap; | |
49 | int (*cannot_fetch_register) (int); | |
bc1e36ca DJ |
50 | |
51 | /* Returns 0 if we can store the register, 1 if we can not | |
52 | store the register, and 2 if failure to store the register | |
53 | is acceptable. */ | |
2ec06d2e | 54 | int (*cannot_store_register) (int); |
0d62e5e8 | 55 | CORE_ADDR (*get_pc) (void); |
611cb4a5 | 56 | void (*set_pc) (CORE_ADDR newpc); |
f450004a | 57 | const unsigned char *breakpoint; |
611cb4a5 DJ |
58 | int breakpoint_len; |
59 | CORE_ADDR (*breakpoint_reinsert_addr) (void); | |
0d62e5e8 DJ |
60 | |
61 | ||
62 | int decr_pc_after_break; | |
63 | int (*breakpoint_at) (CORE_ADDR pc); | |
e013ee27 OF |
64 | |
65 | /* Watchpoint related functions. See target.h for comments. */ | |
66 | int (*insert_watchpoint) (char type, CORE_ADDR addr, int len); | |
67 | int (*remove_watchpoint) (char type, CORE_ADDR addr, int len); | |
68 | int (*stopped_by_watchpoint) (void); | |
69 | CORE_ADDR (*stopped_data_address) (void); | |
70 | ||
5a1f5858 DJ |
71 | /* Whether to left-pad registers for PEEKUSR/POKEUSR if they are smaller |
72 | than an xfer unit. */ | |
73 | int left_pad_xfer; | |
2ec06d2e DJ |
74 | }; |
75 | ||
76 | extern struct linux_target_ops the_low_target; | |
0d62e5e8 DJ |
77 | |
78 | #define get_process(inf) ((struct process_info *)(inf)) | |
79 | #define get_thread_process(thr) (get_process (inferior_target_data (thr))) | |
80 | #define get_process_thread(proc) ((struct thread_info *) \ | |
81 | find_inferior_id (&all_threads, \ | |
82 | get_process (proc)->tid)) | |
83 | ||
84 | struct process_info | |
85 | { | |
86 | struct inferior_list_entry head; | |
87 | int thread_known; | |
a1928bad DJ |
88 | unsigned long lwpid; |
89 | unsigned long tid; | |
0d62e5e8 DJ |
90 | |
91 | /* If this flag is set, the next SIGSTOP will be ignored (the process will | |
92 | be immediately resumed). */ | |
93 | int stop_expected; | |
94 | ||
95 | /* If this flag is set, the process is known to be stopped right now (stop | |
96 | event already received in a wait()). */ | |
97 | int stopped; | |
98 | ||
32ca6d61 DJ |
99 | /* When stopped is set, the last wait status recorded for this process. */ |
100 | int last_status; | |
101 | ||
0d62e5e8 DJ |
102 | /* If this flag is set, we have sent a SIGSTOP to this process and are |
103 | waiting for it to stop. */ | |
104 | int sigstop_sent; | |
105 | ||
106 | /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet | |
107 | been reported. */ | |
108 | int status_pending_p; | |
109 | int status_pending; | |
110 | ||
111 | /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */ | |
112 | int pending_is_breakpoint; | |
113 | CORE_ADDR pending_stop_pc; | |
114 | ||
115 | /* If this is non-zero, it is a breakpoint to be reinserted at our next | |
116 | stop (SIGTRAP stops only). */ | |
117 | CORE_ADDR bp_reinsert; | |
118 | ||
119 | /* If this flag is set, the last continue operation on this process | |
120 | was a single-step. */ | |
121 | int stepping; | |
122 | ||
123 | /* If this is non-zero, it points to a chain of signals which need to | |
124 | be delivered to this process. */ | |
125 | struct pending_signals *pending_signals; | |
5544ad89 DJ |
126 | |
127 | /* A link used when resuming. It is initialized from the resume request, | |
128 | and then processed and cleared in linux_resume_one_process. */ | |
129 | ||
130 | struct thread_resume *resume; | |
dae5f5cf DJ |
131 | |
132 | #ifdef HAVE_THREAD_DB_H | |
133 | /* The thread handle, used for e.g. TLS access. */ | |
134 | td_thrhandle_t th; | |
135 | #endif | |
0d62e5e8 | 136 | }; |
5544ad89 | 137 | |
0d62e5e8 DJ |
138 | extern struct inferior_list all_processes; |
139 | ||
a1928bad | 140 | void linux_attach_lwp (unsigned long pid, unsigned long tid); |
0d62e5e8 DJ |
141 | |
142 | int thread_db_init (void); | |
dae5f5cf DJ |
143 | int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset, |
144 | CORE_ADDR load_module, CORE_ADDR *address); |