]>
Commit | Line | Data |
---|---|---|
58caa3dc | 1 | /* Internal interfaces for the GNU/Linux specific target code for gdbserver. |
0fb0cc75 JB |
2 | Copyright (C) 2002, 2004, 2005, 2007, 2008, 2009 |
3 | Free Software Foundation, Inc. | |
58caa3dc DJ |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
58caa3dc DJ |
10 | (at your option) any later version. |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
58caa3dc | 19 | |
dae5f5cf DJ |
20 | #ifdef HAVE_THREAD_DB_H |
21 | #include <thread_db.h> | |
22 | #endif | |
23 | ||
58caa3dc | 24 | #ifdef HAVE_LINUX_REGSETS |
0d62e5e8 DJ |
25 | typedef void (*regset_fill_func) (void *); |
26 | typedef void (*regset_store_func) (const void *); | |
27 | enum regset_type { | |
28 | GENERAL_REGS, | |
29 | FP_REGS, | |
30 | EXTENDED_REGS, | |
31 | }; | |
32 | ||
58caa3dc DJ |
33 | struct regset_info |
34 | { | |
35 | int get_request, set_request; | |
36 | int size; | |
0d62e5e8 DJ |
37 | enum regset_type type; |
38 | regset_fill_func fill_function; | |
39 | regset_store_func store_function; | |
58caa3dc DJ |
40 | }; |
41 | extern struct regset_info target_regsets[]; | |
42 | #endif | |
2ec06d2e DJ |
43 | |
44 | struct linux_target_ops | |
45 | { | |
d05b4ac3 UW |
46 | /* Architecture-specific setup. */ |
47 | void (*arch_setup) (void); | |
48 | ||
2ec06d2e DJ |
49 | int num_regs; |
50 | int *regmap; | |
51 | int (*cannot_fetch_register) (int); | |
bc1e36ca DJ |
52 | |
53 | /* Returns 0 if we can store the register, 1 if we can not | |
54 | store the register, and 2 if failure to store the register | |
55 | is acceptable. */ | |
2ec06d2e | 56 | int (*cannot_store_register) (int); |
0d62e5e8 | 57 | CORE_ADDR (*get_pc) (void); |
611cb4a5 | 58 | void (*set_pc) (CORE_ADDR newpc); |
f450004a | 59 | const unsigned char *breakpoint; |
611cb4a5 DJ |
60 | int breakpoint_len; |
61 | CORE_ADDR (*breakpoint_reinsert_addr) (void); | |
0d62e5e8 DJ |
62 | |
63 | ||
64 | int decr_pc_after_break; | |
65 | int (*breakpoint_at) (CORE_ADDR pc); | |
e013ee27 OF |
66 | |
67 | /* Watchpoint related functions. See target.h for comments. */ | |
68 | int (*insert_watchpoint) (char type, CORE_ADDR addr, int len); | |
69 | int (*remove_watchpoint) (char type, CORE_ADDR addr, int len); | |
70 | int (*stopped_by_watchpoint) (void); | |
71 | CORE_ADDR (*stopped_data_address) (void); | |
72 | ||
ee1a7ae4 UW |
73 | /* Hooks to reformat register data for PEEKUSR/POKEUSR (in particular |
74 | for registers smaller than an xfer unit). */ | |
75 | void (*collect_ptrace_register) (int regno, char *buf); | |
76 | void (*supply_ptrace_register) (int regno, const char *buf); | |
2ec06d2e DJ |
77 | }; |
78 | ||
79 | extern struct linux_target_ops the_low_target; | |
0d62e5e8 | 80 | |
bd99dc85 PA |
81 | #define pid_of(proc) ((proc)->head.id) |
82 | #define lwpid_of(proc) ((proc)->head.id) | |
83 | ||
54a0b537 PA |
84 | #define get_lwp(inf) ((struct lwp_info *)(inf)) |
85 | #define get_thread_lwp(thr) (get_lwp (inferior_target_data (thr))) | |
86 | #define get_lwp_thread(proc) ((struct thread_info *) \ | |
87 | find_inferior_id (&all_threads, \ | |
bd99dc85 | 88 | lwpid_of (get_lwp (proc)))) |
0d62e5e8 | 89 | |
54a0b537 | 90 | struct lwp_info |
0d62e5e8 DJ |
91 | { |
92 | struct inferior_list_entry head; | |
0d62e5e8 | 93 | |
ae13219e DJ |
94 | /* If this flag is set, the next SIGSTOP will be ignored (the |
95 | process will be immediately resumed). This means that either we | |
96 | sent the SIGSTOP to it ourselves and got some other pending event | |
97 | (so the SIGSTOP is still pending), or that we stopped the | |
98 | inferior implicitly via PTRACE_ATTACH and have not waited for it | |
99 | yet. */ | |
0d62e5e8 DJ |
100 | int stop_expected; |
101 | ||
bd99dc85 PA |
102 | /* True if this thread was suspended (with vCont;t). */ |
103 | int suspended; | |
104 | ||
105 | /* If this flag is set, the lwp is known to be stopped right now (stop | |
0d62e5e8 DJ |
106 | event already received in a wait()). */ |
107 | int stopped; | |
108 | ||
bd99dc85 | 109 | /* When stopped is set, the last wait status recorded for this lwp. */ |
32ca6d61 DJ |
110 | int last_status; |
111 | ||
0d62e5e8 DJ |
112 | /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet |
113 | been reported. */ | |
114 | int status_pending_p; | |
115 | int status_pending; | |
116 | ||
117 | /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */ | |
118 | int pending_is_breakpoint; | |
119 | CORE_ADDR pending_stop_pc; | |
120 | ||
121 | /* If this is non-zero, it is a breakpoint to be reinserted at our next | |
122 | stop (SIGTRAP stops only). */ | |
123 | CORE_ADDR bp_reinsert; | |
124 | ||
125 | /* If this flag is set, the last continue operation on this process | |
126 | was a single-step. */ | |
127 | int stepping; | |
128 | ||
129 | /* If this is non-zero, it points to a chain of signals which need to | |
130 | be delivered to this process. */ | |
131 | struct pending_signals *pending_signals; | |
5544ad89 DJ |
132 | |
133 | /* A link used when resuming. It is initialized from the resume request, | |
54a0b537 | 134 | and then processed and cleared in linux_resume_one_lwp. */ |
5544ad89 DJ |
135 | |
136 | struct thread_resume *resume; | |
dae5f5cf | 137 | |
24a09b5f | 138 | int thread_known; |
dae5f5cf | 139 | #ifdef HAVE_THREAD_DB_H |
24a09b5f DJ |
140 | /* The thread handle, used for e.g. TLS access. Only valid if |
141 | THREAD_KNOWN is set. */ | |
dae5f5cf DJ |
142 | td_thrhandle_t th; |
143 | #endif | |
0d62e5e8 | 144 | }; |
5544ad89 | 145 | |
54a0b537 | 146 | extern struct inferior_list all_lwps; |
0d62e5e8 | 147 | |
24a09b5f | 148 | void linux_attach_lwp (unsigned long pid); |
0d62e5e8 | 149 | |
24a09b5f | 150 | int thread_db_init (int use_events); |
dae5f5cf DJ |
151 | int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset, |
152 | CORE_ADDR load_module, CORE_ADDR *address); |