1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
--- gdb-7.8.2.orig/gdb/microblaze-linux-tdep.c 2015-01-15 11:58:12.000000000 +0100
+++ gdb-7.8.2/gdb/microblaze-linux-tdep.c 2016-09-21 10:34:30.029222319 +0200
@@ -1,6 +1,6 @@
/* Target-dependent code for Xilinx MicroBlaze.
- Copyright (C) 2009-2014 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
This file is part of GDB.
@@ -32,11 +32,28 @@
#include "regset.h"
#include "solib-svr4.h"
#include "microblaze-tdep.h"
+#include "glibc-tdep.h"
#include "trad-frame.h"
#include "frame-unwind.h"
#include "tramp-frame.h"
#include "linux-tdep.h"
+static int microblaze_debug_flag = 0;
+
+static void
+microblaze_debug (const char *fmt, ...)
+{
+ if (microblaze_debug_flag)
+ {
+ va_list args;
+
+ va_start (args, fmt);
+ printf_unfiltered ("MICROBLAZE LINUX: ");
+ vprintf_unfiltered (fmt, args);
+ va_end (args);
+ }
+}
+
static int
microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
@@ -46,20 +63,27 @@ microblaze_linux_memory_remove_breakpoin
int val;
int bplen;
gdb_byte old_contents[BREAKPOINT_MAX];
+ struct cleanup *cleanup;
/* Determine appropriate breakpoint contents and size for this address. */
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
if (bp == NULL)
error (_("Software breakpoints not implemented for this target."));
+ /* Make sure we see the memory breakpoints. */
+ cleanup = make_show_memory_breakpoints_cleanup (1);
val = target_read_memory (addr, old_contents, bplen);
/* If our breakpoint is no longer at the address, this means that the
program modified the code on us, so it is wrong to put back the
old value. */
if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
- val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
+ {
+ val = target_write_raw_memory (addr, bp_tgt->shadow_contents, bplen);
+ microblaze_debug ("microblaze_linux_memory_remove_breakpoint writing back to memory at addr 0x%lx\n", addr);
+ }
+ do_cleanups (cleanup);
return val;
}
@@ -116,6 +140,50 @@ static struct tramp_frame microblaze_lin
microblaze_linux_sighandler_cache_init
};
+const struct microblaze_gregset microblaze_linux_core_gregset;
+
+static void
+microblaze_linux_supply_core_gregset (const struct regset *regset,
+ struct regcache *regcache,
+ int regnum, const void *gregs, size_t len)
+{
+ microblaze_supply_gregset (µblaze_linux_core_gregset, regcache,
+ regnum, gregs);
+}
+
+static void
+microblaze_linux_collect_core_gregset (const struct regset *regset,
+ const struct regcache *regcache,
+ int regnum, void *gregs, size_t len)
+{
+ microblaze_collect_gregset (µblaze_linux_core_gregset, regcache,
+ regnum, gregs);
+}
+
+static void
+microblaze_linux_supply_core_fpregset (const struct regset *regset,
+ struct regcache *regcache,
+ int regnum, const void *fpregs, size_t len)
+{
+ /* FIXME. */
+ microblaze_supply_fpregset (regcache, regnum, fpregs);
+}
+
+static void
+microblaze_linux_collect_core_fpregset (const struct regset *regset,
+ const struct regcache *regcache,
+ int regnum, void *fpregs, size_t len)
+{
+ /* FIXME. */
+ microblaze_collect_fpregset (regcache, regnum, fpregs);
+}
+
+static const struct regset microblaze_linux_gregset =
+{
+ NULL,
+ microblaze_linux_supply_core_gregset,
+ microblaze_linux_collect_core_gregset
+};
static void
microblaze_linux_init_abi (struct gdbarch_info info,
@@ -123,6 +191,9 @@ microblaze_linux_init_abi (struct gdbarc
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ tdep->gregset = µblaze_linux_gregset;
+ tdep->sizeof_gregset = 200;
+
linux_init_abi (info, gdbarch);
set_gdbarch_memory_remove_breakpoint (gdbarch,
@@ -135,6 +206,25 @@ microblaze_linux_init_abi (struct gdbarc
/* Trampolines. */
tramp_frame_prepend_unwinder (gdbarch,
µblaze_linux_sighandler_tramp_frame);
+
+ /* BFD target for core files. */
+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblaze");
+ else
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-microblazeel");
+
+
+ /* Shared library handling. */
+ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
+ set_gdbarch_skip_solib_resolver (gdbarch, glibc_skip_solib_resolver);
+
+ set_gdbarch_regset_from_core_section (gdbarch,
+ microblaze_regset_from_core_section);
+
+ /* Enable TLS support. */
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
+
}
/* -Wmissing-prototypes */
|