summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-devtools/gdb')
-rw-r--r--recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch69
-rw-r--r--recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch384
-rw-r--r--recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch67
-rw-r--r--recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch200
-rw-r--r--recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch553
-rw-r--r--recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch82
-rw-r--r--recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch156
-rw-r--r--recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch495
-rw-r--r--recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch43
-rw-r--r--recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch43
-rw-r--r--recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch34
-rw-r--r--recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch64
-rw-r--r--recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch192
-rw-r--r--recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch40
-rw-r--r--recipes-devtools/gdb/gdb-7.7.1.inc11
-rw-r--r--recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb4
-rw-r--r--recipes-devtools/gdb/gdb-cross_7.7.1.bb3
-rw-r--r--recipes-devtools/gdb/gdb-microblaze-7.7.inc22
-rw-r--r--recipes-devtools/gdb/gdb_7.7.1.bb29
19 files changed, 0 insertions, 2491 deletions
diff --git a/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch b/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch
deleted file mode 100644
index 3575cd7e..00000000
--- a/recipes-devtools/gdb/files/0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1From 8ab9a20c73acedbb636a41842a681872af8ae1d6 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 8 May 2013 11:03:36 +1000
4Subject: [PATCH 01/16] [Patch, microblaze]: Add wdc.ext.clear and
5 wdc.ext.flush insns
6
7Added two new instructions, wdc.ext.clear and wdc.ext.flush,
8to enable MicroBlaze to flush an external cache, which is
9used with the new coherency support for multiprocessing.
10
11Signed-off-by:nagaraju <nmekala@xilix.com>
12Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
13Upstream-Status: Pending
14---
15 opcodes/microblaze-opc.h | 5 ++++-
16 opcodes/microblaze-opcm.h | 6 +++---
17 2 files changed, 7 insertions(+), 4 deletions(-)
18
19diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
20index e3cc1d9..f453097 100644
21--- a/opcodes/microblaze-opc.h
22+++ b/opcodes/microblaze-opc.h
23@@ -91,6 +91,7 @@
24 #define OPCODE_MASK_H3 0xFC000600 /* High 6 bits and bits 21, 22. */
25 #define OPCODE_MASK_H32 0xFC00FC00 /* High 6 bits and bit 16-21. */
26 #define OPCODE_MASK_H34B 0xFC0000FF /* High 6 bits and low 8 bits. */
27+#define OPCODE_MASK_H35B 0xFC0004FF /* High 6 bits and low 9 bits. */
28 #define OPCODE_MASK_H34C 0xFC0007E0 /* High 6 bits and bits 21-26. */
29
30 /* New Mask for msrset, msrclr insns. */
31@@ -101,7 +102,7 @@
32 #define DELAY_SLOT 1
33 #define NO_DELAY_SLOT 0
34
35-#define MAX_OPCODES 289
36+#define MAX_OPCODES 291
37
38 struct op_code_struct
39 {
40@@ -174,7 +175,9 @@ struct op_code_struct
41 {"wic", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000068, OPCODE_MASK_H34B, wic, special_inst },
42 {"wdc", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000064, OPCODE_MASK_H34B, wdc, special_inst },
43 {"wdc.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000066, OPCODE_MASK_H34B, wdcclear, special_inst },
44+ {"wdc.ext.clear", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000466, OPCODE_MASK_H35B, wdcextclear, special_inst },
45 {"wdc.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000074, OPCODE_MASK_H34B, wdcflush, special_inst },
46+ {"wdc.ext.flush", INST_TYPE_R1_R2_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x90000476, OPCODE_MASK_H35B, wdcextflush, special_inst },
47 {"mts", INST_TYPE_SPECIAL_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MTS, 0x9400C000, OPCODE_MASK_H13S, mts, special_inst },
48 {"mfs", INST_TYPE_RD_SPECIAL, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_MFS, 0x94008000, OPCODE_MASK_H23S, mfs, special_inst },
49 {"br", INST_TYPE_R2, INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x98000000, OPCODE_MASK_H124, br, branch_inst },
50diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
51index 6868389..8f5c1cb 100644
52--- a/opcodes/microblaze-opcm.h
53+++ b/opcodes/microblaze-opcm.h
54@@ -31,9 +31,9 @@ enum microblaze_instr
55 idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
56 ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
57 andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16,
58- wic, wdc, wdcclear, wdcflush, mts, mfs, mbar, br, brd,
59- brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned, blt,
60- bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
61+ wic, wdc, wdcclear, wdcextclear, wdcflush, wdcextflush, mts, mfs, mbar,
62+ br, brd, brld, bra, brad, brald, microblaze_brk, beq, beqd, bne, bned,
63+ blt, bltd, ble, bled, bgt, bgtd, bge, bged, ori, andi, xori, andni,
64 imm, rtsd, rtid, rtbd, rted, bri, brid, brlid, brai, braid, bralid,
65 brki, beqi, beqid, bnei, bneid, blti, bltid, blei, bleid, bgti,
66 bgtid, bgei, bgeid, lbu, lbur, lhu, lhur, lw, lwr, lwx, sb, sbr, sh,
67--
681.9.0
69
diff --git a/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch b/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch
deleted file mode 100644
index 5d856408..00000000
--- a/recipes-devtools/gdb/files/0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch
+++ /dev/null
@@ -1,384 +0,0 @@
1From da27c7161c676550f5fe8a4e0f7f395e5e0d4770 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 18 May 2012 11:49:50 +1000
4Subject: [PATCH 03/16] [Patch, microblaze]: Initial port of microblaze core
5 reading support
6
7Added support for reading notes in linux core dumps
8Support for reading of PRSTATUS and PSINFO information for rebuilding
9".reg" sections of core dumps at run time.
10
11Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
12Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
13Upstream-Status: Pending
14---
15 bfd/elf32-microblaze.c | 64 ++++++++++++++++++++++++++++++++
16 gdb/configure.tgt | 2 +-
17 gdb/microblaze-linux-tdep.c | 61 +++++++++++++++++++++++++++++++
18 gdb/microblaze-tdep.c | 89 +++++++++++++++++++++++++++++++++++++++++++++
19 gdb/microblaze-tdep.h | 28 ++++++++++++++
20 5 files changed, 243 insertions(+), 1 deletion(-)
21
22diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
23index 9837b18..cbd18f0 100644
24--- a/bfd/elf32-microblaze.c
25+++ b/bfd/elf32-microblaze.c
26@@ -668,6 +668,67 @@ microblaze_elf_is_local_label_name (bfd *abfd, const char *name)
27 return _bfd_elf_is_local_label_name (abfd, name);
28 }
29
30+/* Support for core dump NOTE sections. */
31+static bfd_boolean
32+microblaze_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
33+{
34+ int offset;
35+ unsigned int size;
36+
37+ switch (note->descsz)
38+ {
39+ default:
40+ return FALSE;
41+
42+ case 228: /* Linux/MicroBlaze */
43+ /* pr_cursig */
44+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
45+
46+ /* pr_pid */
47+ elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
48+
49+ /* pr_reg */
50+ offset = 72;
51+ size = 50 * 4;
52+
53+ break;
54+ }
55+
56+ /* Make a ".reg/999" section. */
57+ return _bfd_elfcore_make_pseudosection (abfd, ".reg",
58+ size, note->descpos + offset);
59+}
60+
61+static bfd_boolean
62+microblaze_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
63+{
64+ switch (note->descsz)
65+ {
66+ default:
67+ return FALSE;
68+
69+ case 128: /* Linux/MicroBlaze elf_prpsinfo */
70+ elf_tdata (abfd)->core->program
71+ = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16);
72+ elf_tdata (abfd)->core->command
73+ = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80);
74+ }
75+
76+ /* Note that for some reason, a spurious space is tacked
77+ onto the end of the args in some (at least one anyway)
78+ implementations, so strip it off if it exists. */
79+
80+ {
81+ char *command = elf_tdata (abfd)->core->command;
82+ int n = strlen (command);
83+
84+ if (0 < n && command[n - 1] == ' ')
85+ command[n - 1] = '\0';
86+ }
87+
88+ return TRUE;
89+}
90+
91 /* The microblaze linker (like many others) needs to keep track of
92 the number of relocs that it decides to copy as dynamic relocs in
93 check_relocs for each symbol. This is so that it can later discard
94@@ -3506,4 +3567,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
95 #define elf_backend_size_dynamic_sections microblaze_elf_size_dynamic_sections
96 #define elf_backend_add_symbol_hook microblaze_elf_add_symbol_hook
97
98+#define elf_backend_grok_prstatus microblaze_elf_grok_prstatus
99+#define elf_backend_grok_psinfo microblaze_elf_grok_psinfo
100+
101 #include "elf32-target.h"
102diff --git a/gdb/configure.tgt b/gdb/configure.tgt
103index 01311b2..9297c56 100644
104--- a/gdb/configure.tgt
105+++ b/gdb/configure.tgt
106@@ -340,7 +340,7 @@ mep-*-*)
107
108 microblaze*-linux-*|microblaze*-*-linux*)
109 # Target: Xilinx MicroBlaze running Linux
110- gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o \
111+ gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \
112 monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o"
113 gdb_sim=../sim/microblaze/libsim.a
114 ;;
115diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
116index 8d360eb..7e6b61b 100644
117--- a/gdb/microblaze-linux-tdep.c
118+++ b/gdb/microblaze-linux-tdep.c
119@@ -32,6 +32,7 @@
120 #include "regset.h"
121 #include "solib-svr4.h"
122 #include "microblaze-tdep.h"
123+#include "glibc-tdep.h"
124 #include "trad-frame.h"
125 #include "frame-unwind.h"
126 #include "tramp-frame.h"
127@@ -116,6 +117,43 @@ static struct tramp_frame microblaze_linux_sighandler_tramp_frame =
128 microblaze_linux_sighandler_cache_init
129 };
130
131+const struct microblaze_gregset microblaze_linux_core_gregset;
132+
133+static void
134+microblaze_linux_supply_core_gregset (const struct regset *regset,
135+ struct regcache *regcache,
136+ int regnum, const void *gregs, size_t len)
137+{
138+ microblaze_supply_gregset (&microblaze_linux_core_gregset, regcache,
139+ regnum, gregs);
140+}
141+
142+static void
143+microblaze_linux_collect_core_gregset (const struct regset *regset,
144+ const struct regcache *regcache,
145+ int regnum, void *gregs, size_t len)
146+{
147+ microblaze_collect_gregset (&microblaze_linux_core_gregset, regcache,
148+ regnum, gregs);
149+}
150+
151+static void
152+microblaze_linux_supply_core_fpregset (const struct regset *regset,
153+ struct regcache *regcache,
154+ int regnum, const void *fpregs, size_t len)
155+{
156+ /* FIXME. */
157+ microblaze_supply_fpregset (regcache, regnum, fpregs);
158+}
159+
160+static void
161+microblaze_linux_collect_core_fpregset (const struct regset *regset,
162+ const struct regcache *regcache,
163+ int regnum, void *fpregs, size_t len)
164+{
165+ /* FIXME. */
166+ microblaze_collect_fpregset (regcache, regnum, fpregs);
167+}
168
169 static void
170 microblaze_linux_init_abi (struct gdbarch_info info,
171@@ -123,6 +161,10 @@ microblaze_linux_init_abi (struct gdbarch_info info,
172 {
173 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
174
175+ tdep->gregset = regset_alloc (gdbarch, microblaze_linux_supply_core_gregset,
176+ microblaze_linux_collect_core_gregset);
177+ tdep->sizeof_gregset = 200;
178+
179 linux_init_abi (info, gdbarch);
180
181 set_gdbarch_memory_remove_breakpoint (gdbarch,
182@@ -135,6 +177,25 @@ microblaze_linux_init_abi (struct gdbarch_info info,
183 /* Trampolines. */
184 tramp_frame_prepend_unwinder (gdbarch,
185 &microblaze_linux_sighandler_tramp_frame);
186+
187+ /* BFD target for core files. */
188+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
189+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
190+ else
191+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
192+
193+
194+ /* Shared library handling. */
195+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
196+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
197+
198+ set_gdbarch_regset_from_core_section (gdbarch,
199+ microblaze_regset_from_core_section);
200+
201+ /* Enable TLS support. */
202+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
203+ svr4_fetch_objfile_link_map);
204+
205 }
206
207 /* -Wmissing-prototypes */
208diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
209index 14c1b52..36cf1ca 100644
210--- a/gdb/microblaze-tdep.c
211+++ b/gdb/microblaze-tdep.c
212@@ -145,6 +145,14 @@ microblaze_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp,
213 return sp;
214 }
215
216+static CORE_ADDR
217+microblaze_store_arguments (struct regcache *regcache, int nargs,
218+ struct value **args, CORE_ADDR sp,
219+ int struct_return, CORE_ADDR struct_addr)
220+{
221+ error (_("store_arguments not implemented"));
222+ return sp;
223+}
224
225 static CORE_ADDR
226 microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
227@@ -536,6 +544,12 @@ microblaze_frame_base_address (struct frame_info *next_frame,
228 return cache->base;
229 }
230
231+static const struct frame_unwind *
232+microblaze_frame_sniffer (struct frame_info *next_frame)
233+{
234+ return &microblaze_frame_unwind;
235+}
236+
237 static const struct frame_base microblaze_frame_base =
238 {
239 &microblaze_frame_unwind,
240@@ -664,6 +678,70 @@ microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg)
241 return dwarf2_to_reg_map[reg];
242 }
243
244+
245+void
246+microblaze_supply_gregset (const struct microblaze_gregset *gregset,
247+ struct regcache *regcache,
248+ int regnum, const void *gregs)
249+{
250+ unsigned int *regs = gregs;
251+ if (regnum >= 0)
252+ regcache_raw_supply (regcache, regnum, regs + regnum);
253+
254+ if (regnum == -1) {
255+ int i;
256+
257+ for (i = 0; i < 50; i++) {
258+ regcache_raw_supply (regcache, i, regs + i);
259+ }
260+ }
261+}
262+
263+
264+void
265+microblaze_collect_gregset (const struct microblaze_gregset *gregset,
266+ const struct regcache *regcache,
267+ int regnum, void *gregs)
268+{
269+ /* FIXME. */
270+}
271+
272+void
273+microblaze_supply_fpregset (struct regcache *regcache,
274+ int regnum, const void *fpregs)
275+{
276+ /* FIXME. */
277+}
278+
279+void
280+microblaze_collect_fpregset (const struct regcache *regcache,
281+ int regnum, void *fpregs)
282+{
283+ /* FIXME. */
284+}
285+
286+
287+/* Return the appropriate register set for the core section identified
288+ by SECT_NAME and SECT_SIZE. */
289+
290+const struct regset *
291+microblaze_regset_from_core_section (struct gdbarch *gdbarch,
292+ const char *sect_name, size_t sect_size)
293+{
294+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
295+
296+ microblaze_debug ("microblaze_regset_from_core_section, sect_name = %s\n", sect_name);
297+
298+ if (strcmp (sect_name, ".reg") == 0 && sect_size >= tdep->sizeof_gregset)
299+ return tdep->gregset;
300+
301+ if (strcmp (sect_name, ".reg2") == 0 && sect_size >= tdep->sizeof_fpregset)
302+ return tdep->fpregset;
303+
304+ microblaze_debug ("microblaze_regset_from_core_section returning null :-( \n");
305+ return NULL;
306+}
307+
308 static struct gdbarch *
309 microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
310 {
311@@ -679,6 +757,11 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
312 tdep = XNEW (struct gdbarch_tdep);
313 gdbarch = gdbarch_alloc (&info, tdep);
314
315+ tdep->gregset = NULL;
316+ tdep->sizeof_gregset = 0;
317+ tdep->fpregset = NULL;
318+ tdep->sizeof_fpregset = 0;
319+
320 set_gdbarch_long_double_bit (gdbarch, 128);
321
322 set_gdbarch_num_regs (gdbarch, MICROBLAZE_NUM_REGS);
323@@ -726,6 +809,12 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
324 frame_unwind_append_unwinder (gdbarch, &microblaze_frame_unwind);
325 frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
326
327+ /* If we have register sets, enable the generic core file support. */
328+ if (tdep->gregset) {
329+ set_gdbarch_regset_from_core_section (gdbarch,
330+ microblaze_regset_from_core_section);
331+ }
332+
333 return gdbarch;
334 }
335
336diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
337index a532092..fec24b9 100644
338--- a/gdb/microblaze-tdep.h
339+++ b/gdb/microblaze-tdep.h
340@@ -22,8 +22,22 @@
341
342
343 /* Microblaze architecture-specific information. */
344+struct microblaze_gregset
345+{
346+ unsigned int gregs[32];
347+ unsigned int fpregs[32];
348+ unsigned int pregs[16];
349+};
350+
351 struct gdbarch_tdep
352 {
353+ int dummy; // declare something.
354+
355+ /* Register sets. */
356+ struct regset *gregset;
357+ size_t sizeof_gregset;
358+ struct regset *fpregset;
359+ size_t sizeof_fpregset;
360 };
361
362 struct microblaze_frame_cache
363@@ -117,4 +131,18 @@ enum microblaze_regnum
364 Only used for native debugging. */
365 #define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
366
367+extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
368+ struct regcache *regcache,
369+ int regnum, const void *gregs);
370+extern void microblaze_collect_gregset (const struct microblaze_gregset *gregset,
371+ const struct regcache *regcache,
372+ int regnum, void *gregs);
373+extern void microblaze_supply_fpregset (struct regcache *regcache,
374+ int regnum, const void *fpregs);
375+extern void microblaze_collect_fpregset (const struct regcache *regcache,
376+ int regnum, void *fpregs);
377+
378+extern const struct regset * microblaze_regset_from_core_section (struct gdbarch *gdbarch,
379+ const char *sect_name, size_t sect_size);
380+
381 #endif /* microblaze-tdep.h */
382--
3831.9.0
384
diff --git a/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch b/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch
deleted file mode 100644
index b14e4092..00000000
--- a/recipes-devtools/gdb/files/0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch
+++ /dev/null
@@ -1,67 +0,0 @@
1From 26e124f0d78233b1d976bd4b787f6a7866bcb7e7 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Wed, 4 Jan 2012 16:59:33 +0530
4Subject: [PATCH 04/16] [Patch, microblaze]: Communicate in larger blocks with
5 the target
6
7Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
8Upstream-Status: Pending
9---
10 gdb/microblaze-tdep.c | 25 ++++++++++++++++++++++---
11 1 file changed, 22 insertions(+), 3 deletions(-)
12
13diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
14index 36cf1ca..76e87b3 100644
15--- a/gdb/microblaze-tdep.c
16+++ b/gdb/microblaze-tdep.c
17@@ -242,6 +242,10 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
18 int flags = 0;
19 int save_hidden_pointer_found = 0;
20 int non_stack_instruction_found = 0;
21+ int n_insns;
22+ unsigned long *insn_block;
23+ gdb_byte *buf_block;
24+ int ti, tj;
25
26 /* Find the start of this function. */
27 find_pc_partial_function (pc, &name, &func_addr, &func_end);
28@@ -281,9 +285,23 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
29 name, paddress (gdbarch, func_addr),
30 paddress (gdbarch, stop));
31
32+/* Do a block read to minimize the transaction with the Debug Agent */
33+ n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE);
34+ insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long));
35+ buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte));
36+
37+ target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE );
38+
39+ for(ti = 0; ti < n_insns; ti++){
40+ insn_block[ti] = 0;
41+ for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ )
42+ insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj];
43+ }
44+
45 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
46 {
47- insn = microblaze_fetch_instruction (addr);
48+ //insn = microblaze_fetch_instruction (addr);
49+ insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
50 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
51 microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn);
52
53@@ -409,8 +427,9 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
54 part of the prologue. */
55 if (save_hidden_pointer_found)
56 prologue_end_addr -= INST_WORD_SIZE;
57-
58- return prologue_end_addr;
59+ free(insn_block);
60+ free(buf_block);
61+ return prologue_end_addr;
62 }
63
64 static CORE_ADDR
65--
661.9.0
67
diff --git a/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch b/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch
deleted file mode 100644
index e490f02a..00000000
--- a/recipes-devtools/gdb/files/0005-Patch-microblaze-Add-mb-singlestepping.patch
+++ /dev/null
@@ -1,200 +0,0 @@
1From 5c3a08f407e1cbee5b0a4ca6092165b97acddda5 Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar@axis.com>
3Date: Fri, 24 Feb 2012 11:52:30 +0100
4Subject: [PATCH 05/16] [Patch, microblaze]: Add mb singlestepping.
5
6Fix prologue analysis for little-endian.
7Always provide a frame base.
8
9Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
10Upstream-Status: Pending
11---
12 gdb/microblaze-tdep.c | 123 ++++++++++++++++++++++++++++++++++++++++++++------
13 1 file changed, 108 insertions(+), 15 deletions(-)
14
15diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
16index 76e87b3..50b68d2 100644
17--- a/gdb/microblaze-tdep.c
18+++ b/gdb/microblaze-tdep.c
19@@ -243,9 +243,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
20 int save_hidden_pointer_found = 0;
21 int non_stack_instruction_found = 0;
22 int n_insns;
23- unsigned long *insn_block;
24- gdb_byte *buf_block;
25- int ti, tj;
26+ unsigned int *insn_block;
27
28 /* Find the start of this function. */
29 find_pc_partial_function (pc, &name, &func_addr, &func_end);
30@@ -287,23 +285,16 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
31
32 /* Do a block read to minimize the transaction with the Debug Agent */
33 n_insns = (stop == func_addr) ? 1 : ((stop - func_addr) / INST_WORD_SIZE);
34- insn_block = (unsigned long *)calloc(n_insns, sizeof(unsigned long));
35- buf_block = (gdb_byte *)calloc(n_insns * INST_WORD_SIZE, sizeof(gdb_byte));
36+ insn_block = calloc(n_insns, sizeof(unsigned long));
37
38- target_read_memory (func_addr, buf_block, n_insns * INST_WORD_SIZE );
39-
40- for(ti = 0; ti < n_insns; ti++){
41- insn_block[ti] = 0;
42- for( tj = ti * INST_WORD_SIZE; tj < (ti + 1) * INST_WORD_SIZE; tj++ )
43- insn_block[ti] = (insn_block[ti] << 8) | buf_block[tj];
44- }
45+ target_read_memory (func_addr, (void*) insn_block, n_insns * INST_WORD_SIZE );
46
47 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
48 {
49 //insn = microblaze_fetch_instruction (addr);
50 insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
51 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
52- microblaze_debug ("%s %08lx\n", paddress (gdbarch, pc), insn);
53+ microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm);
54
55 /* This code is very sensitive to what functions are present in the
56 prologue. It assumes that the (addi, addik, swi, sw) can be the
57@@ -428,7 +419,6 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
58 if (save_hidden_pointer_found)
59 prologue_end_addr -= INST_WORD_SIZE;
60 free(insn_block);
61- free(buf_block);
62 return prologue_end_addr;
63 }
64
65@@ -502,6 +492,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
66
67 func = get_frame_func (next_frame);
68
69+ cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch));
70 cache->pc = get_frame_address_in_block (next_frame);
71
72 return cache;
73@@ -518,7 +509,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache,
74 if (cache->base == 0)
75 return;
76
77- (*this_id) = frame_id_build (cache->base, cache->pc);
78+ (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame));
79 }
80
81 static struct value *
82@@ -661,6 +652,107 @@ microblaze_stabs_argument_has_addr (struct gdbarch *gdbarch, struct type *type)
83 return (TYPE_LENGTH (type) == 16);
84 }
85
86+int
87+microblaze_software_single_step (struct frame_info *frame)
88+{
89+ struct gdbarch *arch = get_frame_arch (frame);
90+ struct address_space *aspace = get_frame_address_space (frame);
91+ struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
92+ static char le_breakp[] = MICROBLAZE_BREAKPOINT_LE;
93+ static char be_breakp[] = MICROBLAZE_BREAKPOINT;
94+ enum bfd_endian byte_order = gdbarch_byte_order (arch);
95+ char *breakp = byte_order == BFD_ENDIAN_BIG ? be_breakp : le_breakp;
96+ int ret = 0;
97+
98+ /* Save the address and the values of the next_pc and the target */
99+ static struct sstep_breaks
100+ {
101+ CORE_ADDR address;
102+ bfd_boolean valid;
103+ /* Shadow contents. */
104+ char data[INST_WORD_SIZE];
105+ } stepbreaks[2];
106+ int ii;
107+
108+ if (1)
109+ {
110+ CORE_ADDR pc;
111+ long insn;
112+ enum microblaze_instr minstr;
113+ bfd_boolean isunsignednum;
114+ enum microblaze_instr_type insn_type;
115+ short delay_slots;
116+ int imm;
117+ bfd_boolean immfound = FALSE;
118+
119+ /* Set a breakpoint at the next instruction */
120+ /* If the current instruction is an imm, set it at the inst after */
121+ /* If the instruction has a delay slot, skip the delay slot */
122+ pc = get_frame_pc (frame);
123+ insn = microblaze_fetch_instruction (pc);
124+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
125+ if (insn_type == immediate_inst)
126+ {
127+ int rd, ra, rb;
128+ immfound = TRUE;
129+ minstr = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
130+ pc = pc + INST_WORD_SIZE;
131+ insn = microblaze_fetch_instruction (pc);
132+ minstr = get_insn_microblaze (insn, &isunsignednum, &insn_type, &delay_slots);
133+ }
134+ stepbreaks[0].address = pc + (delay_slots * INST_WORD_SIZE) + INST_WORD_SIZE;
135+ if (insn_type != return_inst) {
136+ stepbreaks[0].valid = TRUE;
137+ } else {
138+ stepbreaks[0].valid = FALSE;
139+ }
140+
141+ microblaze_debug ("single-step insn_type=%x insn=%x\n", insn_type, insn);
142+ /* Now check for branch or return instructions */
143+ if (insn_type == branch_inst || insn_type == return_inst) {
144+ int limm;
145+ int lrd, lra, lrb;
146+ int ra, rb;
147+ bfd_boolean targetvalid;
148+ bfd_boolean unconditionalbranch;
149+ microblaze_decode_insn(insn, &lrd, &lra, &lrb, &limm);
150+ if (lra >= 0 && lra < MICROBLAZE_NUM_REGS)
151+ ra = get_frame_register_unsigned (frame, lra);
152+ else
153+ ra = 0;
154+ if (lrb >= 0 && lrb < MICROBLAZE_NUM_REGS)
155+ rb = get_frame_register_unsigned (frame, lrb);
156+ else
157+ rb = 0;
158+ stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
159+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
160+ if (unconditionalbranch)
161+ stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
162+ if (targetvalid && (stepbreaks[0].valid == FALSE ||
163+ (stepbreaks[0].address != stepbreaks[1].address))
164+ && (stepbreaks[1].address != pc)) {
165+ stepbreaks[1].valid = TRUE;
166+ } else {
167+ stepbreaks[1].valid = FALSE;
168+ }
169+ } else {
170+ stepbreaks[1].valid = FALSE;
171+ }
172+
173+ /* Insert the breakpoints */
174+ for (ii = 0; ii < 2; ++ii)
175+ {
176+
177+ /* ignore invalid breakpoint. */
178+ if (stepbreaks[ii].valid) {
179+ insert_single_step_breakpoint (arch, aspace, stepbreaks[ii].address);
180+ ret = 1;
181+ }
182+ }
183+ }
184+ return ret;
185+}
186+
187 static void
188 microblaze_write_pc (struct regcache *regcache, CORE_ADDR pc)
189 {
190@@ -809,6 +901,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
191 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
192
193 set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc);
194+ set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
195
196 set_gdbarch_frame_args_skip (gdbarch, 8);
197
198--
1991.9.0
200
diff --git a/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch b/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch
deleted file mode 100644
index cb2eec18..00000000
--- a/recipes-devtools/gdb/files/0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch
+++ /dev/null
@@ -1,553 +0,0 @@
1From 2112c9ded01ddd08f0e31e5ce23eecac6c04e8c4 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Mon, 6 Feb 2012 10:28:29 +1000
4Subject: [PATCH 06/16] [Patch, microblaze]: Add initial port of linux
5 gdbserver
6
7add gdb_proc_service_h to gdbserver microblaze-linux
8
9gdbserver needs to initialise the microblaze registers
10
11other archs use this step to run a *_arch_setup() to carry out all
12architecture specific setup - may need to add in future
13
14 * add linux-ptrace.o to gdbserver configure
15 * gdb/configure.tgt: Set build_gdbserver=yes
16 * Update breakpoint opcode
17 * fix segfault on connecting gdbserver
18 * add microblaze_linux_memory_remove_breakpoint
19 * add set_solib_svr4_fetch_link_map_offsets
20 * add set_gdbarch_fetch_tls_load_module_address
21 * Force reading of r0 as 0, prevent stores
22
23Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
24Signed-off-by: Nathan Rossi <nathan.rossi@petalogix.com>
25Upstream-Status: Pending
26---
27 gdb/configure.host | 3 +
28 gdb/configure.tgt | 1 +
29 gdb/gdbserver/Makefile.in | 4 +
30 gdb/gdbserver/configure.srv | 6 +
31 gdb/gdbserver/linux-microblaze-low.c | 228 +++++++++++++++++++++++++++++++++++
32 gdb/microblaze-linux-tdep.c | 25 +++-
33 gdb/microblaze-tdep.c | 45 ++++++-
34 gdb/microblaze-tdep.h | 3 +-
35 gdb/regformats/reg-microblaze.dat | 39 ++++++
36 9 files changed, 348 insertions(+), 6 deletions(-)
37 create mode 100644 gdb/gdbserver/linux-microblaze-low.c
38 create mode 100644 gdb/regformats/reg-microblaze.dat
39
40diff --git a/gdb/configure.host b/gdb/configure.host
41index 15a8288..76cc5fe 100644
42--- a/gdb/configure.host
43+++ b/gdb/configure.host
44@@ -59,6 +59,7 @@ i[34567]86*) gdb_host_cpu=i386 ;;
45 m68*) gdb_host_cpu=m68k ;;
46 m88*) gdb_host_cpu=m88k ;;
47 mips*) gdb_host_cpu=mips ;;
48+microblaze*) gdb_host_cpu=microblaze ;;
49 powerpc* | rs6000) gdb_host_cpu=powerpc ;;
50 sparcv9 | sparc64) gdb_host_cpu=sparc ;;
51 s390*) gdb_host_cpu=s390 ;;
52@@ -133,6 +134,8 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
53 gdb_host=nbsd ;;
54 mips64*-*-openbsd*) gdb_host=obsd64 ;;
55
56+microblaze*-*linux*) gdb_host=linux ;;
57+
58 powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*)
59 gdb_host=aix ;;
60 powerpc*-*-freebsd*) gdb_host=fbsd ;;
61diff --git a/gdb/configure.tgt b/gdb/configure.tgt
62index 9297c56..3a7951a 100644
63--- a/gdb/configure.tgt
64+++ b/gdb/configure.tgt
65@@ -343,6 +343,7 @@ microblaze*-linux-*|microblaze*-*-linux*)
66 gdb_target_obs="microblaze-tdep.o microblaze-linux-tdep.o microblaze-rom.o glibc-tdep.o \
67 monitor.o dsrec.o solib-svr4.o symfile-mem.o linux-tdep.o"
68 gdb_sim=../sim/microblaze/libsim.a
69+ build_gdbserver=yes
70 ;;
71 microblaze*-*-*)
72 # Target: Xilinx MicroBlaze running standalone
73diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
74index f773fa2..a11ace1 100644
75--- a/gdb/gdbserver/Makefile.in
76+++ b/gdb/gdbserver/Makefile.in
77@@ -148,6 +148,7 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
78 $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \
79 $(srcdir)/linux-m32r-low.c \
80 $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
81+ $(srcdir)/linux-microblaze-low.c \
82 $(srcdir)/linux-nios2-low.c \
83 $(srcdir)/linux-ppc-low.c \
84 $(srcdir)/linux-s390-low.c \
85@@ -329,6 +330,7 @@ clean:
86 rm -f arm-with-iwmmxt.c
87 rm -f arm-with-vfpv2.c arm-with-vfpv3.c arm-with-neon.c
88 rm -f mips-linux.c mips64-linux.c
89+ rm -f microblaze-linux.c
90 rm -f nios2-linux.c
91 rm -f powerpc-32.c powerpc-32l.c powerpc-64l.c powerpc-e500l.c
92 rm -f powerpc-altivec32l.c powerpc-cell32l.c powerpc-vsx32l.c
93@@ -612,6 +614,8 @@ reg-m68k.c : $(srcdir)/../regformats/reg-m68k.dat $(regdat_sh)
94 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-m68k.dat reg-m68k.c
95 reg-cf.c : $(srcdir)/../regformats/reg-cf.dat $(regdat_sh)
96 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-cf.dat reg-cf.c
97+microblaze-linux.c : $(srcdir)/../regformats/reg-microblaze.dat $(regdat_sh)
98+ $(SHELL) $(regdat_sh) $(srcdir)/../regformats/reg-microblaze.dat microblaze-linux.c
99 mips-linux.c : $(srcdir)/../regformats/mips-linux.dat $(regdat_sh)
100 $(SHELL) $(regdat_sh) $(srcdir)/../regformats/mips-linux.dat mips-linux.c
101 mips-dsp-linux.c : $(srcdir)/../regformats/mips-dsp-linux.dat $(regdat_sh)
102diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
103index cc4f53d..359c756 100644
104--- a/gdb/gdbserver/configure.srv
105+++ b/gdb/gdbserver/configure.srv
106@@ -198,6 +198,12 @@ case "${target}" in
107 srv_linux_usrregs=yes
108 srv_linux_thread_db=yes
109 ;;
110+ microblaze*-*-linux*) srv_regobj=microblaze-linux.o
111+ srv_tgtobj="$srv_linux_obj linux-microblaze-low.o"
112+ srv_linux_usrregs=yes
113+ srv_linux_regsets=yes
114+ srv_linux_thread_db=yes
115+ ;;
116 nios2*-*-linux*) srv_regobj="nios2-linux.o"
117 srv_tgtobj="$srv_linux_obj linux-nios2-low.o"
118 srv_xmlfiles="nios2-linux.xml"
119diff --git a/gdb/gdbserver/linux-microblaze-low.c b/gdb/gdbserver/linux-microblaze-low.c
120new file mode 100644
121index 0000000..279df9f
122--- /dev/null
123+++ b/gdb/gdbserver/linux-microblaze-low.c
124@@ -0,0 +1,228 @@
125+/* GNU/Linux/Microblaze specific low level interface, for the remote server for
126+ GDB.
127+ Copyright (C) 1995-2013 Free Software Foundation, Inc.
128+
129+ This file is part of GDB.
130+
131+ This program is free software; you can redistribute it and/or modify
132+ it under the terms of the GNU General Public License as published by
133+ the Free Software Foundation; either version 3 of the License, or
134+ (at your option) any later version.
135+
136+ This program is distributed in the hope that it will be useful,
137+ but WITHOUT ANY WARRANTY; without even the implied warranty of
138+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139+ GNU General Public License for more details.
140+
141+ You should have received a copy of the GNU General Public License
142+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
143+
144+#include "server.h"
145+#include "linux-low.h"
146+
147+#include <asm/ptrace.h>
148+#include <sys/procfs.h>
149+#include <sys/ptrace.h>
150+
151+#include "gdb_proc_service.h"
152+
153+static int microblaze_regmap[] =
154+ {PT_GPR(0), PT_GPR(1), PT_GPR(2), PT_GPR(3),
155+ PT_GPR(4), PT_GPR(5), PT_GPR(6), PT_GPR(7),
156+ PT_GPR(8), PT_GPR(9), PT_GPR(10), PT_GPR(11),
157+ PT_GPR(12), PT_GPR(13), PT_GPR(14), PT_GPR(15),
158+ PT_GPR(16), PT_GPR(17), PT_GPR(18), PT_GPR(19),
159+ PT_GPR(20), PT_GPR(21), PT_GPR(22), PT_GPR(23),
160+ PT_GPR(24), PT_GPR(25), PT_GPR(26), PT_GPR(27),
161+ PT_GPR(28), PT_GPR(29), PT_GPR(30), PT_GPR(31),
162+ PT_PC, PT_MSR, PT_EAR, PT_ESR,
163+ PT_FSR
164+ };
165+
166+#define microblaze_num_regs (sizeof microblaze_regmap / sizeof microblaze_regmap[0])
167+
168+/* Defined in auto-generated file microblaze-linux.c. */
169+void init_registers_microblaze (void);
170+extern const struct target_desc *tdesc_microblaze;
171+
172+static int
173+microblaze_cannot_store_register (int regno)
174+{
175+ if (microblaze_regmap[regno] == -1 || regno == 0)
176+ return 1;
177+
178+ return 0;
179+}
180+
181+static int
182+microblaze_cannot_fetch_register (int regno)
183+{
184+ return 0;
185+}
186+
187+static CORE_ADDR
188+microblaze_get_pc (struct regcache *regcache)
189+{
190+ unsigned long pc;
191+
192+ collect_register_by_name (regcache, "pc", &pc);
193+ return (CORE_ADDR) pc;
194+}
195+
196+static void
197+microblaze_set_pc (struct regcache *regcache, CORE_ADDR pc)
198+{
199+ unsigned long newpc = pc;
200+
201+ supply_register_by_name (regcache, "pc", &newpc);
202+}
203+
204+/* dbtrap insn */
205+/* brki r16, 0x18; */
206+static const unsigned long microblaze_breakpoint = 0xba0c0018;
207+#define microblaze_breakpoint_len 4
208+
209+static int
210+microblaze_breakpoint_at (CORE_ADDR where)
211+{
212+ unsigned long insn;
213+
214+ (*the_target->read_memory) (where, (unsigned char *) &insn, 4);
215+ if (insn == microblaze_breakpoint)
216+ return 1;
217+ /* If necessary, recognize more trap instructions here. GDB only uses the
218+ one. */
219+ return 0;
220+}
221+
222+static CORE_ADDR
223+microblaze_reinsert_addr (struct regcache *regcache)
224+{
225+ unsigned long pc;
226+ collect_register_by_name (regcache, "r15", &pc);
227+ return pc;
228+}
229+
230+#ifdef HAVE_PTRACE_GETREGS
231+
232+static void
233+microblaze_collect_ptrace_register (struct regcache *regcache, int regno, char *buf)
234+{
235+ int size = register_size (regcache->tdesc, regno);
236+
237+ memset (buf, 0, sizeof (long));
238+
239+ if (size < sizeof (long))
240+ collect_register (regcache, regno, buf + sizeof (long) - size);
241+ else
242+ collect_register (regcache, regno, buf);
243+}
244+
245+static void
246+microblaze_supply_ptrace_register (struct regcache *regcache,
247+ int regno, const char *buf)
248+{
249+ int size = register_size (regcache->tdesc, regno);
250+
251+ if (regno == 0) {
252+ unsigned long regbuf_0 = 0;
253+ /* clobbering r0 so that it is always 0 as enforced by hardware */
254+ supply_register (regcache, regno, (const char*)&regbuf_0);
255+ } else {
256+ if (size < sizeof (long))
257+ supply_register (regcache, regno, buf + sizeof (long) - size);
258+ else
259+ supply_register (regcache, regno, buf);
260+ }
261+}
262+
263+/* Provide only a fill function for the general register set. ps_lgetregs
264+ will use this for NPTL support. */
265+
266+static void microblaze_fill_gregset (struct regcache *regcache, void *buf)
267+{
268+ int i;
269+
270+ for (i = 0; i < 32; i++)
271+ microblaze_collect_ptrace_register (regcache, i, (char *) buf + microblaze_regmap[i]);
272+}
273+
274+static void
275+microblaze_store_gregset (struct regcache *regcache, const void *buf)
276+{
277+ int i;
278+
279+ for (i = 0; i < 32; i++)
280+ supply_register (regcache, i, (char *) buf + microblaze_regmap[i]);
281+}
282+
283+#endif /* HAVE_PTRACE_GETREGS */
284+
285+static struct regset_info microblaze_regsets[] = {
286+#ifdef HAVE_PTRACE_GETREGS
287+ { PTRACE_GETREGS, PTRACE_SETREGS, 0, sizeof (elf_gregset_t), GENERAL_REGS, microblaze_fill_gregset, microblaze_store_gregset },
288+ { 0, 0, 0, -1, -1, NULL, NULL },
289+#endif /* HAVE_PTRACE_GETREGS */
290+ { 0, 0, 0, -1, -1, NULL, NULL }
291+};
292+
293+static struct regsets_info microblaze_regsets_info =
294+ {
295+ microblaze_regsets, /* regsets */
296+ 0, /* num_regsets */
297+ NULL, /* disabled_regsets */
298+ };
299+
300+static struct usrregs_info microblaze_usrregs_info =
301+ {
302+ microblaze_num_regs,
303+ microblaze_regmap,
304+ };
305+
306+static struct regs_info regs_info =
307+ {
308+ NULL, /* regset_bitmap */
309+ &microblaze_usrregs_info,
310+ &microblaze_regsets_info
311+ };
312+
313+static const struct regs_info *
314+microblaze_regs_info (void)
315+{
316+ return &regs_info;
317+}
318+
319+static void
320+microblaze_arch_setup (void)
321+{
322+ current_process ()->tdesc = tdesc_microblaze;
323+}
324+
325+struct linux_target_ops the_low_target = {
326+ microblaze_arch_setup,
327+ microblaze_regs_info,
328+ microblaze_cannot_fetch_register,
329+ microblaze_cannot_store_register,
330+ NULL, /* fetch_register */
331+ microblaze_get_pc,
332+ microblaze_set_pc,
333+ (const unsigned char *) &microblaze_breakpoint,
334+ microblaze_breakpoint_len,
335+ microblaze_reinsert_addr,
336+ 0,
337+ microblaze_breakpoint_at,
338+ NULL,
339+ NULL,
340+ NULL,
341+ NULL,
342+ microblaze_collect_ptrace_register,
343+ microblaze_supply_ptrace_register,
344+};
345+
346+void
347+initialize_low_arch (void)
348+{
349+ init_registers_microblaze ();
350+
351+ initialize_regsets_info (&microblaze_regsets_info);
352+}
353\ No newline at end of file
354diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
355index 7e6b61b..cf58e21 100644
356--- a/gdb/microblaze-linux-tdep.c
357+++ b/gdb/microblaze-linux-tdep.c
358@@ -38,6 +38,22 @@
359 #include "tramp-frame.h"
360 #include "linux-tdep.h"
361
362+static int microblaze_debug_flag = 0;
363+
364+static void
365+microblaze_debug (const char *fmt, ...)
366+{
367+ if (microblaze_debug_flag)
368+ {
369+ va_list args;
370+
371+ va_start (args, fmt);
372+ printf_unfiltered ("MICROBLAZE LINUX: ");
373+ vprintf_unfiltered (fmt, args);
374+ va_end (args);
375+ }
376+}
377+
378 static int
379 microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
380 struct bp_target_info *bp_tgt)
381@@ -47,20 +63,27 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
382 int val;
383 int bplen;
384 gdb_byte old_contents[BREAKPOINT_MAX];
385+ struct cleanup *cleanup;
386
387 /* Determine appropriate breakpoint contents and size for this address. */
388 bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
389 if (bp == NULL)
390 error (_("Software breakpoints not implemented for this target."));
391
392+ /* Make sure we see the memory breakpoints. */
393+ cleanup = make_show_memory_breakpoints_cleanup (1);
394 val = target_read_memory (addr, old_contents, bplen);
395
396 /* If our breakpoint is no longer at the address, this means that the
397 program modified the code on us, so it is wrong to put back the
398 old value. */
399 if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
400- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
401+ {
402+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
403+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
404+ }
405
406+ do_cleanups (cleanup);
407 return val;
408 }
409
410diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
411index 50b68d2..1c6dbfe 100644
412--- a/gdb/microblaze-tdep.c
413+++ b/gdb/microblaze-tdep.c
414@@ -164,6 +164,39 @@ microblaze_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
415 return sp;
416 }
417
418+static int
419+microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
420+ struct bp_target_info *bp_tgt)
421+{
422+ CORE_ADDR addr = bp_tgt->placed_address;
423+ const unsigned char *bp;
424+ int val;
425+ int bplen;
426+ gdb_byte old_contents[BREAKPOINT_MAX];
427+ struct cleanup *cleanup;
428+
429+ /* Determine appropriate breakpoint contents and size for this address. */
430+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
431+ if (bp == NULL)
432+ error (_("Software breakpoints not implemented for this target."));
433+
434+ /* Make sure we see the memory breakpoints. */
435+ cleanup = make_show_memory_breakpoints_cleanup (1);
436+ val = target_read_memory (addr, old_contents, bplen);
437+
438+ /* If our breakpoint is no longer at the address, this means that the
439+ program modified the code on us, so it is wrong to put back the
440+ old value. */
441+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
442+ {
443+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
444+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
445+ }
446+
447+ do_cleanups (cleanup);
448+ return val;
449+}
450+
451 static const gdb_byte *
452 microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc,
453 int *len)
454@@ -291,8 +324,8 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
455
456 for (addr = func_addr; addr < stop; addr += INST_WORD_SIZE)
457 {
458- //insn = microblaze_fetch_instruction (addr);
459- insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
460+ insn = microblaze_fetch_instruction (addr);
461+ //insn = insn_block[(addr - func_addr) / INST_WORD_SIZE];
462 op = microblaze_decode_insn (insn, &rd, &ra, &rb, &imm);
463 microblaze_debug ("%s %08lx op=%x r%d r%d imm=%d\n", paddress (gdbarch, addr), insn, op, rd, ra, imm);
464
465@@ -724,13 +757,15 @@ microblaze_software_single_step (struct frame_info *frame)
466 rb = get_frame_register_unsigned (frame, lrb);
467 else
468 rb = 0;
469+
470 stepbreaks[1].address = microblaze_get_target_address (insn, immfound, imm, pc, ra, rb, &targetvalid, &unconditionalbranch);
471- microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
472+ microblaze_debug ("single-step uncondbr=%d targetvalid=%d target=%x\n", unconditionalbranch, targetvalid, stepbreaks[1].address);
473+
474 if (unconditionalbranch)
475 stepbreaks[0].valid = FALSE; /* This is a unconditional branch: will not come to the next address */
476 if (targetvalid && (stepbreaks[0].valid == FALSE ||
477 (stepbreaks[0].address != stepbreaks[1].address))
478- && (stepbreaks[1].address != pc)) {
479+ && (stepbreaks[1].address != pc)) {
480 stepbreaks[1].valid = TRUE;
481 } else {
482 stepbreaks[1].valid = FALSE;
483@@ -900,6 +935,8 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
484 /* Stack grows downward. */
485 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
486
487+ set_gdbarch_memory_remove_breakpoint (gdbarch, microblaze_linux_memory_remove_breakpoint);
488+
489 set_gdbarch_breakpoint_from_pc (gdbarch, microblaze_breakpoint_from_pc);
490 set_gdbarch_software_single_step (gdbarch, microblaze_software_single_step);
491
492diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
493index fec24b9..98aa0f5 100644
494--- a/gdb/microblaze-tdep.h
495+++ b/gdb/microblaze-tdep.h
496@@ -129,7 +129,8 @@ enum microblaze_regnum
497
498 /* MICROBLAZE_BREAKPOINT defines the breakpoint that should be used.
499 Only used for native debugging. */
500-#define MICROBLAZE_BREAKPOINT {0xb9, 0xcc, 0x00, 0x60}
501+#define MICROBLAZE_BREAKPOINT {0xba, 0x0c, 0x00, 0x18}
502+#define MICROBLAZE_BREAKPOINT_LE {0x18, 0x00, 0x0c, 0xba}
503
504 extern void microblaze_supply_gregset (const struct microblaze_gregset *gregset,
505 struct regcache *regcache,
506diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
507new file mode 100644
508index 0000000..a5dd0a0
509--- /dev/null
510+++ b/gdb/regformats/reg-microblaze.dat
511@@ -0,0 +1,39 @@
512+name:microblaze
513+expedite:r1,pc
514+32:r0
515+32:r1
516+32:r2
517+32:r3
518+32:r4
519+32:r5
520+32:r6
521+32:r7
522+32:r8
523+32:r9
524+32:r10
525+32:r11
526+32:r12
527+32:r13
528+32:r14
529+32:r15
530+32:r16
531+32:r17
532+32:r18
533+32:r19
534+32:r20
535+32:r21
536+32:r22
537+32:r23
538+32:r24
539+32:r25
540+32:r26
541+32:r27
542+32:r28
543+32:r29
544+32:r30
545+32:r31
546+32:pc
547+32:msr
548+32:ear
549+32:esr
550+32:fsr
551--
5521.9.0
553
diff --git a/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch b/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch
deleted file mode 100644
index 7cd11905..00000000
--- a/recipes-devtools/gdb/files/0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From fb2af2fffb673dbb14d743c8da94c4a83b71c792 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 26 Nov 2012 17:39:17 +1000
4Subject: [PATCH 07/16] [Patch, microblaze]: Add slr and shr regs and
5 little-endian breakpoint
6
7Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
8Upstream-Status: Pending
9---
10 gdb/microblaze-tdep.c | 10 ++++++++--
11 gdb/microblaze-tdep.h | 6 ++++--
12 gdb/regformats/reg-microblaze.dat | 2 ++
13 3 files changed, 14 insertions(+), 4 deletions(-)
14
15diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
16index 1c6dbfe..0ce4947 100644
17--- a/gdb/microblaze-tdep.c
18+++ b/gdb/microblaze-tdep.c
19@@ -73,7 +73,8 @@ static const char *microblaze_register_names[] =
20 "rpc", "rmsr", "rear", "resr", "rfsr", "rbtr",
21 "rpvr0", "rpvr1", "rpvr2", "rpvr3", "rpvr4", "rpvr5", "rpvr6",
22 "rpvr7", "rpvr8", "rpvr9", "rpvr10", "rpvr11",
23- "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi"
24+ "redr", "rpid", "rzpr", "rtlbx", "rtlbsx", "rtlblo", "rtlbhi",
25+ "rslr", "rshr"
26 };
27
28 #define MICROBLAZE_NUM_REGS ARRAY_SIZE (microblaze_register_names)
29@@ -201,10 +202,15 @@ static const gdb_byte *
30 microblaze_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pc,
31 int *len)
32 {
33+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
34 static gdb_byte break_insn[] = MICROBLAZE_BREAKPOINT;
35+ static gdb_byte break_insn_le[] = MICROBLAZE_BREAKPOINT_LE;
36
37 *len = sizeof (break_insn);
38- return break_insn;
39+ if (byte_order == BFD_ENDIAN_BIG)
40+ return break_insn;
41+ else
42+ return break_insn_le;
43 }
44
45 /* Allocate and initialize a frame cache. */
46diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
47index 98aa0f5..cd32e9f 100644
48--- a/gdb/microblaze-tdep.h
49+++ b/gdb/microblaze-tdep.h
50@@ -56,7 +56,7 @@ struct microblaze_frame_cache
51 int fp_regnum;
52
53 /* Offsets to saved registers. */
54- int register_offsets[57]; /* Must match MICROBLAZE_NUM_REGS. */
55+ int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */
56
57 /* Table of saved registers. */
58 struct trad_frame_saved_reg *saved_regs;
59@@ -121,7 +121,9 @@ enum microblaze_regnum
60 MICROBLAZE_RTLBX_REGNUM,
61 MICROBLAZE_RTLBSX_REGNUM,
62 MICROBLAZE_RTLBLO_REGNUM,
63- MICROBLAZE_RTLBHI_REGNUM
64+ MICROBLAZE_RTLBHI_REGNUM,
65+ MICROBLAZE_SLR_REGNUM,
66+ MICROBLAZE_SHR_REGNUM
67 };
68
69 /* All registers are 32 bits. */
70diff --git a/gdb/regformats/reg-microblaze.dat b/gdb/regformats/reg-microblaze.dat
71index a5dd0a0..bd8a438 100644
72--- a/gdb/regformats/reg-microblaze.dat
73+++ b/gdb/regformats/reg-microblaze.dat
74@@ -37,3 +37,5 @@ expedite:r1,pc
75 32:ear
76 32:esr
77 32:fsr
78+32:slr
79+32:shr
80--
811.9.0
82
diff --git a/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch b/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch
deleted file mode 100644
index 7f075d55..00000000
--- a/recipes-devtools/gdb/files/0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch
+++ /dev/null
@@ -1,156 +0,0 @@
1From 7944750e435100e72913f01aa0a43b7d7cffd421 Mon Sep 17 00:00:00 2001
2From: nagaraju <nmekala@xilix.com>
3Date: Tue, 3 Sep 2013 12:09:47 +0530
4Subject: [PATCH 08/16] [Patch, microblaze]: Added Backtrace support to GDB
5
6Added backtrace support without debugging information.
7
8Earlier backtrace used to work only when debug information is available.
9Previous pc & sp values are calculated incorrectly due to which backtrace
10was failing.
11
12In this patch, previous frame sp & pc values are calculated correctly
13in microblaze_frame_cache function and supplied them to
14microblaze_frame_prev_register function
15
16Signed-off-by:nagaraju <nmekala@xilix.com>
17Upstream-Status: Pending
18---
19 gdb/microblaze-tdep.c | 42 ++++++++++++++++++++++++++++++++++--------
20 gdb/microblaze-tdep.h | 5 +++--
21 2 files changed, 37 insertions(+), 10 deletions(-)
22
23diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
24index 0ce4947..247740e 100644
25--- a/gdb/microblaze-tdep.c
26+++ b/gdb/microblaze-tdep.c
27@@ -225,6 +225,7 @@ microblaze_alloc_frame_cache (void)
28 /* Base address. */
29 cache->base = 0;
30 cache->pc = 0;
31+ cache->saved_sp = 0;
32
33 /* Frameless until proven otherwise. */
34 cache->frameless_p = 1;
35@@ -347,6 +348,7 @@ microblaze_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc,
36 cache->frameless_p = 0; /* Frame found. */
37 save_hidden_pointer_found = 0;
38 non_stack_instruction_found = 0;
39+ cache->register_offsets[rd] = -imm;
40 continue;
41 }
42 else if (IS_SPILL_SP(op, rd, ra))
43@@ -508,6 +510,7 @@ microblaze_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
44 return start_pc;
45 }
46
47+enum { REG_UNAVAIL = (CORE_ADDR) -1 };
48 /* Normal frames. */
49
50 static struct microblaze_frame_cache *
51@@ -515,7 +518,7 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
52 {
53 struct microblaze_frame_cache *cache;
54 struct gdbarch *gdbarch = get_frame_arch (next_frame);
55- CORE_ADDR func;
56+ CORE_ADDR current_pc;
57 int rn;
58
59 if (*this_cache)
60@@ -529,10 +532,18 @@ microblaze_frame_cache (struct frame_info *next_frame, void **this_cache)
61 for (rn = 0; rn < gdbarch_num_regs (gdbarch); rn++)
62 cache->register_offsets[rn] = -1;
63
64- func = get_frame_func (next_frame);
65+ cache->pc = get_frame_func (next_frame);
66+ current_pc = get_frame_pc (next_frame);
67+
68+ if (cache->pc)
69+ microblaze_analyze_prologue (gdbarch, cache->pc, current_pc,
70+ cache);
71
72 cache->base = get_frame_register_unsigned (next_frame, gdbarch_sp_regnum (gdbarch));
73- cache->pc = get_frame_address_in_block (next_frame);
74+ cache->saved_sp = cache->base + cache->framesize;
75+
76+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM] = cache->base;
77+ cache->register_offsets[MICROBLAZE_SP_REGNUM] = cache->saved_sp;
78
79 return cache;
80 }
81@@ -548,7 +559,7 @@ microblaze_frame_this_id (struct frame_info *next_frame, void **this_cache,
82 if (cache->base == 0)
83 return;
84
85- (*this_id) = frame_id_build (cache->base, get_frame_pc (next_frame));
86+ (*this_id) = frame_id_build (cache->base, cache->pc);
87 }
88
89 static struct value *
90@@ -558,6 +569,14 @@ microblaze_frame_prev_register (struct frame_info *this_frame,
91 struct microblaze_frame_cache *cache =
92 microblaze_frame_cache (this_frame, this_cache);
93
94+ if ((regnum == MICROBLAZE_SP_REGNUM &&
95+ cache->register_offsets[MICROBLAZE_SP_REGNUM])
96+ || (regnum == MICROBLAZE_FP_REGNUM &&
97+ cache->register_offsets[MICROBLAZE_SP_REGNUM]))
98+
99+ return frame_unwind_got_constant (this_frame, regnum,
100+ cache->register_offsets[MICROBLAZE_SP_REGNUM]);
101+
102 if (cache->frameless_p)
103 {
104 if (regnum == MICROBLAZE_PC_REGNUM)
105@@ -565,11 +584,18 @@ microblaze_frame_prev_register (struct frame_info *this_frame,
106 if (regnum == MICROBLAZE_SP_REGNUM)
107 regnum = 1;
108 return trad_frame_get_prev_register (this_frame,
109- cache->saved_regs, regnum);
110+ cache->saved_regs, regnum);
111 }
112- else
113- return trad_frame_get_prev_register (this_frame, cache->saved_regs,
114- regnum);
115+
116+ if (regnum == MICROBLAZE_PC_REGNUM)
117+ {
118+ regnum = 15;
119+ return frame_unwind_got_memory (this_frame, regnum,
120+ cache->register_offsets[MICROBLAZE_PREV_PC_REGNUM]);
121+ }
122+
123+ return trad_frame_get_prev_register (this_frame, cache->saved_regs,
124+ regnum);
125
126 }
127
128diff --git a/gdb/microblaze-tdep.h b/gdb/microblaze-tdep.h
129index cd32e9f..14eb3ab 100644
130--- a/gdb/microblaze-tdep.h
131+++ b/gdb/microblaze-tdep.h
132@@ -57,6 +57,7 @@ struct microblaze_frame_cache
133
134 /* Offsets to saved registers. */
135 int register_offsets[59]; /* Must match MICROBLAZE_NUM_REGS. */
136+ CORE_ADDR saved_sp;
137
138 /* Table of saved registers. */
139 struct trad_frame_saved_reg *saved_regs;
140@@ -80,11 +81,11 @@ enum microblaze_regnum
141 MICROBLAZE_R12_REGNUM,
142 MICROBLAZE_R13_REGNUM,
143 MICROBLAZE_R14_REGNUM,
144- MICROBLAZE_R15_REGNUM,
145+ MICROBLAZE_R15_REGNUM, MICROBLAZE_PREV_PC_REGNUM = MICROBLAZE_R15_REGNUM,
146 MICROBLAZE_R16_REGNUM,
147 MICROBLAZE_R17_REGNUM,
148 MICROBLAZE_R18_REGNUM,
149- MICROBLAZE_R19_REGNUM,
150+ MICROBLAZE_R19_REGNUM, MICROBLAZE_FP_REGNUM = MICROBLAZE_R19_REGNUM,
151 MICROBLAZE_R20_REGNUM,
152 MICROBLAZE_R21_REGNUM,
153 MICROBLAZE_R22_REGNUM,
154--
1551.9.0
156
diff --git a/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch b/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch
deleted file mode 100644
index 1ad6b89c..00000000
--- a/recipes-devtools/gdb/files/0009-Patch-microblaze-Initial-support-for-native-gdb.patch
+++ /dev/null
@@ -1,495 +0,0 @@
1From c7b918283f2e438deef78aae84f6b748a7a1bb54 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@petalogix.com>
3Date: Fri, 20 Jul 2012 15:18:35 +1000
4Subject: [PATCH 09/16] [Patch, microblaze]: Initial support for native gdb
5
6microblaze: Follow PPC method of getting setting registers
7using PTRACE PEEK/POKE
8
9Signed-off-by: David Holsgrove <david.holsgrove@petalogix.com>
10Upstream-Status: Pending
11---
12 gdb/Makefile.in | 4 +-
13 gdb/config/microblaze/linux.mh | 10 +
14 gdb/microblaze-linux-nat.c | 431 +++++++++++++++++++++++++++++++++++++++++
15 3 files changed, 443 insertions(+), 2 deletions(-)
16 create mode 100644 gdb/config/microblaze/linux.mh
17 create mode 100644 gdb/microblaze-linux-nat.c
18
19diff --git a/gdb/Makefile.in b/gdb/Makefile.in
20index f2c16ec..12870a4 100644
21--- a/gdb/Makefile.in
22+++ b/gdb/Makefile.in
23@@ -904,7 +904,7 @@ top.h bsd-kvm.h gdb-stabs.h reggroups.h \
24 annotate.h sim-regno.h dictionary.h dfp.h main.h frame-unwind.h \
25 remote-fileio.h i386-linux-tdep.h vax-tdep.h objc-lang.h \
26 sentinel-frame.h bcache.h symfile.h windows-tdep.h linux-tdep.h \
27-gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h \
28+gdb_usleep.h jit.h xml-syscall.h microblaze-tdep.h microblaze-linux-tdep.h \
29 psymtab.h psympriv.h progspace.h bfin-tdep.h ia64-hpux-tdep.h \
30 amd64-darwin-tdep.h charset-list.h \
31 config/djgpp/langinfo.h config/djgpp/nl_types.h darwin-nat.h \
32@@ -1631,7 +1631,7 @@ ALLDEPFILES = \
33 m68kbsd-nat.c m68kbsd-tdep.c \
34 m68klinux-nat.c m68klinux-tdep.c \
35 m88k-tdep.c m88kbsd-nat.c \
36- microblaze-tdep.c microblaze-linux-tdep.c \
37+ microblaze-tdep.c microblaze-linux-nat.c microblaze-linux-tdep.c \
38 mingw-hdep.c \
39 mips-linux-nat.c mips-linux-tdep.c \
40 mips-irix-tdep.c \
41diff --git a/gdb/config/microblaze/linux.mh b/gdb/config/microblaze/linux.mh
42new file mode 100644
43index 0000000..547d103
44--- /dev/null
45+++ b/gdb/config/microblaze/linux.mh
46@@ -0,0 +1,10 @@
47+# Host: Microblaze, running Linux
48+
49+NAT_FILE= config/nm-linux.h
50+NATDEPFILES= inf-ptrace.o fork-child.o \
51+ microblaze-linux-nat.o proc-service.o linux-thread-db.o \
52+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o linux-ptrace.o \
53+ linux-waitpid.o
54+NAT_CDEPS = $(srcdir)/proc-service.list
55+
56+LOADLIBES = -ldl $(RDYNAMIC)
57diff --git a/gdb/microblaze-linux-nat.c b/gdb/microblaze-linux-nat.c
58new file mode 100644
59index 0000000..81f8346
60--- /dev/null
61+++ b/gdb/microblaze-linux-nat.c
62@@ -0,0 +1,431 @@
63+/* Microblaze GNU/Linux native support.
64+
65+ Copyright (C) 1988-1989, 1991-1992, 1994, 1996, 2000-2012 Free
66+ Software Foundation, Inc.
67+
68+ This file is part of GDB.
69+
70+ This program is free software; you can redistribute it and/or modify
71+ it under the terms of the GNU General Public License as published by
72+ the Free Software Foundation; either version 3 of the License, or
73+ (at your option) any later version.
74+
75+ This program is distributed in the hope that it will be useful,
76+ but WITHOUT ANY WARRANTY; without even the implied warranty of
77+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78+ GNU General Public License for more details.
79+
80+ You should have received a copy of the GNU General Public License
81+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
82+
83+#include "defs.h"
84+#include "arch-utils.h"
85+#include "dis-asm.h"
86+#include "frame.h"
87+#include "trad-frame.h"
88+#include "symtab.h"
89+#include "value.h"
90+#include "gdbcmd.h"
91+#include "breakpoint.h"
92+#include "inferior.h"
93+#include "regcache.h"
94+#include "target.h"
95+#include "frame.h"
96+#include "frame-base.h"
97+#include "frame-unwind.h"
98+#include "dwarf2-frame.h"
99+#include "osabi.h"
100+
101+#include "gdb_assert.h"
102+#include <string.h>
103+#include "target-descriptions.h"
104+#include "opcodes/microblaze-opcm.h"
105+#include "opcodes/microblaze-dis.h"
106+
107+#include "linux-nat.h"
108+#include "target-descriptions.h"
109+
110+#include <sys/user.h>
111+#include <sys/utsname.h>
112+#include <sys/procfs.h>
113+#include <sys/ptrace.h>
114+
115+/* Prototypes for supply_gregset etc. */
116+#include "gregset.h"
117+
118+#include "microblaze-tdep.h"
119+
120+#include <elf/common.h>
121+#include "auxv.h"
122+
123+/* Defines ps_err_e, struct ps_prochandle. */
124+#include "gdb_proc_service.h"
125+
126+/* On GNU/Linux, threads are implemented as pseudo-processes, in which
127+ case we may be tracing more than one process at a time. In that
128+ case, inferior_ptid will contain the main process ID and the
129+ individual thread (process) ID. get_thread_id () is used to get
130+ the thread id if it's available, and the process id otherwise. */
131+
132+int
133+get_thread_id (ptid_t ptid)
134+{
135+ int tid = ptid_get_lwp (ptid);
136+ if (0 == tid)
137+ tid = ptid_get_pid (ptid);
138+ return tid;
139+}
140+
141+#define GET_THREAD_ID(PTID) get_thread_id (PTID)
142+
143+/* Non-zero if our kernel may support the PTRACE_GETREGS and
144+ PTRACE_SETREGS requests, for reading and writing the
145+ general-purpose registers. Zero if we've tried one of
146+ them and gotten an error. */
147+int have_ptrace_getsetregs = 1;
148+
149+static int
150+microblaze_register_u_addr (struct gdbarch *gdbarch, int regno)
151+{
152+ int u_addr = -1;
153+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
154+ /* NOTE: cagney/2003-11-25: This is the word size used by the ptrace
155+ interface, and not the wordsize of the program's ABI. */
156+ int wordsize = sizeof (long);
157+
158+ /* General purpose registers occupy 1 slot each in the buffer. */
159+ if (regno >= MICROBLAZE_R0_REGNUM
160+ && regno <= MICROBLAZE_FSR_REGNUM)
161+ u_addr = (regno * wordsize);
162+
163+ return u_addr;
164+}
165+
166+
167+static void
168+fetch_register (struct regcache *regcache, int tid, int regno)
169+{
170+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
171+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
172+ /* This isn't really an address. But ptrace thinks of it as one. */
173+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
174+ int bytes_transferred;
175+ unsigned int offset; /* Offset of registers within the u area. */
176+ char buf[MAX_REGISTER_SIZE];
177+
178+ if (regaddr == -1)
179+ {
180+ memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */
181+ regcache_raw_supply (regcache, regno, buf);
182+ return;
183+ }
184+
185+ /* Read the raw register using sizeof(long) sized chunks. On a
186+ 32-bit platform, 64-bit floating-point registers will require two
187+ transfers. */
188+ for (bytes_transferred = 0;
189+ bytes_transferred < register_size (gdbarch, regno);
190+ bytes_transferred += sizeof (long))
191+ {
192+ long l;
193+
194+ errno = 0;
195+ l = ptrace (PTRACE_PEEKUSER, tid, (PTRACE_TYPE_ARG3) regaddr, 0);
196+ regaddr += sizeof (long);
197+ if (errno != 0)
198+ {
199+ char message[128];
200+ sprintf (message, "reading register %s (#%d)",
201+ gdbarch_register_name (gdbarch, regno), regno);
202+ perror_with_name (message);
203+ }
204+ memcpy (&buf[bytes_transferred], &l, sizeof (l));
205+ }
206+
207+ /* Now supply the register. Keep in mind that the regcache's idea
208+ of the register's size may not be a multiple of sizeof
209+ (long). */
210+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
211+ {
212+ /* Little-endian values are always found at the left end of the
213+ bytes transferred. */
214+ regcache_raw_supply (regcache, regno, buf);
215+ }
216+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
217+ {
218+ /* Big-endian values are found at the right end of the bytes
219+ transferred. */
220+ size_t padding = (bytes_transferred - register_size (gdbarch, regno));
221+ regcache_raw_supply (regcache, regno, buf + padding);
222+ }
223+ else
224+ internal_error (__FILE__, __LINE__,
225+ _("fetch_register: unexpected byte order: %d"),
226+ gdbarch_byte_order (gdbarch));
227+}
228+
229+/* This function actually issues the request to ptrace, telling
230+ it to get all general-purpose registers and put them into the
231+ specified regset.
232+
233+ If the ptrace request does not exist, this function returns 0
234+ and properly sets the have_ptrace_* flag. If the request fails,
235+ this function calls perror_with_name. Otherwise, if the request
236+ succeeds, then the regcache gets filled and 1 is returned. */
237+static int
238+fetch_all_gp_regs (struct regcache *regcache, int tid)
239+{
240+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
241+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
242+ gdb_gregset_t gregset;
243+
244+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
245+ {
246+ if (errno == EIO)
247+ {
248+ have_ptrace_getsetregs = 0;
249+ return 0;
250+ }
251+ perror_with_name (_("Couldn't get general-purpose registers."));
252+ }
253+
254+ supply_gregset (regcache, (const gdb_gregset_t *) &gregset);
255+
256+ return 1;
257+}
258+
259+
260+/* This is a wrapper for the fetch_all_gp_regs function. It is
261+ responsible for verifying if this target has the ptrace request
262+ that can be used to fetch all general-purpose registers at one
263+ shot. If it doesn't, then we should fetch them using the
264+ old-fashioned way, which is to iterate over the registers and
265+ request them one by one. */
266+static void
267+fetch_gp_regs (struct regcache *regcache, int tid)
268+{
269+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
270+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
271+ int i;
272+
273+ if (have_ptrace_getsetregs)
274+ if (fetch_all_gp_regs (regcache, tid))
275+ return;
276+
277+ /* If we've hit this point, it doesn't really matter which
278+ architecture we are using. We just need to read the
279+ registers in the "old-fashioned way". */
280+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
281+ fetch_register (regcache, tid, i);
282+}
283+
284+
285+static void
286+store_register (const struct regcache *regcache, int tid, int regno)
287+{
288+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
289+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
290+ /* This isn't really an address. But ptrace thinks of it as one. */
291+ CORE_ADDR regaddr = microblaze_register_u_addr (gdbarch, regno);
292+ int i;
293+ size_t bytes_to_transfer;
294+ char buf[MAX_REGISTER_SIZE];
295+
296+ if (regaddr == -1)
297+ return;
298+
299+ /* First collect the register. Keep in mind that the regcache's
300+ idea of the register's size may not be a multiple of sizeof
301+ (long). */
302+ memset (buf, 0, sizeof buf);
303+ bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long));
304+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
305+ {
306+ /* Little-endian values always sit at the left end of the buffer. */
307+ regcache_raw_collect (regcache, regno, buf);
308+ }
309+ else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
310+ {
311+ /* Big-endian values sit at the right end of the buffer. */
312+ size_t padding = (bytes_to_transfer - register_size (gdbarch, regno));
313+ regcache_raw_collect (regcache, regno, buf + padding);
314+ }
315+
316+ for (i = 0; i < bytes_to_transfer; i += sizeof (long))
317+ {
318+ long l;
319+
320+ memcpy (&l, &buf[i], sizeof (l));
321+ errno = 0;
322+ ptrace (PTRACE_POKEUSER, tid, (PTRACE_TYPE_ARG3) regaddr, l);
323+ regaddr += sizeof (long);
324+
325+ if (errno != 0)
326+ {
327+ char message[128];
328+ sprintf (message, "writing register %s (#%d)",
329+ gdbarch_register_name (gdbarch, regno), regno);
330+ perror_with_name (message);
331+ }
332+ }
333+}
334+
335+/* This function actually issues the request to ptrace, telling
336+ it to store all general-purpose registers present in the specified
337+ regset.
338+
339+ If the ptrace request does not exist, this function returns 0
340+ and properly sets the have_ptrace_* flag. If the request fails,
341+ this function calls perror_with_name. Otherwise, if the request
342+ succeeds, then the regcache is stored and 1 is returned. */
343+static int
344+store_all_gp_regs (const struct regcache *regcache, int tid, int regno)
345+{
346+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
347+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
348+ gdb_gregset_t gregset;
349+
350+ if (ptrace (PTRACE_GETREGS, tid, 0, (void *) &gregset) < 0)
351+ {
352+ if (errno == EIO)
353+ {
354+ have_ptrace_getsetregs = 0;
355+ return 0;
356+ }
357+ perror_with_name (_("Couldn't get general-purpose registers."));
358+ }
359+
360+ fill_gregset (regcache, &gregset, regno);
361+
362+ if (ptrace (PTRACE_SETREGS, tid, 0, (void *) &gregset) < 0)
363+ {
364+ if (errno == EIO)
365+ {
366+ have_ptrace_getsetregs = 0;
367+ return 0;
368+ }
369+ perror_with_name (_("Couldn't set general-purpose registers."));
370+ }
371+
372+ return 1;
373+}
374+
375+/* This is a wrapper for the store_all_gp_regs function. It is
376+ responsible for verifying if this target has the ptrace request
377+ that can be used to store all general-purpose registers at one
378+ shot. If it doesn't, then we should store them using the
379+ old-fashioned way, which is to iterate over the registers and
380+ store them one by one. */
381+static void
382+store_gp_regs (const struct regcache *regcache, int tid, int regno)
383+{
384+ struct gdbarch *gdbarch = get_regcache_arch (regcache);
385+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
386+ int i;
387+
388+ if (have_ptrace_getsetregs)
389+ if (store_all_gp_regs (regcache, tid, regno))
390+ return;
391+
392+ /* If we hit this point, it doesn't really matter which
393+ architecture we are using. We just need to store the
394+ registers in the "old-fashioned way". */
395+ for (i = MICROBLAZE_R0_REGNUM; i <= MICROBLAZE_FSR_REGNUM; i++)
396+ store_register (regcache, tid, i);
397+}
398+
399+
400+/* Fetch registers from the child process. Fetch all registers if
401+ regno == -1, otherwise fetch all general registers or all floating
402+ point registers depending upon the value of regno. */
403+
404+static void
405+microblaze_linux_fetch_inferior_registers (struct target_ops *ops,
406+ struct regcache *regcache, int regno)
407+{
408+ /* Get the thread id for the ptrace call. */
409+ int tid = GET_THREAD_ID (inferior_ptid);
410+
411+ if (regno == -1)
412+ fetch_gp_regs (regcache, tid);
413+ else
414+ fetch_register (regcache, tid, regno);
415+}
416+
417+/* Store registers back into the inferior. Store all registers if
418+ regno == -1, otherwise store all general registers or all floating
419+ point registers depending upon the value of regno. */
420+
421+static void
422+microblaze_linux_store_inferior_registers (struct target_ops *ops,
423+ struct regcache *regcache, int regno)
424+{
425+ /* Get the thread id for the ptrace call. */
426+ int tid = GET_THREAD_ID (inferior_ptid);
427+
428+ if (regno >= 0)
429+ store_register (regcache, tid, regno);
430+ else
431+ store_gp_regs (regcache, tid, -1);
432+}
433+
434+/* Wrapper functions for the standard regset handling, used by
435+ thread debugging. */
436+
437+void
438+fill_gregset (const struct regcache *regcache,
439+ gdb_gregset_t *gregsetp, int regno)
440+{
441+ microblaze_collect_gregset (NULL, regcache, regno, gregsetp);
442+}
443+
444+void
445+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
446+{
447+ microblaze_supply_gregset (NULL, regcache, -1, gregsetp);
448+}
449+
450+void
451+fill_fpregset (const struct regcache *regcache,
452+ gdb_fpregset_t *fpregsetp, int regno)
453+{
454+ /* FIXME. */
455+}
456+
457+void
458+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
459+{
460+ /* FIXME. */
461+}
462+
463+static const struct target_desc *
464+microblaze_linux_read_description (struct target_ops *ops)
465+{
466+ CORE_ADDR microblaze_hwcap = 0;
467+
468+ if (target_auxv_search (ops, AT_HWCAP, &microblaze_hwcap) != 1)
469+ return NULL;
470+
471+ return NULL;
472+}
473+
474+
475+void _initialize_microblaze_linux_nat (void);
476+
477+void
478+_initialize_microblaze_linux_nat (void)
479+{
480+ struct target_ops *t;
481+
482+ /* Fill in the generic GNU/Linux methods. */
483+ t = linux_target ();
484+
485+ /* Add our register access methods. */
486+ t->to_fetch_registers = microblaze_linux_fetch_inferior_registers;
487+ t->to_store_registers = microblaze_linux_store_inferior_registers;
488+
489+ t->to_read_description = microblaze_linux_read_description;
490+
491+ /* Register the target. */
492+ linux_nat_add_target (t);
493+}
494--
4951.9.0
diff --git a/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch b/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch
deleted file mode 100644
index 3912ca57..00000000
--- a/recipes-devtools/gdb/files/0010-Patch-gdb-Robustify-inline-function-support.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From a02963a97d7ce38b0af205f9e3e6dd7e0e06d9be Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar@axis.com>
3Date: Mon, 27 Feb 2012 06:28:00 +0100
4Subject: [PATCH 10/16] [Patch, gdb]: Robustify inline function support
5
6Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
7Upstream-Status: Pending
8---
9 gdb/blockframe.c | 3 ++-
10 gdb/inline-frame.c | 3 +++
11 2 files changed, 5 insertions(+), 1 deletion(-)
12
13diff --git a/gdb/blockframe.c b/gdb/blockframe.c
14index 0a9381e..ba41d85 100644
15--- a/gdb/blockframe.c
16+++ b/gdb/blockframe.c
17@@ -77,7 +77,8 @@ get_frame_block (struct frame_info *frame, CORE_ADDR *addr_in_block)
18 inline_count--;
19
20 bl = BLOCK_SUPERBLOCK (bl);
21- gdb_assert (bl != NULL);
22+ if (!bl)
23+ return NULL;
24 }
25
26 return bl;
27diff --git a/gdb/inline-frame.c b/gdb/inline-frame.c
28index eb82143..a793390 100644
29--- a/gdb/inline-frame.c
30+++ b/gdb/inline-frame.c
31@@ -231,6 +231,9 @@ inline_frame_sniffer (const struct frame_unwind *self,
32 cur_block = BLOCK_SUPERBLOCK (cur_block);
33 }
34
35+ if (depth == 0)
36+ return 0;
37+
38 /* Check how many inlined functions already have frames. */
39 for (next_frame = get_next_frame (this_frame);
40 next_frame && get_frame_type (next_frame) == INLINE_FRAME;
41--
421.9.0
43
diff --git a/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch b/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch
deleted file mode 100644
index bdec77c5..00000000
--- a/recipes-devtools/gdb/files/0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From a05fb34192727fc1b63c827ed006ddde846ce6b8 Mon Sep 17 00:00:00 2001
2From: Nathan Rossi <nathan.rossi@petalogix.com>
3Date: Tue, 8 May 2012 18:11:17 +1000
4Subject: [PATCH 11/16] [Patch, gdb]: Fix debug message when register is
5 unavailable
6
7Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
8Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
9Upstream-Status: Pending
10---
11 gdb/frame.c | 13 ++++++++++---
12 1 file changed, 10 insertions(+), 3 deletions(-)
13
14diff --git a/gdb/frame.c b/gdb/frame.c
15index 013d602..4d0766f 100644
16--- a/gdb/frame.c
17+++ b/gdb/frame.c
18@@ -1134,12 +1134,19 @@ frame_unwind_register_value (struct frame_info *frame, int regnum)
19 else
20 {
21 int i;
22- const gdb_byte *buf = value_contents (value);
23+ const gdb_byte *buf = NULL;
24+ if (value_entirely_available(value)) {
25+ buf = value_contents (value);
26+ }
27
28 fprintf_unfiltered (gdb_stdlog, " bytes=");
29 fprintf_unfiltered (gdb_stdlog, "[");
30- for (i = 0; i < register_size (gdbarch, regnum); i++)
31- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
32+ if (buf != NULL) {
33+ for (i = 0; i < register_size (gdbarch, regnum); i++)
34+ fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
35+ } else {
36+ fprintf_unfiltered (gdb_stdlog, "unavailable");
37+ }
38 fprintf_unfiltered (gdb_stdlog, "]");
39 }
40 }
41--
421.9.0
43
diff --git a/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch b/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch
deleted file mode 100644
index 819cd179..00000000
--- a/recipes-devtools/gdb/files/0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From f54d5334afe799e15ca21c5d83097a4c81bbab7e Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Fri, 22 Jun 2012 01:20:20 +0200
4Subject: [PATCH 12/16] [LOCAL]: Disable the warning message for eh_frame_hdr
5
6Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
7Upstream-Status: Pending
8---
9 bfd/elf-eh-frame.c | 9 ++++++---
10 1 file changed, 6 insertions(+), 3 deletions(-)
11
12diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
13index 0f0a563..7d8e047 100644
14--- a/bfd/elf-eh-frame.c
15+++ b/bfd/elf-eh-frame.c
16@@ -919,9 +919,12 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
17 goto success;
18
19 free_no_table:
20- (*info->callbacks->einfo)
21- (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
22- abfd, sec);
23+ /* FIXME: Remove the microblaze specifics when relaxing gets fixed. */
24+ if (bfd_get_arch(abfd) != bfd_arch_microblaze) {
25+ (*info->callbacks->einfo)
26+ (_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"),
27+ abfd, sec);
28+ }
29 hdr_info->table = FALSE;
30 if (sec_info)
31 free (sec_info);
32--
331.9.0
34
diff --git a/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch b/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
deleted file mode 100644
index 3a0eae83..00000000
--- a/recipes-devtools/gdb/files/0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch
+++ /dev/null
@@ -1,64 +0,0 @@
1From c9f1f07e5b0756069e3d4b04eb9505027f09677f Mon Sep 17 00:00:00 2001
2From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
3Date: Tue, 14 Feb 2012 01:00:22 +0100
4Subject: [PATCH 13/16] [LOCAL]: Fix relaxation of assembler resolved
5 references
6
7Upstream-Status: Pending
8---
9 bfd/elf32-microblaze.c | 39 +++++++++++++++++++++++++++++++++++++++
10 1 file changed, 39 insertions(+)
11
12diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
13index cbd18f0..f90df47 100644
14--- a/bfd/elf32-microblaze.c
15+++ b/bfd/elf32-microblaze.c
16@@ -1968,6 +1968,45 @@ microblaze_elf_relax_section (bfd *abfd,
17 irelscanend = irelocs + o->reloc_count;
18 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
19 {
20+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
21+ {
22+ unsigned int val;
23+
24+ isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
25+
26+ /* This was a PC-relative instruction that was completely resolved. */
27+ if (ocontents == NULL)
28+ {
29+ if (elf_section_data (o)->this_hdr.contents != NULL)
30+ ocontents = elf_section_data (o)->this_hdr.contents;
31+ else
32+ {
33+ /* We always cache the section contents.
34+ Perhaps, if info->keep_memory is FALSE, we
35+ should free them, if we are permitted to. */
36+
37+ if (o->rawsize == 0)
38+ o->rawsize = o->size;
39+ ocontents = (bfd_byte *) bfd_malloc (o->rawsize);
40+ if (ocontents == NULL)
41+ goto error_return;
42+ if (!bfd_get_section_contents (abfd, o, ocontents,
43+ (file_ptr) 0,
44+ o->rawsize))
45+ goto error_return;
46+ elf_section_data (o)->this_hdr.contents = ocontents;
47+ }
48+ }
49+
50+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
51+ + isym->st_value, sec);
52+ val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
53+ microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
54+ irelscan->r_addend);
55+ }
56+ if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
57+ fprintf(stderr, "Unhandled NONE 64\n");
58+ }
59 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
60 {
61 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
62--
631.9.0
64
diff --git a/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch b/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
deleted file mode 100644
index 85cee9d5..00000000
--- a/recipes-devtools/gdb/files/0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch
+++ /dev/null
@@ -1,192 +0,0 @@
1From aca2758cff1f8fdc5ad7b6076ef985ba9ec5f857 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Mon, 4 Feb 2013 12:15:22 +1000
4Subject: [PATCH 14/16] [LOCAL]: Fixup debug_loc sections after linker
5 relaxation
6
7Adds a new reloctype R_MICROBLAZE_32_NONE, used for passing
8reloc info from the assembler to the linker when the linker
9manages to fully resolve a local symbol reference.
10
11This is a workaround for design flaws in the assembler to
12linker interface with regards to linker relaxation.
13
14Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
15Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
16Upstream-Status: Pending
17---
18 bfd/bfd-in2.h | 5 +++++
19 bfd/elf32-microblaze.c | 45 +++++++++++++++++++++++++++++++++++++--------
20 bfd/libbfd.h | 1 +
21 bfd/reloc.c | 6 ++++++
22 include/elf/microblaze.h | 1 +
23 5 files changed, 50 insertions(+), 8 deletions(-)
24
25diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
26index 8b7f2ee..de38907 100644
27--- a/bfd/bfd-in2.h
28+++ b/bfd/bfd-in2.h
29@@ -5449,6 +5449,11 @@ value relative to the read-write small data area anchor */
30 expressions of the form "Symbol Op Symbol" */
31 BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM,
32
33+/* This is a 32 bit reloc that stores the 32 bit pc relative
34+value in two words (with an imm instruction). No relocation is
35+done here - only used for relaxing */
36+ BFD_RELOC_MICROBLAZE_32_NONE,
37+
38 /* This is a 64 bit reloc that stores the 32 bit pc relative
39 value in two words (with an imm instruction). No relocation is
40 done here - only used for relaxing */
41diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
42index f90df47..a3f89b9 100644
43--- a/bfd/elf32-microblaze.c
44+++ b/bfd/elf32-microblaze.c
45@@ -177,6 +177,20 @@ static reloc_howto_type microblaze_elf_howto_raw[] =
46 FALSE), /* PC relative offset? */
47
48 /* This reloc does nothing. Used for relaxation. */
49+ HOWTO (R_MICROBLAZE_32_NONE, /* Type. */
50+ 0, /* Rightshift. */
51+ 2, /* Size (0 = byte, 1 = short, 2 = long). */
52+ 32, /* Bitsize. */
53+ TRUE, /* PC_relative. */
54+ 0, /* Bitpos. */
55+ complain_overflow_bitfield, /* Complain on overflow. */
56+ NULL, /* Special Function. */
57+ "R_MICROBLAZE_32_NONE",/* Name. */
58+ FALSE, /* Partial Inplace. */
59+ 0, /* Source Mask. */
60+ 0, /* Dest Mask. */
61+ FALSE), /* PC relative offset? */
62+
63 HOWTO (R_MICROBLAZE_64_NONE, /* Type. */
64 0, /* Rightshift. */
65 2, /* Size (0 = byte, 1 = short, 2 = long). */
66@@ -532,7 +546,10 @@ microblaze_elf_reloc_type_lookup (bfd * abfd ATTRIBUTE_UNUSED,
67 case BFD_RELOC_NONE:
68 microblaze_reloc = R_MICROBLAZE_NONE;
69 break;
70- case BFD_RELOC_MICROBLAZE_64_NONE:
71+ case BFD_RELOC_MICROBLAZE_32_NONE:
72+ microblaze_reloc = R_MICROBLAZE_32_NONE;
73+ break;
74+ case BFD_RELOC_MICROBLAZE_64_NONE:
75 microblaze_reloc = R_MICROBLAZE_64_NONE;
76 break;
77 case BFD_RELOC_32:
78@@ -1913,14 +1930,22 @@ microblaze_elf_relax_section (bfd *abfd,
79 }
80 break;
81 case R_MICROBLAZE_NONE:
82+ case R_MICROBLAZE_32_NONE:
83 {
84 /* This was a PC-relative instruction that was
85 completely resolved. */
86 int sfix, efix;
87+ unsigned int val;
88 bfd_vma target_address;
89 target_address = irel->r_addend + irel->r_offset;
90 sfix = calc_fixup (irel->r_offset, 0, sec);
91 efix = calc_fixup (target_address, 0, sec);
92+
93+ /* Validate the in-band val. */
94+ val = bfd_get_32 (abfd, contents + irel->r_offset);
95+ if (val != irel->r_addend && ELF32_R_TYPE (irel->r_info) == R_MICROBLAZE_32_NONE) {
96+ fprintf(stderr, "%d: CORRUPT relax reloc %x %lx\n", __LINE__, val, irel->r_addend);
97+ }
98 irel->r_addend -= (efix - sfix);
99 /* Should use HOWTO. */
100 microblaze_bfd_write_imm_value_32 (abfd, contents + irel->r_offset,
101@@ -1968,12 +1993,16 @@ microblaze_elf_relax_section (bfd *abfd,
102 irelscanend = irelocs + o->reloc_count;
103 for (irelscan = irelocs; irelscan < irelscanend; irelscan++)
104 {
105- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_NONE)
106+ if (1 && ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32_NONE)
107 {
108 unsigned int val;
109
110 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
111
112+ /* hax: We only do the following fixup for debug location lists. */
113+ if (strcmp(".debug_loc", o->name))
114+ continue;
115+
116 /* This was a PC-relative instruction that was completely resolved. */
117 if (ocontents == NULL)
118 {
119@@ -1998,15 +2027,15 @@ microblaze_elf_relax_section (bfd *abfd,
120 }
121 }
122
123- irelscan->r_addend -= calc_fixup (irelscan->r_addend
124- + isym->st_value, sec);
125 val = bfd_get_32 (abfd, ocontents + irelscan->r_offset);
126+ if (val != irelscan->r_addend) {
127+ fprintf(stderr, "%d: CORRUPT relax reloc! %x %lx\n", __LINE__, val, irelscan->r_addend);
128+ }
129+
130+ irelscan->r_addend -= calc_fixup (irelscan->r_addend, 0, sec);
131 microblaze_bfd_write_imm_value_32 (abfd, ocontents + irelscan->r_offset,
132 irelscan->r_addend);
133 }
134- if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_64_NONE) {
135- fprintf(stderr, "Unhandled NONE 64\n");
136- }
137 if (ELF32_R_TYPE (irelscan->r_info) == (int) R_MICROBLAZE_32)
138 {
139 isym = isymbuf + ELF32_R_SYM (irelscan->r_info);
140@@ -2066,7 +2095,7 @@ microblaze_elf_relax_section (bfd *abfd,
141 elf_section_data (o)->this_hdr.contents = ocontents;
142 }
143 }
144- irelscan->r_addend -= calc_fixup (irel->r_addend
145+ irelscan->r_addend -= calc_fixup (irelscan->r_addend
146 + isym->st_value,
147 0,
148 sec);
149diff --git a/bfd/libbfd.h b/bfd/libbfd.h
150index 09f307f..840c662 100644
151--- a/bfd/libbfd.h
152+++ b/bfd/libbfd.h
153@@ -2644,6 +2644,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
154 "BFD_RELOC_MICROBLAZE_32_ROSDA",
155 "BFD_RELOC_MICROBLAZE_32_RWSDA",
156 "BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM",
157+ "BFD_RELOC_MICROBLAZE_32_NONE",
158 "BFD_RELOC_MICROBLAZE_64_NONE",
159 "BFD_RELOC_MICROBLAZE_64_GOTPC",
160 "BFD_RELOC_MICROBLAZE_64_GOT",
161diff --git a/bfd/reloc.c b/bfd/reloc.c
162index 7f46c58..5bcd52d 100644
163--- a/bfd/reloc.c
164+++ b/bfd/reloc.c
165@@ -6396,6 +6396,12 @@ ENUMDOC
166 This is a 32 bit reloc for the microblaze to handle
167 expressions of the form "Symbol Op Symbol"
168 ENUM
169+ BFD_RELOC_MICROBLAZE_32_NONE
170+ENUMDOC
171+ This is a 32 bit reloc that stores the 32 bit pc relative
172+ value in two words (with an imm instruction). No relocation is
173+ done here - only used for relaxing
174+ENUM
175 BFD_RELOC_MICROBLAZE_64_NONE
176 ENUMDOC
177 This is a 64 bit reloc that stores the 32 bit pc relative
178diff --git a/include/elf/microblaze.h b/include/elf/microblaze.h
179index effca20..f8420dc 100644
180--- a/include/elf/microblaze.h
181+++ b/include/elf/microblaze.h
182@@ -58,6 +58,7 @@ START_RELOC_NUMBERS (elf_microblaze_reloc_type)
183 RELOC_NUMBER (R_MICROBLAZE_TLSDTPREL64, 27) /* TLS Offset Within TLS Block */
184 RELOC_NUMBER (R_MICROBLAZE_TLSGOTTPREL32, 28) /* TLS Offset From Thread Pointer */
185 RELOC_NUMBER (R_MICROBLAZE_TLSTPREL32, 29) /* TLS Offset From Thread Pointer */
186+ RELOC_NUMBER (R_MICROBLAZE_32_NONE, 30)
187
188 END_RELOC_NUMBERS (R_MICROBLAZE_max)
189
190--
1911.9.0
192
diff --git a/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch b/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch
deleted file mode 100644
index 0bb66a94..00000000
--- a/recipes-devtools/gdb/files/0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 22c63d4d79ac488403340470c14c73bad4984fa3 Mon Sep 17 00:00:00 2001
2From: David Holsgrove <david.holsgrove@xilinx.com>
3Date: Wed, 27 Feb 2013 13:56:11 +1000
4Subject: [PATCH 15/16] [LOCAL]: upstream change to garbage collection sweep
5 causes mb regression
6
7Upstream change for PR13177 now clears the def_regular during gc_sweep of a
8section. (All other archs in binutils/bfd/elf32-*.c received an update
9to a warning about unresolvable relocations - this warning is not present
10in binutils/bfd/elf32-microblaze.c, but this warning check would not
11prevent the error being seen)
12
13The visible issue with this change is when running a c++ application
14in Petalinux which links libstdc++.so for exception handling it segfaults
15on execution.
16
17This does not occur if static linking libstdc++.a, so its during the
18relocations for a shared lib with garbage collection this occurs
19
20Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
21Upstream-Status: Pending
22---
23 bfd/elflink.c | 1 -
24 1 file changed, 1 deletion(-)
25
26diff --git a/bfd/elflink.c b/bfd/elflink.c
27index 6756fb1..f21dc06 100644
28--- a/bfd/elflink.c
29+++ b/bfd/elflink.c
30@@ -11932,7 +11932,6 @@ elf_gc_sweep_symbol (struct elf_link_hash_entry *h, void *data)
31
32 inf = (struct elf_gc_sweep_symbol_info *) data;
33 (*inf->hide_symbol) (inf->info, h, TRUE);
34- h->def_regular = 0;
35 h->ref_regular = 0;
36 h->ref_regular_nonweak = 0;
37 }
38--
391.9.0
40
diff --git a/recipes-devtools/gdb/gdb-7.7.1.inc b/recipes-devtools/gdb/gdb-7.7.1.inc
deleted file mode 100644
index 04488e9e..00000000
--- a/recipes-devtools/gdb/gdb-7.7.1.inc
+++ /dev/null
@@ -1,11 +0,0 @@
1LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7S = "${WORKDIR}/${BPN}-${PV}"
8
9SRC_URI[md5sum] = "45b07b53d81832d32ccd4829465d4886"
10SRC_URI[sha256sum] = "eefadb9831e3695d1eaef34e98b8f1fb441df6fe5071317ea49c6bd6ba213eff"
11
diff --git a/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb b/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb
deleted file mode 100644
index c349ebbb..00000000
--- a/recipes-devtools/gdb/gdb-cross-canadian_7.7.1.bb
+++ /dev/null
@@ -1,4 +0,0 @@
1require recipes-devtools/gdb/gdb-common.inc
2require recipes-devtools/gdb/gdb-cross-canadian.inc
3require gdb-${PV}.inc
4require gdb-microblaze-7.7.inc
diff --git a/recipes-devtools/gdb/gdb-cross_7.7.1.bb b/recipes-devtools/gdb/gdb-cross_7.7.1.bb
deleted file mode 100644
index 98b3359c..00000000
--- a/recipes-devtools/gdb/gdb-cross_7.7.1.bb
+++ /dev/null
@@ -1,3 +0,0 @@
1require recipes-devtools/gdb/gdb-cross.inc
2require gdb-${PV}.inc
3require gdb-microblaze-7.7.inc
diff --git a/recipes-devtools/gdb/gdb-microblaze-7.7.inc b/recipes-devtools/gdb/gdb-microblaze-7.7.inc
deleted file mode 100644
index 0b82bc67..00000000
--- a/recipes-devtools/gdb/gdb-microblaze-7.7.inc
+++ /dev/null
@@ -1,22 +0,0 @@
1
2# MicroBlaze does not support LTTng UST
3LTTNGUST_microblaze = ""
4
5# Add MicroBlaze Patches
6FILESEXTRAPATHS_append := "${THISDIR}/files:"
7SRC_URI_append += " \
8 file://0001-Patch-microblaze-Add-wdc.ext.clear-and-wdc.ext.flush.patch \
9 file://0003-Patch-microblaze-Initial-port-of-microblaze-core-rea.patch \
10 file://0004-Patch-microblaze-Communicate-in-larger-blocks-with-t.patch \
11 file://0005-Patch-microblaze-Add-mb-singlestepping.patch \
12 file://0006-Patch-microblaze-Add-initial-port-of-linux-gdbserver.patch \
13 file://0007-Patch-microblaze-Add-slr-and-shr-regs-and-little-end.patch \
14 file://0008-Patch-microblaze-Added-Backtrace-support-to-GDB.patch \
15 file://0009-Patch-microblaze-Initial-support-for-native-gdb.patch \
16 file://0010-Patch-gdb-Robustify-inline-function-support.patch \
17 file://0011-Patch-gdb-Fix-debug-message-when-register-is-unavail.patch \
18 file://0012-LOCAL-Disable-the-warning-message-for-eh_frame_hdr.patch \
19 file://0013-LOCAL-Fix-relaxation-of-assembler-resolved-reference.patch \
20 file://0014-LOCAL-Fixup-debug_loc-sections-after-linker-relaxati.patch \
21 file://0015-LOCAL-upstream-change-to-garbage-collection-sweep-ca.patch \
22 "
diff --git a/recipes-devtools/gdb/gdb_7.7.1.bb b/recipes-devtools/gdb/gdb_7.7.1.bb
deleted file mode 100644
index 80b589a1..00000000
--- a/recipes-devtools/gdb/gdb_7.7.1.bb
+++ /dev/null
@@ -1,29 +0,0 @@
1require recipes-devtools/gdb/gdb-common.inc
2require gdb-${PV}.inc
3require gdb-microblaze-7.7.inc
4
5inherit gettext
6inherit python-dir
7
8PACKAGECONFIG ??= ""
9PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python"
10PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace"
11
12do_configure_prepend() {
13 if [ -n "${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}" ]; then
14 cat > ${WORKDIR}/python << EOF
15#!/bin/sh
16case "\$2" in
17 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;;
18 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;;
19 --exec-prefix) echo "${exec_prefix}" ;;
20 *) exit 1 ;;
21esac
22exit 0
23EOF
24 chmod +x ${WORKDIR}/python
25 fi
26}
27
28PACKAGES =+ "gdbserver"
29FILES_gdbserver = "${bindir}/gdbserver"