]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/gdbserver/linux-low.h
Updated copyright notices for most files.
[thirdparty/binutils-gdb.git] / gdb / gdbserver / linux-low.h
1 /* Internal interfaces for the GNU/Linux specific target code for gdbserver.
2 Copyright (C) 2002, 2004, 2005, 2007, 2008, 2009
3 Free Software Foundation, Inc.
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
9 the Free Software Foundation; either version 3 of the License, or
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
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #ifdef HAVE_THREAD_DB_H
21 #include <thread_db.h>
22 #endif
23
24 #ifdef HAVE_LINUX_REGSETS
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
33 struct regset_info
34 {
35 int get_request, set_request;
36 int size;
37 enum regset_type type;
38 regset_fill_func fill_function;
39 regset_store_func store_function;
40 };
41 extern struct regset_info target_regsets[];
42 #endif
43
44 struct linux_target_ops
45 {
46 /* Architecture-specific setup. */
47 void (*arch_setup) (void);
48
49 int num_regs;
50 int *regmap;
51 int (*cannot_fetch_register) (int);
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. */
56 int (*cannot_store_register) (int);
57 CORE_ADDR (*get_pc) (void);
58 void (*set_pc) (CORE_ADDR newpc);
59 const unsigned char *breakpoint;
60 int breakpoint_len;
61 CORE_ADDR (*breakpoint_reinsert_addr) (void);
62
63
64 int decr_pc_after_break;
65 int (*breakpoint_at) (CORE_ADDR pc);
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
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);
77 };
78
79 extern struct linux_target_ops the_low_target;
80
81 #define get_process(inf) ((struct process_info *)(inf))
82 #define get_thread_process(thr) (get_process (inferior_target_data (thr)))
83 #define get_process_thread(proc) ((struct thread_info *) \
84 find_inferior_id (&all_threads, \
85 get_process (proc)->lwpid))
86
87 struct process_info
88 {
89 struct inferior_list_entry head;
90 unsigned long lwpid;
91
92 /* If this flag is set, the next SIGSTOP will be ignored (the
93 process will be immediately resumed). This means that either we
94 sent the SIGSTOP to it ourselves and got some other pending event
95 (so the SIGSTOP is still pending), or that we stopped the
96 inferior implicitly via PTRACE_ATTACH and have not waited for it
97 yet. */
98 int stop_expected;
99
100 /* If this flag is set, the process is known to be stopped right now (stop
101 event already received in a wait()). */
102 int stopped;
103
104 /* When stopped is set, the last wait status recorded for this process. */
105 int last_status;
106
107 /* If this flag is set, STATUS_PENDING is a waitstatus that has not yet
108 been reported. */
109 int status_pending_p;
110 int status_pending;
111
112 /* If this flag is set, the pending status is a (GDB-placed) breakpoint. */
113 int pending_is_breakpoint;
114 CORE_ADDR pending_stop_pc;
115
116 /* If this is non-zero, it is a breakpoint to be reinserted at our next
117 stop (SIGTRAP stops only). */
118 CORE_ADDR bp_reinsert;
119
120 /* If this flag is set, the last continue operation on this process
121 was a single-step. */
122 int stepping;
123
124 /* If this is non-zero, it points to a chain of signals which need to
125 be delivered to this process. */
126 struct pending_signals *pending_signals;
127
128 /* A link used when resuming. It is initialized from the resume request,
129 and then processed and cleared in linux_resume_one_process. */
130
131 struct thread_resume *resume;
132
133 int thread_known;
134 #ifdef HAVE_THREAD_DB_H
135 /* The thread handle, used for e.g. TLS access. Only valid if
136 THREAD_KNOWN is set. */
137 td_thrhandle_t th;
138 #endif
139 };
140
141 extern struct inferior_list all_processes;
142
143 void linux_attach_lwp (unsigned long pid);
144
145 int thread_db_init (int use_events);
146 int thread_db_get_tls_address (struct thread_info *thread, CORE_ADDR offset,
147 CORE_ADDR load_module, CORE_ADDR *address);