aboutsummaryrefslogtreecommitdiffstats
path: root/meta-microblaze/recipes-devtools/binutils/binutils/0040-Fixing-the-issues-related-to-GDB-7.12-added-all-the-.patch
blob: e08f16df97805995f17716776a985f9faafce5a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
From 976a0e2664559cc194eee8040280cd29e2672d26 Mon Sep 17 00:00:00 2001
From: Nagaraju Mekala <nmekala@xilix.com>
Date: Fri, 17 Feb 2017 14:09:40 +0530
Subject: [PATCH 40/52] Fixing the issues related to GDB-7.12 added all the
 required function which are new in 7.12 and removed few deprecated functions
 from 7.6

---
 gdb/config/microblaze/linux.mh   |  4 +-
 gdb/microblaze-linux-tdep.c      | 68 ++++++++++++++++++++--
 gdb/microblaze-tdep.h            |  1 +
 gdbserver/configure.srv          |  3 +-
 gdbserver/linux-microblaze-low.c | 97 +++++++++++++++++++++++++++-----
 5 files changed, 153 insertions(+), 20 deletions(-)

diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
index a4eaf540e1..74a53b854a 100644
--- a/gdb/config/microblaze/linux.mh
+++ b/gdb/config/microblaze/linux.mh
@@ -1,9 +1,11 @@
 # Host: Microblaze, running Linux
 
+#linux-nat.o linux-waitpid.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
 NAT_FILE= config/nm-linux.h
 NATDEPFILES= inf-ptrace.o fork-child.o \
 	microblaze-linux-nat.o proc-service.o linux-thread-db.o \
-	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o
+	linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \
+	linux-waitpid.o linux-personality.o linux-namespaces.o
 NAT_CDEPS = $(srcdir)/proc-service.list
 
 LOADLIBES = -ldl $(RDYNAMIC)
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 2725ce1789..a2e858d10f 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -29,13 +29,76 @@
 #include "regcache.h"
 #include "value.h"
 #include "osabi.h"
-#include "regset.h"
 #include "solib-svr4.h"
 #include "microblaze-tdep.h"
 #include "trad-frame.h"
 #include "frame-unwind.h"
 #include "tramp-frame.h"
 #include "linux-tdep.h"
+#include "glibc-tdep.h"
+
+#include "gdb_assert.h"
+
+#ifndef REGSET_H
+#define REGSET_H 1
+
+struct gdbarch;
+struct regcache;
+
+/* Data structure for the supported register notes in a core file.  */
+struct core_regset_section
+{
+  const char *sect_name;
+  int size;
+  const char *human_name;
+};
+
+/* Data structure describing a register set.  */
+
+typedef void (supply_regset_ftype) (const struct regset *, struct regcache *,
+                                    int, const void *, size_t);
+typedef void (collect_regset_ftype) (const struct regset *,
+                                     const struct regcache *,
+                                     int, void *, size_t);
+
+struct regset
+{
+  /* Data pointer for private use by the methods below, presumably
+     providing some sort of description of the register set.  */
+  const void *descr;
+
+  /* Function supplying values in a register set to a register cache.  */
+  supply_regset_ftype *supply_regset;
+
+  /* Function collecting values in a register set from a register cache.  */
+  collect_regset_ftype *collect_regset;
+
+  /* Architecture associated with the register set.  */
+  struct gdbarch *arch;
+};
+
+#endif
+
+/* Allocate a fresh 'struct regset' whose supply_regset function is
+   SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET.
+   If the regset has no collect_regset function, pass NULL for
+   COLLECT_REGSET.
+
+   The object returned is allocated on ARCH's obstack.  */
+
+struct regset *
+regset_alloc (struct gdbarch *arch,
+              supply_regset_ftype *supply_regset,
+              collect_regset_ftype *collect_regset)
+{
+  struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset);
+
+  regset->arch = arch;
+  regset->supply_regset = supply_regset;
+  regset->collect_regset = collect_regset;
+
+  return regset;
+}
 
 static int microblaze_debug_flag = 0;
 
@@ -207,9 +270,6 @@ microblaze_linux_init_abi (struct gdbarch_info info,
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
   set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
 
-  set_gdbarch_regset_from_core_section (gdbarch,
-					microblaze_regset_from_core_section);
-
   /* Enable TLS support.  */
   set_gdbarch_fetch_tls_load_module_address (gdbarch,
                                              svr4_fetch_objfile_link_map);
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index de66a05cab..1234f8a36f 100644
--- a/gdb/microblaze-tdep.h
+++ b/gdb/microblaze-tdep.h
@@ -24,6 +24,7 @@
 /* Microblaze architecture-specific information.  */
 struct microblaze_gregset
 {
+   microblaze_gregset() {}
    unsigned int gregs[32];
    unsigned int fpregs[32];
    unsigned int pregs[16];
diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv
index 7e81388850..456f4b3349 100644
--- a/gdbserver/configure.srv
+++ b/gdbserver/configure.srv
@@ -156,8 +156,7 @@ case "${gdbserver_host}" in
 			srv_linux_thread_db=yes
 			;;
   microblaze*-*-linux*)	srv_regobj=microblaze-linux.o
-			srv_tgtobj="linux-low.o linux-osdata.o linux-microblaze-low.o "
-			srv_tgtobj="${srv_tgtobj} linux-procfs.o linux-ptrace.o"
+			srv_tgtobj="$srv_linux_obj linux-microblaze-low.o "
 			srv_linux_regsets=yes
 			srv_linux_usrregs=yes
 			srv_linux_thread_db=yes
diff --git a/gdbserver/linux-microblaze-low.c b/gdbserver/linux-microblaze-low.c
index cba5d6fc58..a2733f3c21 100644
--- a/gdbserver/linux-microblaze-low.c
+++ b/gdbserver/linux-microblaze-low.c
@@ -39,10 +39,11 @@ static int microblaze_regmap[] =
   PT_FSR
   };
 
-#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
+#define microblaze_num_regs (sizeof (microblaze_regmap) / sizeof (microblaze_regmap[0]))
 
 /* Defined in auto-generated file microblaze-linux.c.  */
 void init_registers_microblaze (void);
+extern const struct target_desc *tdesc_microblaze;
 
 static int
 microblaze_cannot_store_register (int regno)
@@ -81,6 +82,15 @@ microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
 static const unsigned long microblaze_breakpoint = 0xba0c0018;
 #define microblaze_breakpoint_len 4
 
+/* Implementation of linux_target_ops method "sw_breakpoint_from_kind".  */
+
+static const gdb_byte *
+microblaze_sw_breakpoint_from_kind (int kind, int *size)
+{
+  *size = microblaze_breakpoint_len;
+  return (const gdb_byte *) &microblaze_breakpoint;
+}
+
 static int
 microblaze_breakpoint_at (CORE_ADDR where)
 {
@@ -107,7 +117,7 @@ microblaze_reinsert_addr (struct regcache *regcache)
 static void
 microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
 {
-  int size = register_size (regno);
+  int size = register_size (regcache->tdesc, regno);
 
   memset (buf, 0, sizeof (long));
 
@@ -121,7 +131,7 @@ static void
 microblaze_supply_ptrace_register (struct regcache *regcache,
 			    int regno, const char *buf)
 {
-  int size = register_size (regno);
+  int size = register_size (regcache->tdesc, regno);
 
   if (regno == 0) {
     unsigned long regbuf_0 = 0;
@@ -157,33 +167,94 @@ microblaze_store_gregset (struct regcache *regcache, const void *buf)
 
 #endif /* HAVE_PTRACE_GETREGS */
 
-struct regset_info target_regsets[] = {
+static struct regset_info microblaze_regsets[] = {
 #ifdef HAVE_PTRACE_GETREGS
   { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
-  { 0, 0, 0, -1, -1, NULL, NULL },
+  { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
 #endif /* HAVE_PTRACE_GETREGS */
-  { 0, 0, 0, -1, -1, NULL, NULL }
+  { 0, 0, 0, -1, GENERAL_REGS, NULL, NULL },
+  NULL_REGSET
 };
 
+static struct usrregs_info microblaze_usrregs_info =
+  {
+    microblaze_num_regs,
+    microblaze_regmap,
+  };
+
+static struct regsets_info microblaze_regsets_info =
+  {
+    microblaze_regsets, /* regsets */
+    0, /* num_regsets */
+    NULL, /* disabled_regsets */
+  };
+
+static struct regs_info regs_info =
+  {
+    NULL, /* regset_bitmap */
+    &microblaze_usrregs_info,
+    &microblaze_regsets_info
+  };
+
+static const struct regs_info *
+microblaze_regs_info (void)
+{
+  return &regs_info;
+}
+
+/* Support for hardware single step.  */
+
+static int
+microblaze_supports_hardware_single_step (void)
+{
+  return 1;
+}
+
+
+static void
+microblaze_arch_setup (void)
+{
+  current_process ()->tdesc = tdesc_microblaze;
+}
+
 struct linux_target_ops the_low_target = {
-  init_registers_microblaze,
-  microblaze_num_regs,
-  microblaze_regmap,
-  NULL,
+  microblaze_arch_setup,
+  microblaze_regs_info,
   microblaze_cannot_fetch_register,
   microblaze_cannot_store_register,
   NULL, /* fetch_register */
   microblaze_get_pc,
   microblaze_set_pc,
-  (const unsigned char *) &microblaze_breakpoint,
-  microblaze_breakpoint_len,
-  microblaze_reinsert_addr,
+  NULL,
+  microblaze_sw_breakpoint_from_kind,
+  NULL,
   0,
   microblaze_breakpoint_at,
   NULL,
   NULL,
   NULL,
   NULL,
+  NULL,
   microblaze_collect_ptrace_register,
   microblaze_supply_ptrace_register,
+  NULL, /* siginfo_fixup */
+  NULL, /* new_process */
+  NULL, /* new_thread */
+  NULL, /* new_fork */
+  NULL, /* prepare_to_resume */
+  NULL, /* process_qsupported */
+  NULL, /* supports_tracepoints */
+  NULL, /* get_thread_area */
+  NULL, /* install_fast_tracepoint_jump_pad */
+  NULL, /* emit_ops */
+  NULL, /* get_min_fast_tracepoint_insn_len */
+  NULL, /* supports_range_stepping */
+  NULL, /* breakpoint_kind_from_current_state */
+  microblaze_supports_hardware_single_step,
 };
+
+void
+initialize_low_arch (void)
+{
+  init_registers_microblaze ();
+}
-- 
2.17.1