1 |
24 |
jeremybenn |
/* Internal interfaces for the GNU/Linux specific target code for gdbserver.
|
2 |
|
|
Copyright (C) 2002, 2004, 2005, 2007, 2008 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 3 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, see <http://www.gnu.org/licenses/>. */
|
18 |
|
|
|
19 |
|
|
#ifdef HAVE_THREAD_DB_H
|
20 |
|
|
#include <thread_db.h>
|
21 |
|
|
#endif
|
22 |
|
|
|
23 |
|
|
#ifdef HAVE_LINUX_REGSETS
|
24 |
|
|
typedef void (*regset_fill_func) (void *);
|
25 |
|
|
typedef void (*regset_store_func) (const void *);
|
26 |
|
|
enum regset_type {
|
27 |
|
|
GENERAL_REGS,
|
28 |
|
|
FP_REGS,
|
29 |
|
|
EXTENDED_REGS,
|
30 |
|
|
};
|
31 |
|
|
|
32 |
|
|
struct regset_info
|
33 |
|
|
{
|
34 |
|
|
int get_request, set_request;
|
35 |
|
|
int size;
|
36 |
|
|
enum regset_type type;
|
37 |
|
|
regset_fill_func fill_function;
|
38 |
|
|
regset_store_func store_function;
|
39 |
|
|
};
|
40 |
|
|
extern struct regset_info target_regsets[];
|
41 |
|
|
#endif
|
42 |
|
|
|
43 |
|
|
struct linux_target_ops
|
44 |
|
|
{
|
45 |
|
|
int num_regs;
|
46 |
|
|
int *regmap;
|
47 |
|
|
int (*cannot_fetch_register) (int);
|
48 |
|
|
|
49 |
|
|
/* Returns 0 if we can store the register, 1 if we can not
|
50 |
|
|
store the register, and 2 if failure to store the register
|
51 |
|
|
is acceptable. */
|
52 |
|
|
int (*cannot_store_register) (int);
|
53 |
|
|
CORE_ADDR (*get_pc) (void);
|
54 |
|
|
void (*set_pc) (CORE_ADDR newpc);
|
55 |
|
|
const unsigned char *breakpoint;
|
56 |
|
|
int breakpoint_len;
|
57 |
|
|
CORE_ADDR (*breakpoint_reinsert_addr) (void);
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
int decr_pc_after_break;
|
61 |
|
|
int (*breakpoint_at) (CORE_ADDR pc);
|
62 |
|
|
|
63 |
|
|
/* Watchpoint related functions. See target.h for comments. */
|
64 |
|
|
int (*insert_watchpoint) (char type, CORE_ADDR addr, int len);
|
65 |
|
|
int (*remove_watchpoint) (char type, CORE_ADDR addr, int len);
|
66 |
|
|
int (*stopped_by_watchpoint) (void);
|
67 |
|
|
CORE_ADDR (*stopped_data_address) (void);
|
68 |
|
|
|
69 |
|
|
/* Whether to left-pad registers for PEEKUSR/POKEUSR if they are smaller
|
70 |
|
|
than an xfer unit. */
|
71 |
|
|
int left_pad_xfer;
|
72 |
|
|
|
73 |
|
|
/* What string to report to GDB when it asks for the architecture,
|
74 |
|
|
or NULL not to answer. */
|
75 |
|
|
const char *arch_string;
|
76 |
|
|
};
|
77 |
|
|
|
78 |
|
|
extern struct linux_target_ops the_low_target;
|
79 |
|
|
|
80 |
|
|
#define get_process(inf) ((struct process_info *)(inf))
|
81 |
|
|
#define get_thread_process(thr) (get_process (inferior_target_data (thr)))
|
82 |
|
|
#define get_process_thread(proc) ((struct thread_info *) \
|
83 |
|
|
find_inferior_id (&all_threads, \
|
84 |
|
|
get_process (proc)->lwpid))
|
85 |
|
|
|
86 |
|
|
struct process_info
|
87 |
|
|
{
|
88 |
|
|
struct inferior_list_entry head;
|
89 |
|
|
unsigned long lwpid;
|
90 |
|
|
|
91 |
|
|
/* If this flag is set, the next SIGSTOP will be ignored (the
|
92 |
|
|
process will be immediately resumed). This means that either we
|
93 |
|
|
sent the SIGSTOP to it ourselves and got some other pending event
|
94 |
|
|
(so the SIGSTOP is still pending), or that we stopped the
|
95 |
|
|
inferior implicitly via PTRACE_ATTACH and have not waited for it
|
96 |
|
|
yet. */
|
97 |
|
|
int stop_expected;
|
98 |
|
|
|
99 |
|
|
/* If this flag is set, the process is known to be stopped right now (stop
|
100 |
|
|
event already received in a wait()). */
|
101 |
|
|
int stopped;
|
102 |
|
|
|
103 |
|
|
/* When stopped is set, the last wait status recorded for this process. */
|
104 |
|
|
int last_status;
|
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;
|
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;
|
131 |
|
|
|
132 |
|
|
int thread_known;
|
133 |
|
|
unsigned long tid;
|
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);
|