blob: b8fb68bc6942a0878168fcae14a5e95454aff4d3 [file] [log] [blame]
Andrew Geissler84ad7c52020-06-27 00:00:16 -05001From e3e7d58035fb75b6cf33689352c6e22309c6dbde Mon Sep 17 00:00:00 2001
2From: Nagaraju Mekala <nmekala@xilix.com>
3Date: Fri, 17 Feb 2017 14:09:40 +0530
4Subject: [PATCH 39/43] Fixing the issues related to GDB-7.12 added all the
5 required function which are new in 7.12 and removed few deprecated functions
6 from 7.6
7
8---
9 gdb/config/microblaze/linux.mh | 4 +-
10 gdb/gdbserver/configure.srv | 3 +-
11 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
12 gdb/microblaze-linux-tdep.c | 68 +++++++++++++++++--
13 gdb/microblaze-tdep.h | 1 +
14 5 files changed, 153 insertions(+), 20 deletions(-)
15
16diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
17index a4eaf540e1..74a53b854a 100644
18--- a/gdb/config/microblaze/linux.mh
19+++ b/gdb/config/microblaze/linux.mh
20@@ -1,9 +1,11 @@
21 # Host: Microblaze, running Linux
22
23+#linux-nat.o linux-waitpid.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
24 NAT_FILE= config/nm-linux.h
25 NATDEPFILES= inf-ptrace.o fork-child.o \
26 microblaze-linux-nat.o proc-service.o linux-thread-db.o \
27- linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
28+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \
29+ linux-waitpid.o linux-personality.o linux-namespaces.o
30 NAT_CDEPS = $(srcdir)/proc-service.list
31
32 LOADLIBES = -ldl $(RDYNAMIC)
33diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
34index 153dcb4c71..201b7ae190 100644
35--- a/gdb/gdbserver/configure.srv
36+++ b/gdb/gdbserver/configure.srv
37@@ -211,8 +211,7 @@ case "${target}" in
38 srv_linux_thread_db=yes
39 ;;
40 microblaze*-*-linux*) srv_regobj=microblaze-linux.o
41- srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
42- srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
43+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
44 srv_linux_regsets=yes
45 srv_linux_usrregs=yes
46 srv_linux_thread_db=yes
47diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
48index cba5d6fc58..a2733f3c21 100644
49--- a/gdb/gdbserver/linux-microblaze-low.c
50+++ b/gdb/gdbserver/linux-microblaze-low.c
51@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
52 PT_FSR
53 };
54
55-#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
56+#define microblaze_num_regs (sizeof (microblaze_regmap) / sizeof (microblaze_regmap[0]))
57
58 /* Defined in auto-generated file microblaze-linux.c. */
59 void init_registers_microblaze (void);
60+extern const struct target_desc *tdesc_microblaze;
61
62 static int
63 microblaze_cannot_store_register (int regno)
64@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
65 static const unsigned long microblaze_breakpoint = 0xba0c0018;
66 #define microblaze_breakpoint_len 4
67
68+/* Implementation of linux_target_ops method "sw_breakpoint_from_kind". */
69+
70+static const gdb_byte *
71+microblaze_sw_breakpoint_from_kind (int kind, int *size)
72+{
73+ *size = microblaze_breakpoint_len;
74+ return (const gdb_byte *) &microblaze_breakpoint;
75+}
76+
77 static int
78 microblaze_breakpoint_at (CORE_ADDR where)
79 {
80@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcache *regcache)
81 static void
82 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
83 {
84- int size = register_size (regno);
85+ int size = register_size (regcache->tdesc, regno);
86
87 memset (buf, 0, sizeof (long));
88
89@@ -121,7 +131,7 @@ static void
90 microblaze_supply_ptrace_register (struct regcache *regcache,
91 int regno, const char *buf)
92 {
93- int size = register_size (regno);
94+ int size = register_size (regcache->tdesc, regno);
95
96 if (regno == 0) {
97 unsigned long regbuf_0 = 0;
98@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcache *regcache, const void *buf)
99
100 #endif /* HAVE_PTRACE_GETREGS */
101
102-struct regset_info target_regsets[] = {
103+static struct regset_info microblaze_regsets[] = {
104 #ifdef HAVE_PTRACE_GETREGS
105 { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
106- { 0, 0, 0, -1, -1, NULL, NULL },
107+ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
108 #endif /* HAVE_PTRACE_GETREGS */
109- { 0, 0, 0, -1, -1, NULL, NULL }
110+ { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
111+ NULL_REGSET
112 };
113
114+static struct usrregs_info microblaze_usrregs_info =
115+ {
116+ microblaze_num_regs,
117+ microblaze_regmap,
118+ };
119+
120+static struct regsets_info microblaze_regsets_info =
121+ {
122+ microblaze_regsets, /* regsets */
123+ 0, /* num_regsets */
124+ NULL, /* disabled_regsets */
125+ };
126+
127+static struct regs_info regs_info =
128+ {
129+ NULL, /* regset_bitmap */
130+ &microblaze_usrregs_info,
131+ &microblaze_regsets_info
132+ };
133+
134+static const struct regs_info *
135+microblaze_regs_info (void)
136+{
137+ return &regs_info;
138+}
139+
140+/* Support for hardware single step. */
141+
142+static int
143+microblaze_supports_hardware_single_step (void)
144+{
145+ return 1;
146+}
147+
148+
149+static void
150+microblaze_arch_setup (void)
151+{
152+ current_process ()->tdesc = tdesc_microblaze;
153+}
154+
155 struct linux_target_ops the_low_target = {
156- init_registers_microblaze,
157- microblaze_num_regs,
158- microblaze_regmap,
159- NULL,
160+ microblaze_arch_setup,
161+ microblaze_regs_info,
162 microblaze_cannot_fetch_register,
163 microblaze_cannot_store_register,
164 NULL, /* fetch_register */
165 microblaze_get_pc,
166 microblaze_set_pc,
167- (const unsigned char *) &microblaze_breakpoint,
168- microblaze_breakpoint_len,
169- microblaze_reinsert_addr,
170+ NULL,
171+ microblaze_sw_breakpoint_from_kind,
172+ NULL,
173 0,
174 microblaze_breakpoint_at,
175 NULL,
176 NULL,
177 NULL,
178 NULL,
179+ NULL,
180 microblaze_collect_ptrace_register,
181 microblaze_supply_ptrace_register,
182+ NULL, /* siginfo_fixup */
183+ NULL, /* new_process */
184+ NULL, /* new_thread */
185+ NULL, /* new_fork */
186+ NULL, /* prepare_to_resume */
187+ NULL, /* process_qsupported */
188+ NULL, /* supports_tracepoints */
189+ NULL, /* get_thread_area */
190+ NULL, /* install_fast_tracepoint_jump_pad */
191+ NULL, /* emit_ops */
192+ NULL, /* get_min_fast_tracepoint_insn_len */
193+ NULL, /* supports_range_stepping */
194+ NULL, /* breakpoint_kind_from_current_state */
195+ microblaze_supports_hardware_single_step,
196 };
197+
198+void
199+initialize_low_arch (void)
200+{
201+ init_registers_microblaze ();
202+}
203diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
204index e2225d778a..011e513941 100644
205--- a/gdb/microblaze-linux-tdep.c
206+++ b/gdb/microblaze-linux-tdep.c
207@@ -29,13 +29,76 @@
208 #include "regcache.h"
209 #include "value.h"
210 #include "osabi.h"
211-#include "regset.h"
212 #include "solib-svr4.h"
213 #include "microblaze-tdep.h"
214 #include "trad-frame.h"
215 #include "frame-unwind.h"
216 #include "tramp-frame.h"
217 #include "linux-tdep.h"
218+#include "glibc-tdep.h"
219+
220+#include "gdb_assert.h"
221+
222+#ifndef REGSET_H
223+#define REGSET_H 1
224+
225+struct gdbarch;
226+struct regcache;
227+
228+/* Data structure for the supported register notes in a core file. */
229+struct core_regset_section
230+{
231+ const char *sect_name;
232+ int size;
233+ const char *human_name;
234+};
235+
236+/* Data structure describing a register set. */
237+
238+typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
239+ int, const void *, size_t);
240+typedef void (collect_regset_ftype) (const struct regset *,
241+ const struct regcache *,
242+ int, void *, size_t);
243+
244+struct regset
245+{
246+ /* Data pointer for private use by the methods below, presumably
247+ providing some sort of description of the register set. */
248+ const void *descr;
249+
250+ /* Function supplying values in a register set to a register cache. */
251+ supply_regset_ftype *supply_regset;
252+
253+ /* Function collecting values in a register set from a register cache. */
254+ collect_regset_ftype *collect_regset;
255+
256+ /* Architecture associated with the register set. */
257+ struct gdbarch *arch;
258+};
259+
260+#endif
261+
262+/* Allocate a fresh 'struct regset' whose supply_regset function is
263+ SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
264+ If the regset has no collect_regset function, pass NULL for
265+ COLLECT_REGSET.
266+
267+ The object returned is allocated on ARCH's obstack. */
268+
269+struct regset *
270+regset_alloc (struct gdbarch *arch,
271+ supply_regset_ftype *supply_regset,
272+ collect_regset_ftype *collect_regset)
273+{
274+ struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
275+
276+ regset->arch = arch;
277+ regset->supply_regset = supply_regset;
278+ regset->collect_regset = collect_regset;
279+
280+ return regset;
281+}
282
283 static int microblaze_debug_flag = 0;
284
285@@ -207,9 +270,6 @@ microblaze_linux_init_abi (struct gdbarch_info info,
286 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
287 set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
288
289- set_gdbarch_regset_from_core_section (gdbarch,
290- microblaze_regset_from_core_section);
291-
292 /* Enable TLS support. */
293 set_gdbarch_fetch_tls_load_module_address (gdbarch,
294 svr4_fetch_objfile_link_map);
295diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
296index 02650f61d9..3777cbb6a8 100644
297--- a/gdb/microblaze-tdep.h
298+++ b/gdb/microblaze-tdep.h
299@@ -24,6 +24,7 @@
300 /* Microblaze architecture-specific information. */
301 struct microblaze_gregset
302 {
303+ microblaze_gregset() {}
304 unsigned int gregs[32];
305 unsigned int fpregs[32];
306 unsigned int pregs[16];
307--
3082.17.1
309