summaryrefslogtreecommitdiff
path: root/meta-xilinx/meta-microblaze/recipes-devtools/gdb/gdb/0039-Fixing-the-issues-related-to-GDB-7.12.patch
blob: fb4b35e5997778e312bfb5915ec3c7598c3c4e25 (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
From f13ffe15c10e5d4b5c87761ae9735144d4c8da17 Mon Sep 17 00:00:00 2001
From: Nagaraju Mekala <nmekala@xilix.com>
Date: Fri, 17 Feb 2017 14:09:40 +0530
Subject: [PATCH 39/40] 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/gdbserver/configure.srv          |  3 +-
 gdb/gdbserver/linux-microblaze-low.c | 97 ++++++++++++++++++++++++----
 gdb/microblaze-tdep.h                |  1 +
 4 files changed, 89 insertions(+), 16 deletions(-)

diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
index a4eaf540e1d..74a53b854a4 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/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index e0d2b2fe04a..26db2dd2461 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -185,8 +185,7 @@ case "${target}" 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_xmlfiles="microblaze-linux.xml"
 			srv_linux_regsets=yes
 			srv_linux_usrregs=yes
diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
index cba5d6fc585..a2733f3c21c 100644
--- a/gdb/gdbserver/linux-microblaze-low.c
+++ b/gdb/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 ();
+}
diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
index 8f41ba19351..d2112dc07e1 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];
-- 
2.17.1