Wed Nov 29 03:35:16 2017 UTC ()
bring back all our foonbsd-{nat,tdep} files as foo-nbsd-{nat,tdep}. Account
for that in the config glue.


(christos)
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/alpha-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.h
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.h
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-tdep.c
diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/vax-nbsd-tdep.c
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/alpha/nbsd.mh
diff -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/config/arm/nbsdelf.mh
diff -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/config/i386/nbsd64.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/i386/nbsdelf.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/m68k/nbsdelf.mh
diff -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/config/mips/nbsd.mh
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/config/pa/nbsd.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/powerpc/nbsd.mh
diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/config/powerpc/ppc64-nbsd.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sh/nbsd.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sparc/nbsd64.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sparc/nbsdelf.mh
diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/vax/nbsdelf.mh

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/alpha-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/alpha-nbsd-tdep.c 2017/11/28 18:18:04 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/alpha-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/alpha. 1/* Target-dependent code for NetBSD/alpha.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,33 +18,39 @@ @@ -18,33 +18,39 @@
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "defs.h" 22#include "defs.h"
23#include "frame.h" 23#include "frame.h"
24#include "gdbcore.h" 24#include "gdbcore.h"
25#include "osabi.h" 25#include "osabi.h"
26#include "regcache.h" 26#include "regcache.h"
27#include "regset.h" 27#include "regset.h"
28#include "value.h" 28#include "value.h"
29 29
30#include "alpha-tdep.h" 30#include "alpha-tdep.h"
31#include "alpha-bsd-tdep.h" 31#include "alphabsd-tdep.h"
32#include "nbsd-tdep.h" 32#include "nbsd-tdep.h"
33#include "solib-svr4.h" 33#include "solib-svr4.h"
 34#include "trad-frame.h"
 35#include "frame-unwind.h"
 36#include "tramp-frame.h"
34#include "target.h" 37#include "target.h"
35 38
36/* Core file support. */ 39/* Core file support. */
37 40
 41/* Even though NetBSD/alpha used ELF since day one, it used the
 42 traditional a.out-style core dump format before NetBSD 1.6. */
 43
38/* Sizeof `struct reg' in <machine/reg.h>. */ 44/* Sizeof `struct reg' in <machine/reg.h>. */
39#define ALPHANBSD_SIZEOF_GREGS (32 * 8) 45#define ALPHANBSD_SIZEOF_GREGS (32 * 8)
40 46
41/* Sizeof `struct fpreg' in <machine/reg.h. */ 47/* Sizeof `struct fpreg' in <machine/reg.h. */
42#define ALPHANBSD_SIZEOF_FPREGS ((32 * 8) + 8) 48#define ALPHANBSD_SIZEOF_FPREGS ((32 * 8) + 8)
43 49
44/* Supply register REGNUM from the buffer specified by FPREGS and LEN 50/* Supply register REGNUM from the buffer specified by FPREGS and LEN
45 in the floating-point register set REGSET to register cache 51 in the floating-point register set REGSET to register cache
46 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ 52 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
47 53
48static void 54static void
49alphanbsd_supply_fpregset (const struct regset *regset, 55alphanbsd_supply_fpregset (const struct regset *regset,
50 struct regcache *regcache, 56 struct regcache *regcache,
@@ -158,51 +164,115 @@ static const struct regset alphanbsd_fpr @@ -158,51 +164,115 @@ static const struct regset alphanbsd_fpr
158void 164void
159alphanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, 165alphanbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
160 iterate_over_regset_sections_cb *cb, 166 iterate_over_regset_sections_cb *cb,
161 void *cb_data, 167 void *cb_data,
162 const struct regcache *regcache) 168 const struct regcache *regcache)
163{ 169{
164 cb (".reg", ALPHANBSD_SIZEOF_GREGS, &alphanbsd_gregset, NULL, cb_data); 170 cb (".reg", ALPHANBSD_SIZEOF_GREGS, &alphanbsd_gregset, NULL, cb_data);
165 cb (".reg2", ALPHANBSD_SIZEOF_FPREGS, &alphanbsd_fpregset, NULL, cb_data); 171 cb (".reg2", ALPHANBSD_SIZEOF_FPREGS, &alphanbsd_fpregset, NULL, cb_data);
166} 172}
167  173
168 174
169/* Signal trampolines. */ 175/* Signal trampolines. */
170 176
 177static void
 178alphanbsd_sigtramp_cache_init (const struct tramp_frame *,
 179 struct frame_info *,
 180 struct trad_frame_cache *,
 181 CORE_ADDR);
171/* Under NetBSD/alpha, signal handler invocations can be identified by the 182/* Under NetBSD/alpha, signal handler invocations can be identified by the
172 designated code sequence that is used to return from a signal handler. 183 designated code sequence that is used to return from a signal handler.
173 In particular, the return address of a signal handler points to the 184 In particular, the return address of a signal handler points to the
174 following code sequence: 185 following code sequences: */
 186static const struct tramp_frame alphanbsd_sigtramp_sc1 = {
 187 SIGTRAMP_FRAME,
 188 4,
 189 {
 190 { 0xa61e0000, 0xffffffff }, /* ldq a0, 0(sp) */
 191 { 0x23de0010, 0xffffffff }, /* lda sp, 16(sp) */
 192 { 0x201f0127, 0xffffffff }, /* lda v0, 295 */
 193 { 0x00000083, 0xffffffff }, /* call_pal callsys */
 194 { TRAMP_SENTINEL_INSN, -1 }
 195 },
 196 alphanbsd_sigtramp_cache_init
 197};
175 198
176 ldq a0, 0(sp) 199/* The siginfo signal trampoline for NetBSD/alpha introduced in 2.0 */
177 lda sp, 16(sp) 200static const struct tramp_frame alphanbsd_sigtramp_si2 =
178 lda v0, 295(zero) # __sigreturn14 201{
179 call_pal callsys 202 SIGTRAMP_FRAME,
180 203 4,
181 Each instruction has a unique encoding, so we simply attempt to match 204 {
182 the instruction the PC is pointing to with any of the above instructions. 205 { 0x221e0080, -1 }, /* lda a0,128(sp) */
183 If there is a hit, we know the offset to the start of the designated 206 { 0x201f0134, -1 }, /* lda v0,308 */
184 sequence and can then check whether we really are executing in the 207 { 0x00000083, -1 }, /* callsys */
185 signal trampoline. If not, -1 is returned, otherwise the offset from the 208 { 0x47e00410, -1 }, /* mov v0,a0 */
186 start of the return sequence is returned. */ 209 { 0x201f0001, -1 }, /* lda v0,1 */
187static const gdb_byte sigtramp_retcode[] = 210 { 0x00000083, -1 }, /* callsys */
188{ 211 { TRAMP_SENTINEL_INSN, -1 }
189 0x00, 0x00, 0x1e, 0xa6, /* ldq a0, 0(sp) */ 212 },
190 0x10, 0x00, 0xde, 0x23, /* lda sp, 16(sp) */ 213 alphanbsd_sigtramp_cache_init
191 0x27, 0x01, 0x1f, 0x20, /* lda v0, 295(zero) */ 
192 0x83, 0x00, 0x00, 0x00, /* call_pal callsys */ 
193}; 214};
194#define RETCODE_NWORDS 4 215/* The siginfo signal trampoline for NetBSD/alpha introduced in 4.0 */
195#define RETCODE_SIZE (RETCODE_NWORDS * 4) 216static const struct tramp_frame alphanbsd_sigtramp_si4 =
 217{
 218 SIGTRAMP_FRAME,
 219 4,
 220 {
 221 { 0x27ba0000, 0xffff0000 },
 222 { 0x23bd0000, 0xffff0000 }, /* ldgp gp,0(ra) */
 223 { 0x221e0080, -1 }, /* lda a0,128(sp) */
 224 { 0x201f0134, -1 }, /* lda v0,308 */
 225 { 0x00000083, -1 }, /* callsys */
 226 { 0x221fffff, -1 }, /* lda a0,-1 */
 227 { 0x201f0001, -1 }, /* lda v0,1 */
 228 { 0x00000083, -1 }, /* callsys */
 229 { TRAMP_SENTINEL_INSN, -1 }
 230 },
 231 alphanbsd_sigtramp_cache_init
 232};
 233
 234static void
 235alphanbsd_sigtramp_cache_init (const struct tramp_frame *self,
 236 struct frame_info *this_frame,
 237 struct trad_frame_cache *this_cache,
 238 CORE_ADDR func)
 239{
 240 struct gdbarch *gdbarch = get_frame_arch (this_frame);
 241 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 242 CORE_ADDR addr, sp;
 243 int i;
 244
 245 sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
 246
 247 if (self == &alphanbsd_sigtramp_sc1) {
 248 addr = sp;
 249 } else {
 250 addr = sp + 128 + 56;
 251 }
 252
 253 for (i = 0; i < 32; i++, addr += ALPHA_REGISTER_SIZE)
 254 {
 255 trad_frame_set_reg_addr (this_cache, i, addr);
 256 }
 257 trad_frame_set_reg_addr (this_cache, ALPHA_PC_REGNUM, addr);
 258
 259 /* Construct the frame ID using the function start. */
 260 trad_frame_set_id (this_cache, frame_id_build (sp, func));
 261}
 262
 263#ifdef notyet
 264#define RETCODE_NWORDS 4
 265#define RETCODE_SIZE (RETCODE_NWORDS * 4)
196 266
197static LONGEST 267static LONGEST
198alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc) 268alphanbsd_sigtramp_offset (struct gdbarch *gdbarch, CORE_ADDR pc)
199{ 269{
200 gdb_byte ret[RETCODE_SIZE], w[4]; 270 gdb_byte ret[RETCODE_SIZE], w[4];
201 LONGEST off; 271 LONGEST off;
202 int i; 272 int i;
203 273
204 if (target_read_memory (pc, w, 4) != 0) 274 if (target_read_memory (pc, w, 4) != 0)
205 return -1; 275 return -1;
206 276
207 for (i = 0; i < RETCODE_NWORDS; i++) 277 for (i = 0; i < RETCODE_NWORDS; i++)
208 { 278 {
@@ -232,59 +302,77 @@ alphanbsd_pc_in_sigtramp (struct gdbarch @@ -232,59 +302,77 @@ alphanbsd_pc_in_sigtramp (struct gdbarch
232 || alphanbsd_sigtramp_offset (gdbarch, pc) >= 0); 302 || alphanbsd_sigtramp_offset (gdbarch, pc) >= 0);
233} 303}
234 304
235static CORE_ADDR 305static CORE_ADDR
236alphanbsd_sigcontext_addr (struct frame_info *frame) 306alphanbsd_sigcontext_addr (struct frame_info *frame)
237{ 307{
238 /* FIXME: This is not correct for all versions of NetBSD/alpha. 308 /* FIXME: This is not correct for all versions of NetBSD/alpha.
239 We will probably need to disassemble the trampoline to figure 309 We will probably need to disassemble the trampoline to figure
240 out which trampoline frame type we have. */ 310 out which trampoline frame type we have. */
241 if (!get_next_frame (frame)) 311 if (!get_next_frame (frame))
242 return 0; 312 return 0;
243 return get_frame_base (get_next_frame (frame)); 313 return get_frame_base (get_next_frame (frame));
244} 314}
 315#endif
245  316
246 317
247static void 318static void
248alphanbsd_init_abi (struct gdbarch_info info, 319alphanbsd_init_abi (struct gdbarch_info info,
249 struct gdbarch *gdbarch) 320 struct gdbarch *gdbarch)
250{ 321{
251 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 322 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
252 323
253 /* Hook into the DWARF CFI frame unwinder. */ 324 /* Hook into the DWARF CFI frame unwinder. */
254 alpha_dwarf2_init_abi (info, gdbarch); 325 alpha_dwarf2_init_abi (info, gdbarch);
255 326
256 /* Hook into the MDEBUG frame unwinder. */ 327 /* Hook into the MDEBUG frame unwinder. */
257 alpha_mdebug_init_abi (info, gdbarch); 328 alpha_mdebug_init_abi (info, gdbarch);
258 329
259 /* NetBSD/alpha does not provide single step support via ptrace(2); we 330 /* NetBSD/alpha does not provide single step support via ptrace(2); we
260 must use software single-stepping. */ 331 must use software single-stepping. */
261 set_gdbarch_software_single_step (gdbarch, alpha_software_single_step); 332 set_gdbarch_software_single_step (gdbarch, alpha_software_single_step);
262 
263 /* NetBSD/alpha has SVR4-style shared libraries. */ 333 /* NetBSD/alpha has SVR4-style shared libraries. */
264 set_solib_svr4_fetch_link_map_offsets 334 set_solib_svr4_fetch_link_map_offsets
265 (gdbarch, svr4_lp64_fetch_link_map_offsets); 335 (gdbarch, svr4_lp64_fetch_link_map_offsets);
 336 set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
266 337
 338#ifdef notyet
267 tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset; 339 tdep->dynamic_sigtramp_offset = alphanbsd_sigtramp_offset;
268 tdep->pc_in_sigtramp = alphanbsd_pc_in_sigtramp; 340 tdep->pc_in_sigtramp = alphanbsd_pc_in_sigtramp;
269 tdep->sigcontext_addr = alphanbsd_sigcontext_addr; 341 tdep->sigcontext_addr = alphanbsd_sigcontext_addr;
 342#endif
270 343
271 tdep->jb_pc = 2; 344 tdep->jb_pc = 2;
272 tdep->jb_elt_size = 8; 345 tdep->jb_elt_size = 8;
273 346
 347 tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_sc1);
 348 tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_si2);
 349 tramp_frame_prepend_unwinder (gdbarch, &alphanbsd_sigtramp_si4);
 350
274 set_gdbarch_iterate_over_regset_sections 351 set_gdbarch_iterate_over_regset_sections
275 (gdbarch, alphanbsd_iterate_over_regset_sections); 352 (gdbarch, alphanbsd_iterate_over_regset_sections);
276} 353}
277  354
278 355
 356static enum gdb_osabi
 357alphanbsd_core_osabi_sniffer (bfd *abfd)
 358{
 359 if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
 360 return GDB_OSABI_NETBSD;
 361
 362 return GDB_OSABI_UNKNOWN;
 363}
 364
 365
279/* Provide a prototype to silence -Wmissing-prototypes. */ 366/* Provide a prototype to silence -Wmissing-prototypes. */
280void _initialize_alphanbsd_tdep (void); 367void _initialize_alphanbsd_tdep (void);
281 368
282void 369void
283_initialize_alphanbsd_tdep (void) 370_initialize_alphanbsd_tdep (void)
284{ 371{
285 /* Even though NetBSD/alpha used ELF since day one, it used the 372 /* BFD doesn't set a flavour for NetBSD style a.out core files. */
286 traditional a.out-style core dump format before NetBSD 1.6, but 373 gdbarch_register_osabi_sniffer (bfd_arch_alpha, bfd_target_unknown_flavour,
287 we don't support those. */ 374 alphanbsd_core_osabi_sniffer);
 375
288 gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD, 376 gdbarch_register_osabi (bfd_arch_alpha, 0, GDB_OSABI_NETBSD,
289 alphanbsd_init_abi); 377 alphanbsd_init_abi);
290} 378}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/amd64-nbsd-nat.c 2017/11/28 18:18:06 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/amd64-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,38 +1,55 @@ @@ -1,38 +1,55 @@
1/* Native-dependent code for NetBSD/amd64. 1/* Native-dependent code for NetBSD/amd64.
2 2
3 Copyright (C) 2003-2017 Free Software Foundation, Inc. 3 Copyright (C) 2003-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "target.h" 21#include "target.h"
22 22
23#include "nbsd-nat.h" 23#include "nbsd-nat.h"
24#include "amd64-tdep.h" 24#include "amd64-tdep.h"
25#include "amd64-nat.h" 25#include "amd64-nat.h"
 26#include "regcache.h"
 27#include "gdbcore.h"
 28#include "bsd-kvm.h"
 29
 30#include <machine/frame.h>
 31#include <machine/pcb.h>
 32#include <machine/reg.h>
 33
 34#ifndef HAVE_GREGSET_T
 35typedef struct reg gregset_t;
 36#endif
 37
 38#ifndef HAVE_FPREGSET_T
 39typedef struct fpreg fpregset_t;
 40#endif
 41
 42#include "gregset.h"
26 43
27/* Mapping between the general-purpose registers in NetBSD/amd64 44/* Mapping between the general-purpose registers in NetBSD/amd64
28 `struct reg' format and GDB's register cache layout for 45 `struct reg' format and GDB's register cache layout for
29 NetBSD/i386. 46 NetBSD/i386.
30 47
31 Note that most (if not all) NetBSD/amd64 registers are 64-bit, 48 Note that most (if not all) NetBSD/amd64 registers are 64-bit,
32 while the NetBSD/i386 registers are all 32-bit, but since we're 49 while the NetBSD/i386 registers are all 32-bit, but since we're
33 little-endian we get away with that. */ 50 little-endian we get away with that. */
34 51
35/* From <machine/reg.h>. */ 52/* From <machine/reg.h>. */
36static int amd64nbsd32_r_reg_offset[] = 53static int amd64nbsd32_r_reg_offset[] =
37{ 54{
38 14 * 8, /* %eax */ 55 14 * 8, /* %eax */
@@ -44,30 +61,123 @@ static int amd64nbsd32_r_reg_offset[] = @@ -44,30 +61,123 @@ static int amd64nbsd32_r_reg_offset[] =
44 1 * 8, /* %esi */ 61 1 * 8, /* %esi */
45 0 * 8, /* %edi */ 62 0 * 8, /* %edi */
46 21 * 8, /* %eip */ 63 21 * 8, /* %eip */
47 23 * 8, /* %eflags */ 64 23 * 8, /* %eflags */
48 22 * 8, /* %cs */ 65 22 * 8, /* %cs */
49 25 * 8, /* %ss */ 66 25 * 8, /* %ss */
50 18 * 8, /* %ds */ 67 18 * 8, /* %ds */
51 17 * 8, /* %es */ 68 17 * 8, /* %es */
52 16 * 8, /* %fs */ 69 16 * 8, /* %fs */
53 15 * 8 /* %gs */ 70 15 * 8 /* %gs */
54}; 71};
55  72
56 73
 74static int
 75amd64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 76{
 77 struct switchframe sf;
 78 int regnum;
 79 long zero = 0;
 80
 81 /* The following is true for NetBSD/amd64:
 82
 83 The pcb contains the stack pointer at the point of the context
 84 switch in cpu_switchto(). At that point we have a stack frame as
 85 described by `struct switchframe', which for NetBSD/amd64 has the
 86 following layout:
 87
 88 interrupt level
 89 %r15
 90 %r14
 91 %r13
 92 %r12
 93 %rbx
 94 return address
 95
 96 Together with %rsp in the pcb, this accounts for all callee-saved
 97 registers specified by the psABI. From this information we
 98 reconstruct the register state as it would look when we just
 99 returned from cpu_switchto().
 100
 101 For kernel core dumps, dumpsys() builds a fake switchframe for us. */
 102
 103 /* The stack pointer shouldn't be zero. */
 104 if (pcb->pcb_rsp == 0)
 105 return 0;
 106
 107 /* Read the stack frame, and check its validity. */
 108 read_memory (pcb->pcb_rsp, (gdb_byte *) &sf, sizeof sf);
 109 pcb->pcb_rsp += sizeof (struct switchframe);
 110 regcache_raw_supply (regcache, 12, &sf.sf_r12);
 111 regcache_raw_supply (regcache, 13, &sf.sf_r13);
 112 regcache_raw_supply (regcache, 14, &sf.sf_r14);
 113 regcache_raw_supply (regcache, 15, &sf.sf_r15);
 114 regcache_raw_supply (regcache, AMD64_RBX_REGNUM, &sf.sf_rbx);
 115 regcache_raw_supply (regcache, AMD64_RIP_REGNUM, &sf.sf_rip);
 116
 117 regcache_raw_supply (regcache, AMD64_RSP_REGNUM, &pcb->pcb_rsp);
 118 regcache_raw_supply (regcache, AMD64_RBP_REGNUM, &pcb->pcb_rbp);
 119 regcache_raw_supply (regcache, AMD64_FS_REGNUM, &pcb->pcb_fs);
 120 regcache_raw_supply (regcache, AMD64_GS_REGNUM, &pcb->pcb_gs);
 121
 122 return 1;
 123}
 124
 125void
 126supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
 127{
 128 amd64_supply_native_gregset (regcache, gregsetp, -1);
 129}
 130
 131/* Fill register REGNUM (if it is a general-purpose register) in
 132 *GREGSETP with the value in GDB's register cache. If REGNUM is -1,
 133 do this for all registers. */
 134
 135void
 136fill_gregset (const struct regcache *regcache,
 137 gregset_t *gregsetp, int regnum)
 138{
 139 amd64_collect_native_gregset (regcache, gregsetp, regnum);
 140}
 141
 142/* Transfering floating-point registers between GDB, inferiors and cores. */
 143
 144/* Fill GDB's register cache with the floating-point and SSE register
 145 values in *FPREGSETP. */
 146
 147void
 148supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 149{
 150 amd64_supply_fxsave (regcache, -1, fpregsetp);
 151}
 152
 153/* Fill register REGNUM (if it is a floating-point or SSE register) in
 154 *FPREGSETP with the value in GDB's register cache. If REGNUM is
 155 -1, do this for all registers. */
 156
 157void
 158fill_fpregset (const struct regcache *regcache,
 159 fpregset_t *fpregsetp, int regnum)
 160{
 161 amd64_collect_fxsave (regcache, regnum, fpregsetp);
 162}
 163
57/* Provide a prototype to silence -Wmissing-prototypes. */ 164/* Provide a prototype to silence -Wmissing-prototypes. */
58void _initialize_amd64nbsd_nat (void); 165void _initialize_amd64nbsd_nat (void);
59 166
60void 167void
61_initialize_amd64nbsd_nat (void) 168_initialize_amd64nbsd_nat (void)
62{ 169{
63 struct target_ops *t; 170 struct target_ops *t;
64 171
65 amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset; 172 amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
66 amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset); 173 amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
67 amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset; 174 amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;
68 175
69 /* Add some extra features to the common *BSD/amd64 target. */ 176 /* Add some extra features to the common *BSD/amd64 target. */
70 t = amd64bsd_target (); 177 t = amd64bsd_target ();
71 t->to_pid_to_exec_file = nbsd_pid_to_exec_file; 178 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
72 add_target (t); 179 add_target (t);
 180
 181 /* Support debugging kernel virtual memory images. */
 182 bsd_kvm_add_target (amd64nbsd_supply_pcb);
73} 183}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c 2017/11/28 18:18:24 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,42 +1,44 @@ @@ -1,42 +1,44 @@
1/* Target-dependent code for NetBSD/amd64. 1/* Target-dependent code for NetBSD/amd64.
2 2
3 Copyright (C) 2003-2017 Free Software Foundation, Inc. 3 Copyright (C) 2003-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "arch-utils.h" 21#include "arch-utils.h"
22#include "frame.h" 22#include "frame.h"
23#include "gdbcore.h" 23#include "gdbcore.h"
24#include "osabi.h" 24#include "osabi.h"
25#include "symtab.h" 25#include "symtab.h"
26 26
27#include "amd64-tdep.h" 27#include "amd64-tdep.h"
28#include "nbsd-tdep.h" 28#include "nbsd-tdep.h"
29#include "solib-svr4.h" 29#include "solib-svr4.h"
 30#include "trad-frame.h"
 31#include "frame-unwind.h"
30 32
31/* Support for signal handlers. */ 33/* Support for signal handlers. */
32 34
33/* Return whether THIS_FRAME corresponds to a NetBSD sigtramp 35/* Return whether THIS_FRAME corresponds to a NetBSD sigtramp
34 routine. */ 36 routine. */
35 37
36static int 38static int
37amd64nbsd_sigtramp_p (struct frame_info *this_frame) 39amd64nbsd_sigtramp_p (struct frame_info *this_frame)
38{ 40{
39 CORE_ADDR pc = get_frame_pc (this_frame); 41 CORE_ADDR pc = get_frame_pc (this_frame);
40 const char *name; 42 const char *name;
41 43
42 find_pc_partial_function (pc, &name, NULL, NULL); 44 find_pc_partial_function (pc, &name, NULL, NULL);
@@ -83,49 +85,223 @@ int amd64nbsd_r_reg_offset[] = @@ -83,49 +85,223 @@ int amd64nbsd_r_reg_offset[] =
83 9 * 8, 85 9 * 8,
84 10 * 8, 86 10 * 8,
85 11 * 8, /* ... %r15 */ 87 11 * 8, /* ... %r15 */
86 21 * 8, /* %rip */ 88 21 * 8, /* %rip */
87 23 * 8, /* %eflags */ 89 23 * 8, /* %eflags */
88 22 * 8, /* %cs */ 90 22 * 8, /* %cs */
89 25 * 8, /* %ss */ 91 25 * 8, /* %ss */
90 18 * 8, /* %ds */ 92 18 * 8, /* %ds */
91 17 * 8, /* %es */ 93 17 * 8, /* %es */
92 16 * 8, /* %fs */ 94 16 * 8, /* %fs */
93 15 * 8 /* %gs */ 95 15 * 8 /* %gs */
94}; 96};
95 97
 98/* Kernel debugging support */
 99static const int amd64nbsd_tf_reg_offset[] =
 100{
 101 18 * 8, /* %rax */
 102 17 * 8, /* %rbx */
 103 10 * 8, /* %rcx */
 104 2 * 8, /* %rdx */
 105 1 * 8, /* %rsi */
 106 0 * 8, /* %rdi */
 107 16 * 8, /* %rbp */
 108 28 * 8, /* %rsp */
 109 4 * 8, /* %r8 .. */
 110 5 * 8,
 111 3 * 8,
 112 11 * 8,
 113 12 * 8,
 114 13 * 8,
 115 14 * 8,
 116 15 * 8, /* ... %r15 */
 117 25 * 8, /* %rip */
 118 27 * 8, /* %eflags */
 119 26 * 8, /* %cs */
 120 29 * 8, /* %ss */
 121 22 * 8, /* %ds */
 122 21 * 8, /* %es */
 123 20 * 8, /* %fs */
 124 19 * 8, /* %gs */
 125};
 126
 127static struct trad_frame_cache *
 128amd64nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
 129{
 130 struct trad_frame_cache *cache;
 131 CORE_ADDR func, sp, addr;
 132 ULONGEST cs = 0, rip = 0;
 133 const char *name;
 134 int i;
 135 struct gdbarch *gdbarch = get_frame_arch (this_frame);
 136 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 137
 138 if (*this_cache)
 139 return (struct trad_frame_cache *)*this_cache;
 140
 141 cache = trad_frame_cache_zalloc (this_frame);
 142 *this_cache = cache;
 143
 144 func = get_frame_func (this_frame);
 145 sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
 146
 147 find_pc_partial_function (func, &name, NULL, NULL);
 148
 149 /* There is an extra 'call' in the interrupt sequence - ignore the extra
 150 * return address */
 151 if (name && strncmp (name, "Xintr", 5) == 0)
 152 addr = sp + 8; /* It's an interrupt frame. */
 153 else
 154 addr = sp;
 155
 156 for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
 157 if (amd64nbsd_tf_reg_offset[i] != -1)
 158 trad_frame_set_reg_addr (cache, i, addr + amd64nbsd_tf_reg_offset[i]);
 159
 160 /* Read %cs and %rip when we have the addresses to hand */
 161 cs = read_memory_unsigned_integer (addr
 162 + amd64nbsd_tf_reg_offset[AMD64_CS_REGNUM], 8, byte_order);
 163 rip = read_memory_unsigned_integer (addr
 164 + amd64nbsd_tf_reg_offset[AMD64_RIP_REGNUM], 8, byte_order);
 165
 166 /* The trap frame layout was changed lf the %rip value is less than 2^16 it
 167 * is almost certainly the %ss of the old format. */
 168 if (rip < (1 << 16))
 169 {
 170
 171 for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
 172 {
 173
 174 if (amd64nbsd_tf_reg_offset[i] == -1)
 175 continue;
 176
 177 trad_frame_set_reg_addr (cache, i, addr + amd64nbsd_r_reg_offset[i]);
 178
 179 /* Read %cs when we have the address to hand */
 180 if (i == AMD64_CS_REGNUM)
 181 cs = read_memory_unsigned_integer (addr + amd64nbsd_r_reg_offset[i],
 182 8, byte_order);
 183 }
 184 }
 185
 186 if ((cs & I386_SEL_RPL) == I386_SEL_UPL ||
 187 (name && strncmp(name, "Xsoft", 5) == 0))
 188 {
 189 /* Trap from user space or soft interrupt; terminate backtrace. */
 190 trad_frame_set_id (cache, outer_frame_id);
 191 }
 192 else
 193 {
 194 /* Construct the frame ID using the function start. */
 195 trad_frame_set_id (cache, frame_id_build (sp + 16, func));
 196 }
 197
 198 return cache;
 199}
 200
 201static void
 202amd64nbsd_trapframe_this_id (struct frame_info *this_frame,
 203 void **this_cache,
 204 struct frame_id *this_id)
 205{
 206 struct trad_frame_cache *cache =
 207 amd64nbsd_trapframe_cache (this_frame, this_cache);
 208
 209 trad_frame_get_id (cache, this_id);
 210}
 211
 212static struct value *
 213amd64nbsd_trapframe_prev_register (struct frame_info *this_frame,
 214 void **this_cache, int regnum)
 215{
 216 struct trad_frame_cache *cache =
 217 amd64nbsd_trapframe_cache (this_frame, this_cache);
 218
 219 return trad_frame_get_register (cache, this_frame, regnum);
 220}
 221
 222static int
 223amd64nbsd_trapframe_sniffer (const struct frame_unwind *self,
 224 struct frame_info *this_frame,
 225 void **this_prologue_cache)
 226{
 227 ULONGEST cs = 0;
 228 const char *name;
 229 volatile struct gdb_exception ex;
 230
 231 TRY
 232 {
 233 cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
 234 }
 235 CATCH (ex, RETURN_MASK_ERROR)
 236 {
 237 if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
 238 throw_exception (ex);
 239 }
 240 END_CATCH
 241 if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
 242 return 0;
 243
 244 find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
 245 return (name && ((strcmp (name, "alltraps") == 0)
 246 || (strcmp (name, "calltrap") == 0)
 247 || (strncmp (name, "Xtrap", 5) == 0)
 248 || (strcmp (name, "osyscall1") == 0)
 249 || (strcmp (name, "Xsyscall") == 0)
 250 || (strncmp (name, "Xintr", 5) == 0)
 251 || (strncmp (name, "Xresume", 7) == 0)
 252 || (strncmp (name, "Xstray", 6) == 0)
 253 || (strncmp (name, "Xrecurse", 8) == 0)
 254 || (strncmp (name, "Xsoft", 5) == 0)
 255 || (strcmp (name, "Xdoreti") == 0)));
 256}
 257
 258static const struct frame_unwind amd64nbsd_trapframe_unwind = {
 259 /* FIXME: kettenis/20051219: This really is more like an interrupt
 260 frame, but SIGTRAMP_FRAME would print <signal handler called>,
 261 which really is not what we want here. */
 262 NORMAL_FRAME,
 263 default_frame_unwind_stop_reason,
 264 amd64nbsd_trapframe_this_id,
 265 amd64nbsd_trapframe_prev_register,
 266 NULL,
 267 amd64nbsd_trapframe_sniffer
 268};
 269
96static void 270static void
97amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 271amd64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
98{ 272{
99 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 273 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
100 274
101 /* Initialize general-purpose register set details first. */ 275 /* Initialize general-purpose register set details first. */
102 tdep->gregset_reg_offset = amd64nbsd_r_reg_offset; 276 tdep->gregset_reg_offset = amd64nbsd_r_reg_offset;
103 tdep->gregset_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset); 277 tdep->gregset_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
104 tdep->sizeof_gregset = 26 * 8; 278 tdep->sizeof_gregset = 26 * 8;
105 279
106 amd64_init_abi (info, gdbarch); 280 amd64_init_abi (info, gdbarch);
107 281
108 tdep->jb_pc_offset = 7 * 8; 282 tdep->jb_pc_offset = 7 * 8;
109 283
110 /* NetBSD has its own convention for signal trampolines. */ 284 /* NetBSD has its own convention for signal trampolines. */
111 tdep->sigtramp_p = amd64nbsd_sigtramp_p; 285 tdep->sigtramp_p = amd64nbsd_sigtramp_p;
112 tdep->sigcontext_addr = amd64nbsd_mcontext_addr; 286 tdep->sigcontext_addr = amd64nbsd_mcontext_addr;
113 tdep->sc_reg_offset = amd64nbsd_r_reg_offset; 287 tdep->sc_reg_offset = amd64nbsd_r_reg_offset;
114 tdep->sc_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset); 288 tdep->sc_num_regs = ARRAY_SIZE (amd64nbsd_r_reg_offset);
115 289
116 /* NetBSD uses SVR4-style shared libraries. */ 290 /* NetBSD uses SVR4-style shared libraries. */
117 set_solib_svr4_fetch_link_map_offsets 291 set_solib_svr4_fetch_link_map_offsets
118 (gdbarch, svr4_lp64_fetch_link_map_offsets); 292 (gdbarch, svr4_lp64_fetch_link_map_offsets);
 293 /* Unwind kernel trap frames correctly. */
 294 frame_unwind_prepend_unwinder (gdbarch, &amd64nbsd_trapframe_unwind);
119} 295}
120  296
121 297
122/* Provide a prototype to silence -Wmissing-prototypes. */ 298/* Provide a prototype to silence -Wmissing-prototypes. */
123void _initialize_amd64nbsd_tdep (void); 299void _initialize_amd64nbsd_tdep (void);
124 300
125void 301void
126_initialize_amd64nbsd_tdep (void) 302_initialize_amd64nbsd_tdep (void)
127{ 303{
128 /* The NetBSD/amd64 native dependent code makes this assumption. */ 304 /* The NetBSD/amd64 native dependent code makes this assumption. */
129 gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS); 305 gdb_assert (ARRAY_SIZE (amd64nbsd_r_reg_offset) == AMD64_NUM_GREGS);
130 306
131 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, 307 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c 2017/11/28 18:18:23 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,47 +1,113 @@ @@ -1,47 +1,113 @@
1/* Native-dependent code for BSD Unix running on ARM's, for GDB. 1/* Native-dependent code for BSD Unix running on ARM's, for GDB.
2 2
3 Copyright (C) 1988-2017 Free Software Foundation, Inc. 3 Copyright (C) 1988-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
 20#ifndef _KERNTYPES
 21#define _KERNTYPES
 22#endif
20#include "defs.h" 23#include "defs.h"
21#include "gdbcore.h" 24#include "gdbcore.h"
22#include "inferior.h" 25#include "inferior.h"
23#include "regcache.h" 26#include "regcache.h"
24#include "target.h" 27#include "target.h"
 28
 29#include "nbsd-nat.h"
25#include <sys/types.h> 30#include <sys/types.h>
26#include <sys/ptrace.h> 31#include <sys/ptrace.h>
27#include <machine/reg.h> 32#include <machine/reg.h>
28#include <machine/frame.h> 33#include <machine/frame.h>
 34#include <arm/arm32/frame.h>
 35
 36/* Support for debugging kernel virtual memory images. */
 37#include <machine/pcb.h>
29 38
30#include "arm-tdep.h" 39#include "arm-tdep.h"
31#include "inf-ptrace.h" 40#include "inf-ptrace.h"
 41#include "bsd-kvm.h"
 42
 43#ifndef HAVE_GREGSET_T
 44typedef struct reg gregset_t;
 45#endif
 46
 47#ifndef HAVE_FPREGSET_T
 48typedef struct fpreg fpregset_t;
 49#endif
 50
 51#include "gregset.h"
32 52
33extern int arm_apcs_32; 53extern int arm_apcs_32;
34 54
 55static int
 56armnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 57{
 58 struct switchframe sf;
 59
 60 /* The following is true for NetBSD/arm32 in 5.0 and after:
 61
 62 The pcb contains r8-r13 (sp) at the point of context switch in
 63 cpu_switchto() or call of dumpsys(). At that point we have a
 64 stack frame as described by `struct switchframe', which for
 65 NetBSD/arm32 has the following layout:
 66
 67 r4 ascending.
 68 r5 |
 69 r6 |
 70 r7 \|/
 71 old sp
 72 pc
 73
 74 we reconstruct the register state as it would look when we just
 75 returned from cpu_switchto() or dumpsys(). */
 76
 77 if (!arm_apcs_32)
 78 return 0;
 79
 80 /* The stack pointer shouldn't be zero. */
 81 if (pcb->pcb_un.un_32.pcb32_sp == 0)
 82 return 0;
 83
 84 read_memory (pcb->pcb_un.un_32.pcb32_sp, (gdb_byte *) &sf, sizeof sf);
 85
 86 regcache_raw_supply (regcache, ARM_PC_REGNUM, &sf.sf_pc);
 87 regcache_raw_supply (regcache, ARM_SP_REGNUM, &pcb->pcb_un.un_32.pcb32_sp);
 88 regcache_raw_supply (regcache, 12, &pcb->pcb_un.un_32.pcb32_r12);
 89 regcache_raw_supply (regcache, 11, &pcb->pcb_un.un_32.pcb32_r11);
 90 regcache_raw_supply (regcache, 10, &pcb->pcb_un.un_32.pcb32_r10);
 91 regcache_raw_supply (regcache, 9, &pcb->pcb_un.un_32.pcb32_r9);
 92 regcache_raw_supply (regcache, 8, &pcb->pcb_un.un_32.pcb32_r8);
 93 regcache_raw_supply (regcache, 7, &sf.sf_r7);
 94 regcache_raw_supply (regcache, 6, &sf.sf_r6);
 95 regcache_raw_supply (regcache, 5, &sf.sf_r5);
 96 regcache_raw_supply (regcache, 4, &sf.sf_r4);
 97
 98 return 1;
 99}
 100
35static void 101static void
36arm_supply_gregset (struct regcache *regcache, struct reg *gregset) 102arm_supply_gregset (struct regcache *regcache, struct reg *gregset)
37{ 103{
38 int regno; 104 int regno;
39 CORE_ADDR r_pc; 105 CORE_ADDR r_pc;
40 106
41 /* Integer registers. */ 107 /* Integer registers. */
42 for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++) 108 for (regno = ARM_A1_REGNUM; regno < ARM_SP_REGNUM; regno++)
43 regcache_raw_supply (regcache, regno, (char *) &gregset->r[regno]); 109 regcache_raw_supply (regcache, regno, (char *) &gregset->r[regno]);
44 110
45 regcache_raw_supply (regcache, ARM_SP_REGNUM, 111 regcache_raw_supply (regcache, ARM_SP_REGNUM,
46 (char *) &gregset->r_sp); 112 (char *) &gregset->r_sp);
47 regcache_raw_supply (regcache, ARM_LR_REGNUM, 113 regcache_raw_supply (regcache, ARM_LR_REGNUM,
@@ -49,46 +115,107 @@ arm_supply_gregset (struct regcache *reg @@ -49,46 +115,107 @@ arm_supply_gregset (struct regcache *reg
49 /* This is ok: we're running native... */ 115 /* This is ok: we're running native... */
50 r_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), gregset->r_pc); 116 r_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), gregset->r_pc);
51 regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc); 117 regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc);
52 118
53 if (arm_apcs_32) 119 if (arm_apcs_32)
54 regcache_raw_supply (regcache, ARM_PS_REGNUM, 120 regcache_raw_supply (regcache, ARM_PS_REGNUM,
55 (char *) &gregset->r_cpsr); 121 (char *) &gregset->r_cpsr);
56 else 122 else
57 regcache_raw_supply (regcache, ARM_PS_REGNUM, 123 regcache_raw_supply (regcache, ARM_PS_REGNUM,
58 (char *) &gregset->r_pc); 124 (char *) &gregset->r_pc);
59} 125}
60 126
61static void 127static void
62arm_supply_fparegset (struct regcache *regcache, struct fpreg *fparegset) 128arm_supply_vfpregset (struct regcache *regcache, struct fpreg *vfpregset)
63{ 129{
64 int regno; 130 int regno;
65 131
66 for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) 132 for (regno = 0; regno < 16; regno++)
67 regcache_raw_supply (regcache, regno, 133 regcache_raw_supply (regcache, regno + ARM_D0_REGNUM,
68 (char *) &fparegset->fpr[regno - ARM_F0_REGNUM]); 134 (char *) vfpregset->fpr_vfp.vfp_regs + 8*regno);
 135
 136 regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
 137 (char *) &vfpregset->fpr_vfp.vfp_fpscr);
 138}
 139
 140void
 141fill_gregset (const struct regcache *regcache, gregset_t *gregsetp, int regno)
 142{
 143 if (-1 == regno)
 144 {
 145 int regnum;
 146 for (regnum = ARM_A1_REGNUM; regnum < ARM_SP_REGNUM; regnum++)
 147 regcache_raw_collect (regcache, regnum, (char *) &gregsetp->r[regnum]);
 148 }
 149 else if (regno >= ARM_A1_REGNUM && regno < ARM_SP_REGNUM)
 150 regcache_raw_collect (regcache, regno, (char *) &gregsetp->r[regno]);
 151
 152 if (ARM_SP_REGNUM == regno || -1 == regno)
 153 regcache_raw_collect (regcache, ARM_SP_REGNUM, (char *) &gregsetp->r_sp);
 154
 155 if (ARM_LR_REGNUM == regno || -1 == regno)
 156 regcache_raw_collect (regcache, ARM_LR_REGNUM, (char *) &gregsetp->r_lr);
 157
 158 if (ARM_PC_REGNUM == regno || -1 == regno)
 159 regcache_raw_collect (regcache, ARM_PC_REGNUM, (char *) &gregsetp->r_pc);
 160
 161 if (ARM_PS_REGNUM == regno || -1 == regno)
 162 {
 163 if (arm_apcs_32)
 164 regcache_raw_collect (regcache, ARM_PS_REGNUM, (char *) &gregsetp->r_cpsr);
 165 else
 166 regcache_raw_collect (regcache, ARM_PS_REGNUM, (char *) &gregsetp->r_pc);
 167 }
 168 }
 169
 170void
 171fill_fpregset (const struct regcache *regcache, fpregset_t *vfpregsetp, int regno)
 172{
 173 if (-1 == regno)
 174 {
 175 int regnum;
 176 for (regnum = 0; regnum <= 15; regnum++)
 177 regcache_raw_collect(regcache, regnum + ARM_D0_REGNUM,
 178 (char *) vfpregsetp->fpr_vfp.vfp_regs + 8*regnum);
 179 }
 180 else if (regno >= ARM_D0_REGNUM && regno <= ARM_D0_REGNUM + 15)
 181 regcache_raw_collect(regcache, regno,
 182 (char *) vfpregsetp->fpr_vfp.vfp_regs + 8 * (regno - ARM_D0_REGNUM));
 183
 184 if (ARM_FPSCR_REGNUM == regno || -1 == regno)
 185 regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
 186 (char *) &vfpregsetp->fpr_vfp.vfp_fpscr);
 187}
 188
 189void
 190supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
 191{
 192 arm_supply_gregset (regcache, (struct reg *)gregsetp);
 193}
69 194
70 regcache_raw_supply (regcache, ARM_FPS_REGNUM, 195void
71 (char *) &fparegset->fpr_fpsr); 196supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 197{
 198 arm_supply_vfpregset (regcache, (struct fpreg *)fpregsetp);
72} 199}
73 200
74static void 201static void
75fetch_register (struct regcache *regcache, int regno) 202fetch_register (struct regcache *regcache, int regno)
76{ 203{
77 struct reg inferior_registers; 204 struct reg inferior_registers;
78 int ret; 205 int ret;
79 206
80 ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 207 ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
81 (PTRACE_TYPE_ARG3) &inferior_registers, 0); 208 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
82 209
83 if (ret < 0) 210 if (ret < 0)
84 { 211 {
85 warning (_("unable to fetch general register")); 212 warning (_("unable to fetch general register"));
86 return; 213 return;
87 } 214 }
88 215
89 switch (regno) 216 switch (regno)
90 { 217 {
91 case ARM_SP_REGNUM: 218 case ARM_SP_REGNUM:
92 regcache_raw_supply (regcache, ARM_SP_REGNUM, 219 regcache_raw_supply (regcache, ARM_SP_REGNUM,
93 (char *) &inferior_registers.r_sp); 220 (char *) &inferior_registers.r_sp);
94 break; 221 break;
@@ -120,114 +247,114 @@ fetch_register (struct regcache *regcach @@ -120,114 +247,114 @@ fetch_register (struct regcache *regcach
120 regcache_raw_supply (regcache, regno, 247 regcache_raw_supply (regcache, regno,
121 (char *) &inferior_registers.r[regno]); 248 (char *) &inferior_registers.r[regno]);
122 break; 249 break;
123 } 250 }
124} 251}
125 252
126static void 253static void
127fetch_regs (struct regcache *regcache) 254fetch_regs (struct regcache *regcache)
128{ 255{
129 struct reg inferior_registers; 256 struct reg inferior_registers;
130 int ret; 257 int ret;
131 int regno; 258 int regno;
132 259
133 ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 260 ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
134 (PTRACE_TYPE_ARG3) &inferior_registers, 0); 261 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
135 262
136 if (ret < 0) 263 if (ret < 0)
137 { 264 {
138 warning (_("unable to fetch general registers")); 265 warning (_("unable to fetch general registers"));
139 return; 266 return;
140 } 267 }
141 268
142 arm_supply_gregset (regcache, &inferior_registers); 269 arm_supply_gregset (regcache, &inferior_registers);
143} 270}
144 271
145static void 272static void
146fetch_fp_register (struct regcache *regcache, int regno) 273fetch_fp_register (struct regcache *regcache, int regno)
147{ 274{
148 struct fpreg inferior_fp_registers; 275 struct fpreg inferior_fp_registers;
149 int ret; 276 int ret;
150 277
151 ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), 278 ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
152 (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); 279 (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
153 280
154 if (ret < 0) 281 if (ret < 0)
155 { 282 {
156 warning (_("unable to fetch floating-point register")); 283 warning (_("unable to fetch floating-point register"));
157 return; 284 return;
158 } 285 }
159 286
160 switch (regno) 287 switch (regno)
161 { 288 {
162 case ARM_FPS_REGNUM: 289 case ARM_FPSCR_REGNUM:
163 regcache_raw_supply (regcache, ARM_FPS_REGNUM, 290 regcache_raw_supply (regcache, ARM_FPSCR_REGNUM,
164 (char *) &inferior_fp_registers.fpr_fpsr); 291 (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
165 break; 292 break;
166 293
167 default: 294 default:
168 regcache_raw_supply (regcache, regno, 295 regcache_raw_supply (regcache, regno,
169 (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); 296 (char *) inferior_fp_registers.fpr_vfp.vfp_regs + 8 * (regno - ARM_D0_REGNUM));
170 break; 297 break;
171 } 298 }
172} 299}
173 300
174static void 301static void
175fetch_fp_regs (struct regcache *regcache) 302fetch_fp_regs (struct regcache *regcache)
176{ 303{
177 struct fpreg inferior_fp_registers; 304 struct fpreg inferior_fp_registers;
178 int ret; 305 int ret;
179 int regno; 306 int regno;
180 307
181 ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), 308 ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
182 (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); 309 (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
183 310
184 if (ret < 0) 311 if (ret < 0)
185 { 312 {
186 warning (_("unable to fetch general registers")); 313 warning (_("unable to fetch floating-point registers"));
187 return; 314 return;
188 } 315 }
189 316
190 arm_supply_fparegset (regcache, &inferior_fp_registers); 317 arm_supply_vfpregset (regcache, &inferior_fp_registers);
191} 318}
192 319
193static void 320static void
194armnbsd_fetch_registers (struct target_ops *ops, 321armnbsd_fetch_registers (struct target_ops *ops,
195 struct regcache *regcache, int regno) 322 struct regcache *regcache, int regno)
196{ 323{
197 if (regno >= 0) 324 if (regno >= 0)
198 { 325 {
199 if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM) 326 if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
200 fetch_register (regcache, regno); 
201 else 
202 fetch_fp_register (regcache, regno); 327 fetch_fp_register (regcache, regno);
 328 else
 329 fetch_register (regcache, regno);
203 } 330 }
204 else 331 else
205 { 332 {
206 fetch_regs (regcache); 333 fetch_regs (regcache);
207 fetch_fp_regs (regcache); 334 fetch_fp_regs (regcache);
208 } 335 }
209} 336}
210 337
211 338
212static void 339static void
213store_register (const struct regcache *regcache, int regno) 340store_register (const struct regcache *regcache, int regno)
214{ 341{
215 struct gdbarch *gdbarch = get_regcache_arch (regcache); 342 struct gdbarch *gdbarch = get_regcache_arch (regcache);
216 struct reg inferior_registers; 343 struct reg inferior_registers;
217 int ret; 344 int ret;
218 345
219 ret = ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 346 ret = ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
220 (PTRACE_TYPE_ARG3) &inferior_registers, 0); 347 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
221 348
222 if (ret < 0) 349 if (ret < 0)
223 { 350 {
224 warning (_("unable to fetch general registers")); 351 warning (_("unable to fetch general registers"));
225 return; 352 return;
226 } 353 }
227 354
228 switch (regno) 355 switch (regno)
229 { 356 {
230 case ARM_SP_REGNUM: 357 case ARM_SP_REGNUM:
231 regcache_raw_collect (regcache, ARM_SP_REGNUM, 358 regcache_raw_collect (regcache, ARM_SP_REGNUM,
232 (char *) &inferior_registers.r_sp); 359 (char *) &inferior_registers.r_sp);
233 break; 360 break;
@@ -269,28 +396,28 @@ store_register (const struct regcache *r @@ -269,28 +396,28 @@ store_register (const struct regcache *r
269 psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val); 396 psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
270 inferior_registers.r_pc = gdbarch_addr_bits_remove 397 inferior_registers.r_pc = gdbarch_addr_bits_remove
271 (gdbarch, inferior_registers.r_pc); 398 (gdbarch, inferior_registers.r_pc);
272 inferior_registers.r_pc |= psr_val; 399 inferior_registers.r_pc |= psr_val;
273 } 400 }
274 break; 401 break;
275 402
276 default: 403 default:
277 regcache_raw_collect (regcache, regno, 404 regcache_raw_collect (regcache, regno,
278 (char *) &inferior_registers.r[regno]); 405 (char *) &inferior_registers.r[regno]);
279 break; 406 break;
280 } 407 }
281 408
282 ret = ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 409 ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
283 (PTRACE_TYPE_ARG3) &inferior_registers, 0); 410 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
284 411
285 if (ret < 0) 412 if (ret < 0)
286 warning (_("unable to write register %d to inferior"), regno); 413 warning (_("unable to write register %d to inferior"), regno);
287} 414}
288 415
289static void 416static void
290store_regs (const struct regcache *regcache) 417store_regs (const struct regcache *regcache)
291{ 418{
292 struct gdbarch *gdbarch = get_regcache_arch (regcache); 419 struct gdbarch *gdbarch = get_regcache_arch (regcache);
293 struct reg inferior_registers; 420 struct reg inferior_registers;
294 int ret; 421 int ret;
295 int regno; 422 int regno;
296 423
@@ -317,156 +444,191 @@ store_regs (const struct regcache *regca @@ -317,156 +444,191 @@ store_regs (const struct regcache *regca
317 unsigned psr_val; 444 unsigned psr_val;
318 445
319 regcache_raw_collect (regcache, ARM_PC_REGNUM, 446 regcache_raw_collect (regcache, ARM_PC_REGNUM,
320 (char *) &pc_val); 447 (char *) &pc_val);
321 regcache_raw_collect (regcache, ARM_PS_REGNUM, 448 regcache_raw_collect (regcache, ARM_PS_REGNUM,
322 (char *) &psr_val); 449 (char *) &psr_val);
323  450
324 pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val); 451 pc_val = gdbarch_addr_bits_remove (gdbarch, pc_val);
325 psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val); 452 psr_val ^= gdbarch_addr_bits_remove (gdbarch, psr_val);
326 453
327 inferior_registers.r_pc = pc_val | psr_val; 454 inferior_registers.r_pc = pc_val | psr_val;
328 } 455 }
329 456
330 ret = ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)), 457 ret = ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
331 (PTRACE_TYPE_ARG3) &inferior_registers, 0); 458 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp(inferior_ptid));
332 459
333 if (ret < 0) 460 if (ret < 0)
334 warning (_("unable to store general registers")); 461 warning (_("unable to store general registers"));
335} 462}
336 463
337static void 464static void
338store_fp_register (const struct regcache *regcache, int regno) 465store_fp_register (const struct regcache *regcache, int regno)
339{ 466{
340 struct fpreg inferior_fp_registers; 467 struct fpreg inferior_fp_registers;
341 int ret; 468 int ret;
342 469
343 ret = ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), 470 ret = ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
344 (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); 471 (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
345 472
346 if (ret < 0) 473 if (ret < 0)
347 { 474 {
348 warning (_("unable to fetch floating-point registers")); 475 warning (_("unable to fetch floating-point registers"));
349 return; 476 return;
350 } 477 }
351 478
352 switch (regno) 479 switch (regno)
353 { 480 {
354 case ARM_FPS_REGNUM: 481 case ARM_FPSCR_REGNUM:
355 regcache_raw_collect (regcache, ARM_FPS_REGNUM, 482 regcache_raw_collect (regcache, ARM_FPS_REGNUM,
356 (char *) &inferior_fp_registers.fpr_fpsr); 483 (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
357 break; 484 break;
358 485
359 default: 486 default:
360 regcache_raw_collect (regcache, regno, 487 regcache_raw_collect (regcache, regno,
361 (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); 488 (char *) inferior_fp_registers.fpr_vfp.vfp_regs
 489 + 8 * (regno - ARM_D0_REGNUM));
362 break; 490 break;
363 } 491 }
364 492
365 ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), 493 ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
366 (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); 494 (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
367 495
368 if (ret < 0) 496 if (ret < 0)
369 warning (_("unable to write register %d to inferior"), regno); 497 warning (_("unable to write register %d to inferior"), regno);
370} 498}
371 499
372static void 500static void
373store_fp_regs (const struct regcache *regcache) 501store_fp_regs (const struct regcache *regcache)
374{ 502{
375 struct fpreg inferior_fp_registers; 503 struct fpreg inferior_fp_registers;
376 int ret; 504 int ret;
377 int regno; 505 int regno;
378 506
379 507
380 for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++) 508 for (regno = 0; regno <= 15; regno++)
381 regcache_raw_collect (regcache, regno, 509 regcache_raw_collect (regcache, regno + ARM_D0_REGNUM,
382 (char *) &inferior_fp_registers.fpr[regno - ARM_F0_REGNUM]); 510 (char *) inferior_fp_registers.fpr_vfp.vfp_regs
 511 + 8 * regno);
383 512
384 regcache_raw_collect (regcache, ARM_FPS_REGNUM, 513 regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
385 (char *) &inferior_fp_registers.fpr_fpsr); 514 (char *) &inferior_fp_registers.fpr_vfp.vfp_fpscr);
386 515
387 ret = ptrace (PT_SETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)), 516 ret = ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
388 (PTRACE_TYPE_ARG3) &inferior_fp_registers, 0); 517 (PTRACE_TYPE_ARG3) &inferior_fp_registers, ptid_get_lwp(inferior_ptid));
389 518
390 if (ret < 0) 519 if (ret < 0)
391 warning (_("unable to store floating-point registers")); 520 warning (_("unable to store floating-point registers"));
392} 521}
393 522
394static void 523static void
395armnbsd_store_registers (struct target_ops *ops, 524armnbsd_store_registers (struct target_ops *ops,
396 struct regcache *regcache, int regno) 525 struct regcache *regcache, int regno)
397{ 526{
398 if (regno >= 0) 527 if (regno >= 0)
399 { 528 {
400 if (regno < ARM_F0_REGNUM || regno > ARM_FPS_REGNUM) 529 if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
401 store_register (regcache, regno); 
402 else 
403 store_fp_register (regcache, regno); 530 store_fp_register (regcache, regno);
 531 else
 532 store_register (regcache, regno);
404 } 533 }
405 else 534 else
406 { 535 {
407 store_regs (regcache); 536 store_regs (regcache);
408 store_fp_regs (regcache); 537 store_fp_regs (regcache);
409 } 538 }
410} 539}
411 540
 541struct md_core
 542{
 543 struct reg intreg;
 544 struct fpreg freg;
 545};
 546
 547static void
 548fetch_core_registers (struct regcache *regcache,
 549 char *core_reg_sect, unsigned core_reg_size,
 550 int which, CORE_ADDR ignore)
 551{
 552 struct md_core *core_reg = (struct md_core *) core_reg_sect;
 553 int regno;
 554 CORE_ADDR r_pc;
 555
 556 arm_supply_gregset (regcache, &core_reg->intreg);
 557 arm_supply_vfpregset (regcache, &core_reg->freg);
 558}
 559
412static void 560static void
413fetch_elfcore_registers (struct regcache *regcache, 561fetch_elfcore_registers (struct regcache *regcache,
414 char *core_reg_sect, unsigned core_reg_size, 562 char *core_reg_sect, unsigned core_reg_size,
415 int which, CORE_ADDR ignore) 563 int which, CORE_ADDR ignore)
416{ 564{
417 struct reg gregset; 565 struct reg gregset;
418 struct fpreg fparegset; 566 struct fpreg vfpregset;
419 567
420 switch (which) 568 switch (which)
421 { 569 {
422 case 0: /* Integer registers. */ 570 case 0: /* Integer registers. */
423 if (core_reg_size != sizeof (struct reg)) 571 if (core_reg_size != sizeof (struct reg))
424 warning (_("wrong size of register set in core file")); 572 warning (_("wrong size of register set in core file"));
425 else 573 else
426 { 574 {
427 /* The memcpy may be unnecessary, but we can't really be sure 575 /* The memcpy may be unnecessary, but we can't really be sure
428 of the alignment of the data in the core file. */ 576 of the alignment of the data in the core file. */
429 memcpy (&gregset, core_reg_sect, sizeof (gregset)); 577 memcpy (&gregset, core_reg_sect, sizeof (gregset));
430 arm_supply_gregset (regcache, &gregset); 578 arm_supply_gregset (regcache, &gregset);
431 } 579 }
432 break; 580 break;
433 581
434 case 2: 582 case 2:
435 if (core_reg_size != sizeof (struct fpreg)) 583 if (core_reg_size != sizeof (struct fpreg))
436 warning (_("wrong size of FPA register set in core file")); 584 warning (_("wrong size of FPA register set in core file"));
437 else 585 else
438 { 586 {
439 /* The memcpy may be unnecessary, but we can't really be sure 587 /* The memcpy may be unnecessary, but we can't really be sure
440 of the alignment of the data in the core file. */ 588 of the alignment of the data in the core file. */
441 memcpy (&fparegset, core_reg_sect, sizeof (fparegset)); 589 memcpy (&vfpregset, core_reg_sect, sizeof (vfpregset));
442 arm_supply_fparegset (regcache, &fparegset); 590 arm_supply_vfpregset (regcache, &vfpregset);
443 } 591 }
444 break; 592 break;
445 593
446 default: 594 default:
447 /* Don't know what kind of register request this is; just ignore it. */ 595 /* Don't know what kind of register request this is; just ignore it. */
448 break; 596 break;
449 } 597 }
450} 598}
451 599
 600static struct core_fns arm_netbsd_core_fns =
 601{
 602 bfd_target_unknown_flavour, /* core_flovour. */
 603 default_check_format, /* check_format. */
 604 default_core_sniffer, /* core_sniffer. */
 605 fetch_core_registers, /* core_read_registers. */
 606 NULL
 607};
 608
452static struct core_fns arm_netbsd_elfcore_fns = 609static struct core_fns arm_netbsd_elfcore_fns =
453{ 610{
454 bfd_target_elf_flavour, /* core_flovour. */ 611 bfd_target_elf_flavour, /* core_flovour. */
455 default_check_format, /* check_format. */ 612 default_check_format, /* check_format. */
456 default_core_sniffer, /* core_sniffer. */ 613 default_core_sniffer, /* core_sniffer. */
457 fetch_elfcore_registers, /* core_read_registers. */ 614 fetch_elfcore_registers, /* core_read_registers. */
458 NULL 615 NULL
459}; 616};
460 617
461void 618void
462_initialize_arm_netbsd_nat (void) 619_initialize_arm_netbsd_nat (void)
463{ 620{
464 struct target_ops *t; 621 struct target_ops *t;
465 622
466 t = inf_ptrace_target (); 623 t = inf_ptrace_target ();
467 t->to_fetch_registers = armnbsd_fetch_registers; 624 t->to_fetch_registers = armnbsd_fetch_registers;
468 t->to_store_registers = armnbsd_store_registers; 625 t->to_store_registers = armnbsd_store_registers;
 626 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
469 add_target (t); 627 add_target (t);
470 628
 629 /* Support debugging kernel virtual memory images. */
 630 bsd_kvm_add_target (armnbsd_supply_pcb);
 631
 632 deprecated_add_core_fns (&arm_netbsd_core_fns);
471 deprecated_add_core_fns (&arm_netbsd_elfcore_fns); 633 deprecated_add_core_fns (&arm_netbsd_elfcore_fns);
472} 634}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c 2017/11/28 18:18:14 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,96 +1,118 @@ @@ -1,96 +1,118 @@
1/* Target-dependent code for NetBSD/arm. 1/* Target-dependent code for NetBSD/arm.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "osabi.h" 21#include "osabi.h"
22 22
23#include "arch/arm.h" 23#include "arch/arm.h"
24#include "arm-tdep.h" 24#include "arm-tdep.h"
 25#include "nbsd-tdep.h"
25#include "solib-svr4.h" 26#include "solib-svr4.h"
26 27
27/* Description of the longjmp buffer. */ 28/* Description of the longjmp buffer. */
28#define ARM_NBSD_JB_PC 24 29#define ARM_NBSD_JB_PC 24
29#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE 30#define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
30 31
31/* For compatibility with previous implemenations of GDB on arm/NetBSD, 32/* For compatibility with previous implemenations of GDB on arm/NetBSD,
32 override the default little-endian breakpoint. */ 33 override the default little-endian breakpoint. */
33static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6}; 34static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
34static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11}; 35static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11};
35static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde}; 36static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
36static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe}; 37static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
37 38
38static void 39static void
39arm_netbsd_init_abi_common (struct gdbarch_info info, 40arm_netbsd_init_abi_common (struct gdbarch_info info,
40 struct gdbarch *gdbarch) 41 struct gdbarch *gdbarch)
41{ 42{
42 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 43 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
43 44
44 tdep->lowest_pc = 0x8000; 45 tdep->lowest_pc = 0x8000;
45 switch (info.byte_order) 46 switch (info.byte_order_for_code)
46 { 47 {
47 case BFD_ENDIAN_LITTLE: 48 case BFD_ENDIAN_LITTLE:
48 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint; 49 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
49 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint; 50 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint;
50 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint); 51 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
51 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint); 52 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint);
52 break; 53 break;
53 54
54 case BFD_ENDIAN_BIG: 55 case BFD_ENDIAN_BIG:
55 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint; 56 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint;
56 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint; 57 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint;
57 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint); 58 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint);
58 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint); 59 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint);
59 break; 60 break;
60 61
61 default: 62 default:
62 internal_error (__FILE__, __LINE__, 63 internal_error (__FILE__, __LINE__,
63 _("arm_gdbarch_init: bad byte order for float format")); 64 _("arm_gdbarch_init: bad byte order for float format"));
64 } 65 }
65 66
66 tdep->jb_pc = ARM_NBSD_JB_PC; 67 tdep->jb_pc = ARM_NBSD_JB_PC;
67 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE; 68 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
68 69
69 /* Single stepping. */ 70 /* Single stepping. */
70 set_gdbarch_software_single_step (gdbarch, arm_software_single_step); 71 set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
 72 /* Core support */
 73 set_gdbarch_iterate_over_regset_sections
 74 (gdbarch, armbsd_iterate_over_regset_sections);
 75
 76}
 77
 78static void
 79arm_netbsd_aout_init_abi (struct gdbarch_info info,
 80 struct gdbarch *gdbarch)
 81{
 82 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 83
 84 arm_netbsd_init_abi_common (info, gdbarch);
 85 if (tdep->fp_model == ARM_FLOAT_AUTO)
 86 tdep->fp_model = ARM_FLOAT_SOFT_FPA;
71} 87}
72  88
73static void 89static void
74arm_netbsd_elf_init_abi (struct gdbarch_info info, 90arm_netbsd_elf_init_abi (struct gdbarch_info info,
75 struct gdbarch *gdbarch) 91 struct gdbarch *gdbarch)
76{ 92{
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 93 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
78 94
79 arm_netbsd_init_abi_common (info, gdbarch); 95 arm_netbsd_init_abi_common (info, gdbarch);
80 if (tdep->fp_model == ARM_FLOAT_AUTO) 96 if (tdep->fp_model == ARM_FLOAT_AUTO)
81 tdep->fp_model = ARM_FLOAT_SOFT_VFP; 97 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
82 98
83 /* NetBSD ELF uses SVR4-style shared libraries. */ 99 /* NetBSD ELF uses SVR4-style shared libraries. */
84 set_solib_svr4_fetch_link_map_offsets 100 set_solib_svr4_fetch_link_map_offsets
85 (gdbarch, svr4_ilp32_fetch_link_map_offsets); 101 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
 102
 103 /* for single stepping; see PR/50773 */
 104 set_gdbarch_skip_solib_resolver (gdbarch, nbsd_skip_solib_resolver);
86} 105}
87 106
88/* Provide a prototype to silence -Wmissing-prototypes. */ 107/* Provide a prototype to silence -Wmissing-prototypes. */
89extern initialize_file_ftype _initialize_arm_netbsd_tdep; 108extern initialize_file_ftype _initialize_arm_netbsd_tdep;
90 109
91void 110void
92_initialize_arm_netbsd_tdep (void) 111_initialize_arm_netbsd_tdep (void)
93{ 112{
 113 gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour,
 114 arm_netbsd_aout_osabi_sniffer);
 115
94 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD, 116 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD,
95 arm_netbsd_elf_init_abi); 117 arm_netbsd_elf_init_abi);
96} 118}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c 2017/11/28 18:18:13 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/hppa-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Native-dependent code for NetBSD/hppa. 1/* Native-dependent code for NetBSD/hppa.
2 2
3 Copyright (C) 2008-2017 Free Software Foundation, Inc. 3 Copyright (C) 2008-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
@@ -20,91 +20,99 @@ @@ -20,91 +20,99 @@
20#include "defs.h" 20#include "defs.h"
21#include "inferior.h" 21#include "inferior.h"
22#include "regcache.h" 22#include "regcache.h"
23 23
24#include <sys/types.h> 24#include <sys/types.h>
25#include <sys/ptrace.h> 25#include <sys/ptrace.h>
26#include <machine/reg.h> 26#include <machine/reg.h>
27 27
28#include "hppa-tdep.h" 28#include "hppa-tdep.h"
29#include "inf-ptrace.h" 29#include "inf-ptrace.h"
30 30
31#include "nbsd-nat.h" 31#include "nbsd-nat.h"
32 32
 33#ifndef HAVE_GREGSET_T
 34typedef struct reg gregset_t;
 35#endif
 36
 37#ifndef HAVE_FPREGSET_T
 38typedef struct fpreg fpregset_t;
 39#endif
 40
 41#include "gregset.h"
 42
33static int 43static int
34hppanbsd_gregset_supplies_p (int regnum) 44hppanbsd_gregset_supplies_p (int regnum)
35{ 45{
36 return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) || 46 return ((regnum >= HPPA_R0_REGNUM && regnum <= HPPA_R31_REGNUM) ||
37 (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) || 47 (regnum >= HPPA_SAR_REGNUM && regnum <= HPPA_PCSQ_TAIL_REGNUM) ||
38 regnum == HPPA_IPSW_REGNUM || 48 regnum == HPPA_IPSW_REGNUM ||
39 (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5)); 49 (regnum >= HPPA_SR4_REGNUM && regnum <= HPPA_SR4_REGNUM + 5));
40} 50}
41 51
42static int 52static int
43hppanbsd_fpregset_supplies_p (int regnum) 53hppanbsd_fpregset_supplies_p (int regnum)
44{ 54{
45 return (regnum >= HPPA_FP0_REGNUM && regnum <= HPPA_FP31R_REGNUM); 55 return (regnum >= HPPA_FP0_REGNUM && regnum <= HPPA_FP31R_REGNUM);
46} 56}
47 57
48/* Supply the general-purpose registers stored in GREGS to REGCACHE. */ 58/* Supply the general-purpose registers stored in GREGS to REGCACHE. */
49 59
50static void 60static void
51hppanbsd_supply_gregset (struct regcache *regcache, const void *gregs) 61hppanbsd_supply_gregset (struct regcache *regcache, const void *gregs)
52{ 62{
53 const char *regs = gregs; 63 const char *regs = (const char *) gregs;
54 const int *r = gregs; 
55 int regnum; 64 int regnum;
56 65
57 for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++) 66 for (regnum = HPPA_R1_REGNUM; regnum <= HPPA_R31_REGNUM; regnum++)
58 regcache_raw_supply (regcache, regnum, regs + regnum * 4); 67 regcache_raw_supply (regcache, regnum, regs + regnum * 4);
59 68
60 regcache_raw_supply (regcache, HPPA_SAR_REGNUM, regs + 32 * 4); 69 regcache_raw_supply (regcache, HPPA_SAR_REGNUM, regs + 32 * 4);
61 regcache_raw_supply (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4); 70 regcache_raw_supply (regcache, HPPA_PCSQ_HEAD_REGNUM, regs + 33 * 4);
62 regcache_raw_supply (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4); 71 regcache_raw_supply (regcache, HPPA_PCSQ_TAIL_REGNUM, regs + 34 * 4);
63 regcache_raw_supply (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); 72 regcache_raw_supply (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4);
64 regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4); 73 regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 36 * 4);
65 regcache_raw_supply (regcache, HPPA_IPSW_REGNUM, regs); 74 regcache_raw_supply (regcache, HPPA_IPSW_REGNUM, regs);
66 regcache_raw_supply (regcache, HPPA_SR4_REGNUM, regs + 41 * 4); 75 regcache_raw_supply (regcache, HPPA_SR4_REGNUM, regs + 41 * 4);
67 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); 76 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4);
68 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); 77 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4);
69 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); 78 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4);
70 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); 79 regcache_raw_supply (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4);
71} 80}
72 81
73/* Supply the floating-point registers stored in FPREGS to REGCACHE. */ 82/* Supply the floating-point registers stored in FPREGS to REGCACHE. */
74 83
75static void 84static void
76hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs) 85hppanbsd_supply_fpregset (struct regcache *regcache, const void *fpregs)
77{ 86{
78 const char *regs = fpregs; 87 const char *regs = (const char *) fpregs;
79 int regnum; 88 int regnum;
80 89
81 for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM; 90 for (regnum = HPPA_FP0_REGNUM; regnum <= HPPA_FP31R_REGNUM;
82 regnum += 2, regs += 8) 91 regnum += 2, regs += 8)
83 { 92 {
84 regcache_raw_supply (regcache, regnum, regs); 93 regcache_raw_supply (regcache, regnum, regs);
85 regcache_raw_supply (regcache, regnum + 1, regs + 4); 94 regcache_raw_supply (regcache, regnum + 1, regs + 4);
86 } 95 }
87} 96}
88 97
89/* Collect the general-purpose registers from REGCACHE and store them 98/* Collect the general-purpose registers from REGCACHE and store them
90 in GREGS. */ 99 in GREGS. */
91 100
92static void 101static void
93hppanbsd_collect_gregset (const struct regcache *regcache, 102hppanbsd_collect_gregset (const struct regcache *regcache,
94 void *gregs, int regnum) 103 void *gregs, int regnum)
95{ 104{
96 char *regs = gregs; 105 char *regs = (char *) gregs;
97 int *r = gregs; 
98 int i; 106 int i;
99 107
100 for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++) 108 for (i = HPPA_R1_REGNUM; i <= HPPA_R31_REGNUM; i++)
101 { 109 {
102 if (regnum == -1 || regnum == i) 110 if (regnum == -1 || regnum == i)
103 regcache_raw_collect (regcache, i, regs + i * 4); 111 regcache_raw_collect (regcache, i, regs + i * 4);
104 } 112 }
105 113
106 if (regnum == -1 || regnum == HPPA_IPSW_REGNUM) 114 if (regnum == -1 || regnum == HPPA_IPSW_REGNUM)
107 regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs); 115 regcache_raw_collect (regcache, HPPA_IPSW_REGNUM, regs);
108 if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM) 116 if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM)
109 regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4); 117 regcache_raw_collect (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 35 * 4);
110 if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM) 118 if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM)
@@ -128,110 +136,150 @@ hppanbsd_collect_gregset (const struct r @@ -128,110 +136,150 @@ hppanbsd_collect_gregset (const struct r
128 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4); 136 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 1, regs + 37 * 4);
129 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 2) 137 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 2)
130 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4); 138 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 2, regs + 38 * 4);
131 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 3) 139 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 3)
132 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4); 140 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 3, regs + 39 * 4);
133 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 4) 141 if (regnum == -1 || regnum == HPPA_SR4_REGNUM + 4)
134 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4); 142 regcache_raw_collect (regcache, HPPA_SR4_REGNUM + 4, regs + 40 * 4);
135} 143}
136 144
137/* Collect the floating-point registers from REGCACHE and store them 145/* Collect the floating-point registers from REGCACHE and store them
138 in FPREGS. */ 146 in FPREGS. */
139 147
140static void 148static void
141hppanbsd_collect_fpregset (struct regcache *regcache, 149hppanbsd_collect_fpregset (const struct regcache *regcache,
142 void *fpregs, int regnum) 150 void *fpregs, int regnum)
143{ 151{
144 char *regs = fpregs; 152 char *regs = (char *) fpregs;
145 int i; 153 int i;
146 154
147 for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8) 155 for (i = HPPA_FP0_REGNUM; i <= HPPA_FP31R_REGNUM; i += 2, regs += 8)
148 { 156 {
149 if (regnum == -1 || regnum == i || regnum == i + 1) 157 if (regnum == -1 || regnum == i || regnum == i + 1)
150 { 158 {
151 regcache_raw_collect (regcache, i, regs); 159 regcache_raw_collect (regcache, i, regs);
152 regcache_raw_collect (regcache, i + 1, regs + 4); 160 regcache_raw_collect (regcache, i + 1, regs + 4);
153 } 161 }
154 } 162 }
155} 163}
156  164
157 165
158/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this 166/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this
159 for all registers (including the floating-point registers). */ 167 for all registers (including the floating-point registers). */
160 168
161static void 169static void
162hppanbsd_fetch_registers (struct target_ops *ops, 170hppanbsd_fetch_registers (struct target_ops *ops,
163 struct regcache *regcache, int regnum) 171 struct regcache *regcache, int regnum)
164 172
165{ 173{
166 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
167 
168 if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) 174 if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
169 { 175 {
170 struct reg regs; 176 struct reg regs;
171 177
172 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 178 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 179 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
173 perror_with_name (_("Couldn't get registers")); 180 perror_with_name (_("Couldn't get registers"));
174 181
175 hppanbsd_supply_gregset (regcache, &regs); 182 hppanbsd_supply_gregset (regcache, &regs);
176 } 183 }
177 184
178 if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) 185 if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum))
179 { 186 {
180 struct fpreg fpregs; 187 struct fpreg fpregs;
181 188
182 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 189 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 190 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
183 perror_with_name (_("Couldn't get floating point status")); 191 perror_with_name (_("Couldn't get floating point status"));
184 192
185 hppanbsd_supply_fpregset (regcache, &fpregs); 193 hppanbsd_supply_fpregset (regcache, &fpregs);
186 } 194 }
187} 195}
188 196
189/* Store register REGNUM back into the inferior. If REGNUM is -1, do 197/* Store register REGNUM back into the inferior. If REGNUM is -1, do
190 this for all registers (including the floating-point registers). */ 198 this for all registers (including the floating-point registers). */
191 199
192static void 200static void
193hppanbsd_store_registers (struct target_ops *ops, 201hppanbsd_store_registers (struct target_ops *ops,
194 struct regcache *regcache, int regnum) 202 struct regcache *regcache, int regnum)
195{ 203{
196 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
197 
198 if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum)) 204 if (regnum == -1 || hppanbsd_gregset_supplies_p (regnum))
199 { 205 {
200 struct reg regs; 206 struct reg regs;
201 207
202 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 208 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 209 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
203 perror_with_name (_("Couldn't get registers")); 210 perror_with_name (_("Couldn't get registers"));
204 211
205 hppanbsd_collect_gregset (regcache, &regs, regnum); 212 hppanbsd_collect_gregset (regcache, &regs, regnum);
206 213
207 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 214 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
 215 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
208 perror_with_name (_("Couldn't write registers")); 216 perror_with_name (_("Couldn't write registers"));
209 } 217 }
210 218
211 if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum)) 219 if (regnum == -1 || hppanbsd_fpregset_supplies_p (regnum))
212 { 220 {
213 struct fpreg fpregs; 221 struct fpreg fpregs;
214 222
215 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 223 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 224 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
216 perror_with_name (_("Couldn't get floating point status")); 225 perror_with_name (_("Couldn't get floating point status"));
217 226
218 hppanbsd_collect_fpregset (regcache, &fpregs, regnum); 227 hppanbsd_collect_fpregset (regcache, &fpregs, regnum);
219 228
220 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 229 if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
 230 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
221 perror_with_name (_("Couldn't write floating point status")); 231 perror_with_name (_("Couldn't write floating point status"));
222 } 232 }
223} 233}
224 234
 235void
 236supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
 237{
 238 hppanbsd_supply_gregset (regcache, gregsetp);
 239}
 240
 241/* Fill register REGNUM (if it is a general-purpose register) in
 242 *GREGSETP with the value in GDB's register cache. If REGNUM is -1,
 243 do this for all registers. */
 244
 245void
 246fill_gregset (const struct regcache *regcache,
 247 gregset_t *gregsetp, int regnum)
 248{
 249 hppanbsd_collect_gregset (regcache, gregsetp, regnum);
 250}
 251
 252/* Transfering floating-point registers between GDB, inferiors and cores. */
 253
 254/* Fill GDB's register cache with the floating-point and SSE register
 255 values in *FPREGSETP. */
 256
 257void
 258supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 259{
 260 hppanbsd_supply_fpregset (regcache, fpregsetp);
 261}
 262
 263/* Fill register REGNUM (if it is a floating-point or SSE register) in
 264 *FPREGSETP with the value in GDB's register cache. If REGNUM is
 265 -1, do this for all registers. */
 266
 267void
 268fill_fpregset (const struct regcache *regcache,
 269 fpregset_t *fpregsetp, int regnum)
 270{
 271 hppanbsd_collect_fpregset (regcache, fpregsetp, regnum);
 272}
225 273
226/* Provide a prototype to silence -Wmissing-prototypes. */ 274/* Provide a prototype to silence -Wmissing-prototypes. */
227void _initialize_hppanbsd_nat (void); 275void _initialize_hppanbsd_nat (void);
228 276
229void 277void
230_initialize_hppanbsd_nat (void) 278_initialize_hppanbsd_nat (void)
231{ 279{
232 struct target_ops *t; 280 struct target_ops *t;
233 281
234 /* Add some extra features to the ptrace target. */ 282 /* Add some extra features to the ptrace target. */
235 t = inf_ptrace_target (); 283 t = inf_ptrace_target ();
236 284
237 t->to_fetch_registers = hppanbsd_fetch_registers; 285 t->to_fetch_registers = hppanbsd_fetch_registers;

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/hppa-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/hppa-nbsd-tdep.c 2017/11/28 18:18:02 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/hppa-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,42 +1,42 @@ @@ -1,42 +1,42 @@
1/* Target-dependent code for NetBSD/hppa 1/* Target-dependent code for NetBSD/hppa
2 2
3 Copyright (C) 2008-2017 Free Software Foundation, Inc. 3 Copyright (C) 2008-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "osabi.h" 21#include "osabi.h"
22#include "regcache.h" 22#include "regcache.h"
23#include "regset.h" 23#include "regset.h"
24 24
25#include "trad-frame.h" 25#include "trad-frame.h"
26#include "tramp-frame.h" 26#include "tramp-frame.h"
27 27
28#include "hppa-tdep.h" 28#include "hppa-tdep.h"
29#include "hppa-bsd-tdep.h" 29#include "hppabsd-tdep.h"
30 30
31/* From <machine/mcontext.h>. */ 31/* From <machine/mcontext.h>. */
32static int hppanbsd_mc_reg_offset[] = 32static int hppanbsd_mc_reg_offset[] =
33{ 33{
34 /* r0 ... r31 */ 34 /* r0 ... r31 */
35 -1, 1 * 4, 2 * 4, 3 * 4, 35 -1, 1 * 4, 2 * 4, 3 * 4,
36 4 * 4, 5 * 4, 6 * 4, 7 * 4, 36 4 * 4, 5 * 4, 6 * 4, 7 * 4,
37 8 * 4, 9 * 4, 10 * 4, 11 * 4,  37 8 * 4, 9 * 4, 10 * 4, 11 * 4,
38 12 * 4, 13 * 4, 14 * 4, 15 * 4, 38 12 * 4, 13 * 4, 14 * 4, 15 * 4,
39 16 * 4, 17 * 4, 18 * 4, 19 * 4, 39 16 * 4, 17 * 4, 18 * 4, 19 * 4,
40 20 * 4, 21 * 4, 22 * 4, 23 * 4, 40 20 * 4, 21 * 4, 22 * 4, 23 * 4,
41 24 * 4, 25 * 4, 26 * 4, 27 * 4, 41 24 * 4, 25 * 4, 26 * 4, 27 * 4,
42 28 * 4, 29 * 4, 30 * 4, 31 * 4, 42 28 * 4, 29 * 4, 30 * 4, 31 * 4,
@@ -47,26 +47,39 @@ static int hppanbsd_mc_reg_offset[] = @@ -47,26 +47,39 @@ static int hppanbsd_mc_reg_offset[] =
47 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */ 47 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
48 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */ 48 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
49 -1, /* HPPA_EIEM_REGNUM */ 49 -1, /* HPPA_EIEM_REGNUM */
50 -1, /* HPPA_IIR_REGNUM */ 50 -1, /* HPPA_IIR_REGNUM */
51 -1, /* HPPA_ISR_REGNUM */ 51 -1, /* HPPA_ISR_REGNUM */
52 -1, /* HPPA_IOR_REGNUM */ 52 -1, /* HPPA_IOR_REGNUM */
53 0 * 4, /* HPPA_IPSW_REGNUM */ 53 0 * 4, /* HPPA_IPSW_REGNUM */
54 -1, /* spare? */ 54 -1, /* spare? */
55 41 * 4, /* HPPA_SR4_REGNUM */ 55 41 * 4, /* HPPA_SR4_REGNUM */
56 37 * 4, /* sr0 */ 56 37 * 4, /* sr0 */
57 38 * 4, /* sr1 */ 57 38 * 4, /* sr1 */
58 39 * 4, /* sr2 */ 58 39 * 4, /* sr2 */
59 40 * 4, /* sr3 */ 59 40 * 4, /* sr3 */
 60 -1, /* 48 */
 61 -1, /* 49 */
 62 -1, /* 50 */
 63 -1, /* 51 */
 64 -1, /* 52 */
 65 -1, /* 53 */
 66 -1, /* 54 */
 67 -1, /* 55 */
 68 -1, /* 56 */
 69 -1, /* 57 CR24 */
 70 -1, /* 58 CR25 */
 71 -1, /* 59 CR26 */
 72 43 * 4, /* HPPA_CR27_REGNUM */
60 73
61 /* more tbd */ 74 /* more tbd */
62}; 75};
63 76
64static void hppanbsd_sigtramp_cache_init (const struct tramp_frame *, 77static void hppanbsd_sigtramp_cache_init (const struct tramp_frame *,
65 struct frame_info *, 78 struct frame_info *,
66 struct trad_frame_cache *, 79 struct trad_frame_cache *,
67 CORE_ADDR); 80 CORE_ADDR);
68 81
69static const struct tramp_frame hppanbsd_sigtramp_si4 = 82static const struct tramp_frame hppanbsd_sigtramp_si4 =
70{ 83{
71 SIGTRAMP_FRAME, 84 SIGTRAMP_FRAME,
72 4, 85 4,
@@ -118,50 +131,69 @@ hppanbsd_sigtramp_cache_init (const stru @@ -118,50 +131,69 @@ hppanbsd_sigtramp_cache_init (const stru
118 base += 40; 131 base += 40;
119 132
120 for (i = 0; i < num_regs; i++) 133 for (i = 0; i < num_regs; i++)
121 if (reg_offset[i] != -1) 134 if (reg_offset[i] != -1)
122 trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]); 135 trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]);
123 136
124 /* Construct the frame ID using the function start. */ 137 /* Construct the frame ID using the function start. */
125 trad_frame_set_id (this_cache, frame_id_build (sp, func)); 138 trad_frame_set_id (this_cache, frame_id_build (sp, func));
126} 139}
127 140
128/* Core file support. */ 141/* Core file support. */
129 142
130/* Sizeof `struct reg' in <machine/reg.h>. */ 143/* Sizeof `struct reg' in <machine/reg.h>. */
131#define HPPANBSD_SIZEOF_GREGS (44 * 4) 144#define HPPANBSD_SIZEOF_GREGS (47 * 4)
132 145
133static int hppanbsd_reg_offset[] = 146static int hppanbsd_reg_offset[] =
134{ 147{
135 /* r0 ... r31 */ 148 /* r0 ... r31 */
136 -1, 1 * 4, 2 * 4, 3 * 4, 149 -1, 1 * 4, 2 * 4, 3 * 4,
137 4 * 4, 5 * 4, 6 * 4, 7 * 4, 150 4 * 4, 5 * 4, 6 * 4, 7 * 4,
138 8 * 4, 9 * 4, 10 * 4, 11 * 4,  151 8 * 4, 9 * 4, 10 * 4, 11 * 4,
139 12 * 4, 13 * 4, 14 * 4, 15 * 4, 152 12 * 4, 13 * 4, 14 * 4, 15 * 4,
140 16 * 4, 17 * 4, 18 * 4, 19 * 4, 153 16 * 4, 17 * 4, 18 * 4, 19 * 4,
141 20 * 4, 21 * 4, 22 * 4, 23 * 4, 154 20 * 4, 21 * 4, 22 * 4, 23 * 4,
142 24 * 4, 25 * 4, 26 * 4, 27 * 4, 155 24 * 4, 25 * 4, 26 * 4, 27 * 4,
143 28 * 4, 29 * 4, 30 * 4, 31 * 4, 156 28 * 4, 29 * 4, 30 * 4, 31 * 4,
144 157
145 32 * 4, /* HPPA_SAR_REGNUM */ 158 32 * 4, /* HPPA_SAR_REGNUM */
146 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */ 159 35 * 4, /* HPPA_PCOQ_HEAD_REGNUM */
147 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */ 160 33 * 4, /* HPPA_PCSQ_HEAD_REGNUM */
148 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */ 161 36 * 4, /* HPPA_PCOQ_TAIL_REGNUM */
149 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */ 162 34 * 4, /* HPPA_PCSQ_TAIL_REGNUM */
150 -1, /* HPPA_EIEM_REGNUM */ 163 -1, /* HPPA_EIEM_REGNUM */
151 -1, /* HPPA_IIR_REGNUM */ 164 -1, /* HPPA_IIR_REGNUM */
152 -1, /* HPPA_ISR_REGNUM */ 165 -1, /* HPPA_ISR_REGNUM */
153 -1, /* HPPA_IOR_REGNUM */ 166 -1, /* HPPA_IOR_REGNUM */
154 0 * 4, /* HPPA_IPSW_REGNUM */ 167 0 * 4, /* HPPA_IPSW_REGNUM */
 168 -1, /* spare? */
 169 41 * 4, /* HPPA_SR4_REGNUM */
 170 37 * 4, /* sr0 */
 171 38 * 4, /* sr1 */
 172 39 * 4, /* sr2 */
 173 40 * 4, /* sr3 */
 174 -1, /* 48 */
 175 -1, /* 49 */
 176 -1, /* 50 */
 177 -1, /* 51 */
 178 -1, /* 52 */
 179 -1, /* 53 */
 180 -1, /* 54 */
 181 -1, /* 55 */
 182 -1, /* 56 */
 183 -1, /* 57 */
 184 -1, /* 58 */
 185 -1, /* 59 */
 186 46 * 4, /* HPPA_CR27_REGNUM */
155}; 187};
156 188
157/* Supply register REGNUM from the buffer specified by GREGS and LEN 189/* Supply register REGNUM from the buffer specified by GREGS and LEN
158 in the general-purpose register set REGSET to register cache 190 in the general-purpose register set REGSET to register cache
159 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ 191 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
160 192
161static void 193static void
162hppanbsd_supply_gregset (const struct regset *regset, 194hppanbsd_supply_gregset (const struct regset *regset,
163 struct regcache *regcache, 195 struct regcache *regcache,
164 int regnum, const void *gregs, size_t len) 196 int regnum, const void *gregs, size_t len)
165{ 197{
166 const gdb_byte *regs = (const gdb_byte *) gregs; 198 const gdb_byte *regs = (const gdb_byte *) gregs;
167 int i; 199 int i;

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/i386-nbsd-nat.c 2017/11/28 18:18:05 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/i386-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,86 +1,162 @@ @@ -1,86 +1,162 @@
1/* Native-dependent code for NetBSD/i386. 1/* Native-dependent code for NetBSD/i386.
2 2
3 Copyright (C) 2004-2017 Free Software Foundation, Inc. 3 Copyright (C) 2004-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "gdbcore.h" 21#include "gdbcore.h"
22#include "regcache.h" 22#include "regcache.h"
23#include "target.h" 23#include "target.h"
24 24
25#include "i386-tdep.h" 25#include "i386-tdep.h"
26#include "i386-bsd-nat.h" 26#include "i387-tdep.h"
 27#include "i386bsd-nat.h"
27 28
28/* Support for debugging kernel virtual memory images. */ 29/* Support for debugging kernel virtual memory images. */
29 30
30#include <sys/types.h> 31#include <sys/types.h>
 32#include <machine/reg.h>
31#include <machine/frame.h> 33#include <machine/frame.h>
32#include <machine/pcb.h> 34#include <machine/pcb.h>
33 35
34#include "nbsd-nat.h" 36#include "nbsd-nat.h"
35#include "bsd-kvm.h" 37#include "bsd-kvm.h"
36 38
 39#ifndef HAVE_GREGSET_T
 40typedef struct reg gregset_t;
 41#endif
 42
 43#ifndef HAVE_FPREGSET_T
 44typedef struct fpreg fpregset_t;
 45#endif
 46
 47#include "gregset.h"
 48
37static int 49static int
38i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 50i386nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
39{ 51{
40 struct switchframe sf; 52 struct switchframe sf;
41 53
42 /* The following is true for NetBSD 1.6.2: 54 /* The following is true for NetBSD 1.6.2 and after:
43 55
44 The pcb contains %esp and %ebp at the point of the context switch 56 The pcb contains %esp and %ebp at the point of the context switch
45 in cpu_switch(). At that point we have a stack frame as 57 in cpu_switch()/cpu_switchto(). At that point we have a stack frame as
46 described by `struct switchframe', which for NetBSD 1.6.2 has the 58 described by `struct switchframe', which for NetBSD (2.0 and later) has
47 following layout: 59 the following layout:
48 60
49 interrupt level 
50 %edi 61 %edi
51 %esi 62 %esi
52 %ebx 63 %ebx
53 %eip 64 return address
54 65
55 we reconstruct the register state as it would look when we just 66 we reconstruct the register state as it would look when we just
56 returned from cpu_switch(). */ 67 returned from cpu_switch()/cpu_switchto().
 68
 69 For core dumps the pcb is saved by savectx()/dumpsys() and contains the
 70 stack pointer and frame pointer. A new dumpsys() fakes a switchframe
 71 whereas older code isn't reliable so use an iffy heuristic to detect this
 72 and use the frame pointer to recover enough state. */
57 73
58 /* The stack pointer shouldn't be zero. */ 74 /* The stack pointer shouldn't be zero. */
59 if (pcb->pcb_esp == 0) 75 if (pcb->pcb_esp == 0)
60 return 0; 76 return 0;
61 77
62 read_memory (pcb->pcb_esp, (gdb_byte *)&sf, sizeof sf); 78 read_memory (pcb->pcb_esp, (gdb_byte *) &sf, sizeof sf);
63 pcb->pcb_esp += sizeof (struct switchframe); 79
64 regcache_raw_supply (regcache, I386_EDI_REGNUM, &sf.sf_edi); 80 if ( (unsigned long)sf.sf_eip >= (unsigned long)0xc0100000 )
65 regcache_raw_supply (regcache, I386_ESI_REGNUM, &sf.sf_esi); 81 {
66 regcache_raw_supply (regcache, I386_EBP_REGNUM, &pcb->pcb_ebp); 82 /* Yes, we have a switchframe that matches cpu_switchto() or
67 regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_esp); 83 the new dumpsys(). */
68 regcache_raw_supply (regcache, I386_EBX_REGNUM, &sf.sf_ebx); 84
69 regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip); 85 pcb->pcb_esp += sizeof (struct switchframe);
 86 regcache_raw_supply (regcache, I386_EDI_REGNUM, &sf.sf_edi);
 87 regcache_raw_supply (regcache, I386_ESI_REGNUM, &sf.sf_esi);
 88 regcache_raw_supply (regcache, I386_EBP_REGNUM, &pcb->pcb_ebp);
 89 regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_esp);
 90 regcache_raw_supply (regcache, I386_EBX_REGNUM, &sf.sf_ebx);
 91 regcache_raw_supply (regcache, I386_EIP_REGNUM, &sf.sf_eip);
 92 }
 93 else
 94 {
 95 CORE_ADDR pc, fp;
 96
 97 /* No, the pcb must have been last updated by savectx() in old
 98 dumpsys(). Use the frame pointer to recover enough state. */
 99
 100 read_memory (pcb->pcb_ebp, (gdb_byte *) &fp, sizeof(fp));
 101 read_memory (pcb->pcb_ebp + 4, (gdb_byte *) &pc, sizeof(pc));
 102
 103 regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_ebp);
 104 regcache_raw_supply (regcache, I386_EBP_REGNUM, &fp);
 105 regcache_raw_supply (regcache, I386_EIP_REGNUM, &pc);
 106 }
70 107
71 return 1; 108 return 1;
72} 109}
73  110
 111void
 112supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
 113{
 114 i386bsd_supply_gregset (regcache, gregsetp);
 115}
 116
 117/* Fill register REGNUM (if it is a general-purpose register) in
 118 *GREGSETP with the value in GDB's register cache. If REGNUM is -1,
 119 do this for all registers. */
 120
 121void
 122fill_gregset (const struct regcache *regcache,
 123 gregset_t *gregsetp, int regnum)
 124{
 125 i386bsd_collect_gregset (regcache, gregsetp, regnum);
 126}
 127
 128/* Transfering floating-point registers between GDB, inferiors and cores. */
 129
 130/* Fill GDB's register cache with the floating-point and SSE register
 131 values in *FPREGSETP. */
 132
 133void
 134supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
 135{
 136 i387_supply_fsave (regcache, -1, fpregsetp);
 137}
 138
 139/* Fill register REGNUM (if it is a floating-point or SSE register) in
 140 *FPREGSETP with the value in GDB's register cache. If REGNUM is
 141 -1, do this for all registers. */
 142
 143void
 144fill_fpregset (const struct regcache *regcache,
 145 fpregset_t *fpregsetp, int regnum)
 146{
 147 i387_collect_fsave (regcache, regnum, fpregsetp);
 148}
 149
74 150
75/* Provide a prototype to silence -Wmissing-prototypes. */ 151/* Provide a prototype to silence -Wmissing-prototypes. */
76void _initialize_i386nbsd_nat (void); 152void _initialize_i386nbsd_nat (void);
77 153
78void 154void
79_initialize_i386nbsd_nat (void) 155_initialize_i386nbsd_nat (void)
80{ 156{
81 struct target_ops *t; 157 struct target_ops *t;
82 158
83 /* Add some extra features to the common *BSD/i386 target. */ 159 /* Add some extra features to the common *BSD/i386 target. */
84 t = i386bsd_target (); 160 t = i386bsd_target ();
85 t->to_pid_to_exec_file = nbsd_pid_to_exec_file; 161 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
86 add_target (t); 162 add_target (t);

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c 2017/11/28 18:18:04 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/i386. 1/* Target-dependent code for NetBSD/i386.
2 2
3 Copyright (C) 1988-2017 Free Software Foundation, Inc. 3 Copyright (C) 1988-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
@@ -23,26 +23,31 @@ @@ -23,26 +23,31 @@
23#include "gdbcore.h" 23#include "gdbcore.h"
24#include "regcache.h" 24#include "regcache.h"
25#include "regset.h" 25#include "regset.h"
26#include "osabi.h" 26#include "osabi.h"
27#include "symtab.h" 27#include "symtab.h"
28#include "trad-frame.h" 28#include "trad-frame.h"
29#include "tramp-frame.h" 29#include "tramp-frame.h"
30 30
31#include "i386-tdep.h" 31#include "i386-tdep.h"
32#include "i387-tdep.h" 32#include "i387-tdep.h"
33#include "nbsd-tdep.h" 33#include "nbsd-tdep.h"
34#include "solib-svr4.h" 34#include "solib-svr4.h"
35 35
 36#include "elf-bfd.h" /* for header hack */
 37#include "trad-frame.h" /* signal trampoline/kernel frame support */
 38#include "frame-unwind.h" /* kernel frame support */
 39#include "tramp-frame.h" /* signal trampoline/kernel frame support */
 40
36/* From <machine/reg.h>. */ 41/* From <machine/reg.h>. */
37static int i386nbsd_r_reg_offset[] = 42static int i386nbsd_r_reg_offset[] =
38{ 43{
39 0 * 4, /* %eax */ 44 0 * 4, /* %eax */
40 1 * 4, /* %ecx */ 45 1 * 4, /* %ecx */
41 2 * 4, /* %edx */ 46 2 * 4, /* %edx */
42 3 * 4, /* %ebx */ 47 3 * 4, /* %ebx */
43 4 * 4, /* %esp */ 48 4 * 4, /* %esp */
44 5 * 4, /* %ebp */ 49 5 * 4, /* %ebp */
45 6 * 4, /* %esi */ 50 6 * 4, /* %esi */
46 7 * 4, /* %edi */ 51 7 * 4, /* %edi */
47 8 * 4, /* %eip */ 52 8 * 4, /* %eip */
48 9 * 4, /* %eflags */ 53 9 * 4, /* %eflags */
@@ -254,26 +259,172 @@ i386nbsd_sigtramp_cache_init (const stru @@ -254,26 +259,172 @@ i386nbsd_sigtramp_cache_init (const stru
254 /* offsetof(ucontext_t, uc_mcontext) == 36 */ 259 /* offsetof(ucontext_t, uc_mcontext) == 36 */
255 base += 36; 260 base += 36;
256 } 261 }
257 262
258 for (i = 0; i < num_regs; i++) 263 for (i = 0; i < num_regs; i++)
259 if (reg_offset[i] != -1) 264 if (reg_offset[i] != -1)
260 trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]); 265 trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]);
261 266
262 /* Construct the frame ID using the function start. */ 267 /* Construct the frame ID using the function start. */
263 trad_frame_set_id (this_cache, frame_id_build (sp, func)); 268 trad_frame_set_id (this_cache, frame_id_build (sp, func));
264} 269}
265  270
266 271
 272/* From <machine/frame.h>. Note that %esp and %ess are only saved in
 273 a trap frame when entering the kernel from user space. */
 274static int i386nbsd_tf_reg_offset[] =
 275{
 276 10 * 4, /* %eax */
 277 9 * 4, /* %ecx */
 278 8 * 4, /* %edx */
 279 7 * 4, /* %ebx */
 280 -1, /* %esp */
 281 6 * 4, /* %ebp */
 282 5 * 4, /* %esi */
 283 4 * 4, /* %edi */
 284 13 * 4, /* %eip */
 285 15 * 4, /* %eflags */
 286 14 * 4, /* %cs */
 287 -1, /* %ss */
 288 3 * 4, /* %ds */
 289 2 * 4, /* %es */
 290 1 * 4, /* %fs */
 291 0 * 4 /* %gs */
 292};
 293
 294static struct trad_frame_cache *
 295i386nbsd_trapframe_cache(struct frame_info *this_frame, void **this_cache)
 296{
 297 struct trad_frame_cache *cache;
 298 CORE_ADDR func, sp, addr, tmp;
 299 ULONGEST cs;
 300 const char *name;
 301 int i;
 302 struct gdbarch *gdbarch = get_frame_arch (this_frame);
 303 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 304
 305 if (*this_cache)
 306 return (struct trad_frame_cache *)*this_cache;
 307
 308 cache = trad_frame_cache_zalloc (this_frame);
 309 *this_cache = cache;
 310
 311 func = get_frame_func (this_frame);
 312 sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
 313
 314 find_pc_partial_function (func, &name, NULL, NULL);
 315 if (name && strncmp (name, "Xintr", 5) == 0)
 316 {
 317 /* It's an interrupt frame. */
 318 tmp = read_memory_unsigned_integer (sp + 4, 4, byte_order);
 319 if (tmp < 15)
 320 {
 321 /* Reasonable value for 'ppl': already on interrupt stack. */
 322 addr = sp + 8;
 323 }
 324 else
 325 {
 326 /* Switch to previous stack. */
 327 addr = tmp + 4;
 328 }
 329 }
 330 else
 331 {
 332 /* It's a trap frame. */
 333 addr = sp + 4;
 334 }
 335
 336 for (i = 0; i < ARRAY_SIZE (i386nbsd_tf_reg_offset); i++)
 337 if (i386nbsd_tf_reg_offset[i] != -1)
 338 trad_frame_set_reg_addr (cache, i, addr + i386nbsd_tf_reg_offset[i]);
 339
 340 /* Read %cs from trap frame. */
 341 addr += i386nbsd_tf_reg_offset[I386_CS_REGNUM];
 342 cs = read_memory_unsigned_integer (addr, 4, byte_order);
 343 if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
 344 {
 345 /* Trap from user space; terminate backtrace. */
 346 trad_frame_set_id (cache, outer_frame_id);
 347 }
 348 else
 349 {
 350 /* Construct the frame ID using the function start. */
 351 trad_frame_set_id (cache, frame_id_build (sp + 8, func));
 352 }
 353
 354 return cache;
 355}
 356
 357static void
 358i386nbsd_trapframe_this_id (struct frame_info *this_frame,
 359 void **this_cache, struct frame_id *this_id)
 360{
 361 struct trad_frame_cache *cache =
 362 i386nbsd_trapframe_cache (this_frame, this_cache);
 363
 364 trad_frame_get_id (cache, this_id);
 365}
 366
 367static struct value *
 368i386nbsd_trapframe_prev_register (struct frame_info *this_frame,
 369 void **this_cache, int regnum)
 370{
 371 struct trad_frame_cache *cache =
 372 i386nbsd_trapframe_cache (this_frame, this_cache);
 373
 374 return trad_frame_get_register (cache, this_frame, regnum);
 375}
 376
 377static int
 378i386nbsd_trapframe_sniffer (const struct frame_unwind *self,
 379 struct frame_info *this_frame,
 380 void **this_prologue_cache)
 381{
 382 ULONGEST cs;
 383 const char *name;
 384
 385 /* Check Current Privilege Level and bail out if we're not executing
 386 in kernel space. */
 387 cs = get_frame_register_unsigned (this_frame, I386_CS_REGNUM);
 388 if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
 389 return 0;
 390
 391
 392 find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
 393 return (name && ((strcmp (name, "alltraps") == 0)
 394 || (strcmp (name, "calltrap") == 0)
 395 || (strncmp (name, "Xtrap", 5) == 0)
 396 || (strcmp (name, "syscall1") == 0)
 397 || (strcmp (name, "Xsyscall") == 0)
 398 || (strncmp (name, "Xintr", 5) == 0)
 399 || (strncmp (name, "Xresume", 7) == 0)
 400 || (strncmp (name, "Xstray", 6) == 0)
 401 || (strncmp (name, "Xrecurse", 8) == 0)
 402 || (strncmp (name, "Xsoft", 5) == 0)
 403 || (strncmp (name, "Xdoreti", 5) == 0)));
 404}
 405
 406const struct frame_unwind i386nbsd_trapframe_unwind = {
 407 /* FIXME: kettenis/20051219: This really is more like an interrupt
 408 frame, but SIGTRAMP_FRAME would print <signal handler called>,
 409 which really is not what we want here. */
 410 NORMAL_FRAME,
 411 default_frame_unwind_stop_reason,
 412 i386nbsd_trapframe_this_id,
 413 i386nbsd_trapframe_prev_register,
 414 NULL,
 415 i386nbsd_trapframe_sniffer
 416};
 417
267static void  418static void
268i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 419i386nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
269{ 420{
270 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 421 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
271 422
272 /* Obviously NetBSD is BSD-based. */ 423 /* Obviously NetBSD is BSD-based. */
273 i386bsd_init_abi (info, gdbarch); 424 i386bsd_init_abi (info, gdbarch);
274 425
275 /* NetBSD has a different `struct reg'. */ 426 /* NetBSD has a different `struct reg'. */
276 tdep->gregset_reg_offset = i386nbsd_r_reg_offset; 427 tdep->gregset_reg_offset = i386nbsd_r_reg_offset;
277 tdep->gregset_num_regs = ARRAY_SIZE (i386nbsd_r_reg_offset); 428 tdep->gregset_num_regs = ARRAY_SIZE (i386nbsd_r_reg_offset);
278 tdep->sizeof_gregset = 16 * 4; 429 tdep->sizeof_gregset = 16 * 4;
279 430
@@ -283,45 +434,49 @@ i386nbsd_init_abi (struct gdbarch_info i @@ -283,45 +434,49 @@ i386nbsd_init_abi (struct gdbarch_info i
283 /* NetBSD uses tramp_frame sniffers for signal trampolines. */ 434 /* NetBSD uses tramp_frame sniffers for signal trampolines. */
284 tdep->sigcontext_addr= 0; 435 tdep->sigcontext_addr= 0;
285 tdep->sigtramp_start = 0; 436 tdep->sigtramp_start = 0;
286 tdep->sigtramp_end = 0; 437 tdep->sigtramp_end = 0;
287 tdep->sigtramp_p = 0; 438 tdep->sigtramp_p = 0;
288 tdep->sc_reg_offset = 0; 439 tdep->sc_reg_offset = 0;
289 tdep->sc_num_regs = 0; 440 tdep->sc_num_regs = 0;
290 441
291 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_sc16); 442 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_sc16);
292 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_sc2); 443 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_sc2);
293 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si2); 444 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si2);
294 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si31); 445 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si31);
295 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si4); 446 tramp_frame_prepend_unwinder (gdbarch, &i386nbsd_sigtramp_si4);
 447
 448 /* Unwind kernel trap frames correctly. */
 449 frame_unwind_prepend_unwinder (gdbarch, &i386nbsd_trapframe_unwind);
296} 450}
297 451
298/* NetBSD ELF. */ 452/* NetBSD ELF. */
299 453
300static void 454static void
301i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 455i386nbsdelf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
302{ 456{
303 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 457 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
304 458
305 /* It's still NetBSD. */ 459 /* It's still NetBSD. */
306 i386nbsd_init_abi (info, gdbarch); 460 i386nbsd_init_abi (info, gdbarch);
307 461
308 /* But ELF-based. */ 462 /* But ELF-based. */
309 i386_elf_init_abi (info, gdbarch); 463 i386_elf_init_abi (info, gdbarch);
310 464
311 /* NetBSD ELF uses SVR4-style shared libraries. */ 465 /* NetBSD ELF uses SVR4-style shared libraries. */
312 set_solib_svr4_fetch_link_map_offsets 466 set_solib_svr4_fetch_link_map_offsets
313 (gdbarch, svr4_ilp32_fetch_link_map_offsets); 467 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
314 468
315 /* NetBSD ELF uses -fpcc-struct-return by default. */ 469 /* NetBSD ELF uses -fpcc-struct-return by default. */
316 tdep->struct_return = pcc_struct_return; 470 tdep->struct_return = pcc_struct_return;
317} 471}
318 472
319/* Provide a prototype to silence -Wmissing-prototypes. */ 473/* Provide a prototype to silence -Wmissing-prototypes. */
320extern initialize_file_ftype _initialize_i386nbsd_tdep; 474extern initialize_file_ftype _initialize_i386nbsd_tdep;
321 475
 476
322void 477void
323_initialize_i386nbsd_tdep (void) 478_initialize_i386nbsd_tdep (void)
324{ 479{
325 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD, 480 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_NETBSD,
326 i386nbsdelf_init_abi); 481 i386nbsdelf_init_abi);
327} 482}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c 2017/11/28 18:18:22 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/mips-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,123 +1,206 @@ @@ -1,123 +1,206 @@
1/* Native-dependent code for MIPS systems running NetBSD. 1/* Native-dependent code for MIPS systems running NetBSD.
2 2
3 Copyright (C) 2000-2017 Free Software Foundation, Inc. 3 Copyright (C) 2000-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19#ifndef _KERNTYPES
 20#define _KERNTYPES
 21#endif
20#include "defs.h" 22#include "defs.h"
21#include "inferior.h" 23#include "inferior.h"
22#include "regcache.h" 24#include "regcache.h"
23#include "target.h" 25#include "target.h"
24 26
25#include <sys/types.h> 27#include <sys/types.h>
26#include <sys/ptrace.h> 28#include <sys/ptrace.h>
27#include <machine/reg.h> 29#include <machine/reg.h>
28 30
 31#ifndef HAVE_GREGSET_T
 32typedef struct reg gregset_t;
 33#endif
 34
 35#ifndef HAVE_FPREGSET_T
 36typedef struct fpreg fpregset_t;
 37#endif
 38
 39#include "gregset.h"
 40
29#include "mips-tdep.h" 41#include "mips-tdep.h"
30#include "mips-nbsd-tdep.h" 42#include "mipsnbsd-tdep.h"
31#include "inf-ptrace.h" 43#include "inf-ptrace.h"
 44#include "bsd-kvm.h"
 45
 46#include "machine/pcb.h"
32 47
33/* Determine if PT_GETREGS fetches this register. */ 48/* Determine if PT_GETREGS fetches this register. */
34static int 49static int
35getregs_supplies (struct gdbarch *gdbarch, int regno) 50getregs_supplies (struct gdbarch *gdbarch, int regno)
36{ 51{
37 return ((regno) >= MIPS_ZERO_REGNUM 52 return ((regno) >= MIPS_ZERO_REGNUM
38 && (regno) <= gdbarch_pc_regnum (gdbarch)); 53 && (regno) <= gdbarch_pc_regnum (gdbarch));
39} 54}
40 55
41static void 56static void
42mipsnbsd_fetch_inferior_registers (struct target_ops *ops, 57mipsnbsd_fetch_inferior_registers (struct target_ops *ops,
43 struct regcache *regcache, int regno) 58 struct regcache *regcache, int regno)
44{ 59{
45 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
46 
47 struct gdbarch *gdbarch = get_regcache_arch (regcache); 60 struct gdbarch *gdbarch = get_regcache_arch (regcache);
48 if (regno == -1 || getregs_supplies (gdbarch, regno)) 61 if (regno == -1 || getregs_supplies (gdbarch, regno))
49 { 62 {
50 struct reg regs; 63 struct reg regs;
51 64
52 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 65 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 66 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
53 perror_with_name (_("Couldn't get registers")); 67 perror_with_name (_("Couldn't get registers"));
54  68
55 mipsnbsd_supply_reg (regcache, (char *) &regs, regno); 69 mipsnbsd_supply_reg (regcache, (char *) &regs, regno);
56 if (regno != -1) 70 if (regno != -1)
57 return; 71 return;
58 } 72 }
59 73
60 if (regno == -1 74 if (regno == -1
61 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache))) 75 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
62 { 76 {
63 struct fpreg fpregs; 77 struct fpreg fpregs;
64 78
65 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 79 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 80 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
66 perror_with_name (_("Couldn't get floating point status")); 81 perror_with_name (_("Couldn't get floating point status"));
67 82
68 mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno); 83 mipsnbsd_supply_fpreg (regcache, (char *) &fpregs, regno);
69 } 84 }
70} 85}
71 86
72static void 87static void
73mipsnbsd_store_inferior_registers (struct target_ops *ops, 88mipsnbsd_store_inferior_registers (struct target_ops *ops,
74 struct regcache *regcache, int regno) 89 struct regcache *regcache, int regno)
75{ 90{
76 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
77 
78 struct gdbarch *gdbarch = get_regcache_arch (regcache); 91 struct gdbarch *gdbarch = get_regcache_arch (regcache);
79 if (regno == -1 || getregs_supplies (gdbarch, regno)) 92 if (regno == -1 || getregs_supplies (gdbarch, regno))
80 { 93 {
81 struct reg regs; 94 struct reg regs;
82 95
83 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 96 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 97 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
84 perror_with_name (_("Couldn't get registers")); 98 perror_with_name (_("Couldn't get registers"));
85 99
86 mipsnbsd_fill_reg (regcache, (char *) &regs, regno); 100 mipsnbsd_fill_reg (regcache, (char *) &regs, regno);
87 101
88 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 102 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
 103 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
89 perror_with_name (_("Couldn't write registers")); 104 perror_with_name (_("Couldn't write registers"));
90 105
91 if (regno != -1) 106 if (regno != -1)
92 return; 107 return;
93 } 108 }
94 109
95 if (regno == -1 110 if (regno == -1
96 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache))) 111 || regno >= gdbarch_fp0_regnum (get_regcache_arch (regcache)))
97 { 112 {
98 struct fpreg fpregs;  113 struct fpreg fpregs;
99 114
100 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 115 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 116 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
101 perror_with_name (_("Couldn't get floating point status")); 117 perror_with_name (_("Couldn't get floating point status"));
102 118
103 mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno); 119 mipsnbsd_fill_fpreg (regcache, (char *) &fpregs, regno);
104 120
105 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 121 if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
 122 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
106 perror_with_name (_("Couldn't write floating point status")); 123 perror_with_name (_("Couldn't write floating point status"));
107 } 124 }
108} 125}
 126
 127static int mipsnbsd_supply_pcb (struct regcache *, struct pcb *);
 128
 129static int
 130mipsnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 131{
 132 struct label_t sf;
 133
 134 sf = pcb->pcb_context;
 135
 136 /* really should test for n{32,64} abi for this register
 137 unless this is purely the "n" ABI */
 138
 139 regcache_raw_supply (regcache, MIPS_S0_REGNUM, &sf.val[_L_S0]);
 140 regcache_raw_supply (regcache, MIPS_S1_REGNUM, &sf.val[_L_S1]);
 141 regcache_raw_supply (regcache, MIPS_S2_REGNUM, &sf.val[_L_S2]);
 142 regcache_raw_supply (regcache, MIPS_S3_REGNUM, &sf.val[_L_S3]);
 143 regcache_raw_supply (regcache, MIPS_S4_REGNUM, &sf.val[_L_S4]);
 144 regcache_raw_supply (regcache, MIPS_S5_REGNUM, &sf.val[_L_S5]);
 145 regcache_raw_supply (regcache, MIPS_S6_REGNUM, &sf.val[_L_S6]);
 146 regcache_raw_supply (regcache, MIPS_S7_REGNUM, &sf.val[_L_S7]);
 147
 148 regcache_raw_supply (regcache, MIPS_S8_REGNUM, &sf.val[_L_S8]);
 149
 150 regcache_raw_supply (regcache, MIPS_T8_REGNUM, &sf.val[_L_T8]);
 151
 152 regcache_raw_supply (regcache, MIPS_GP_REGNUM, &sf.val[_L_GP]);
 153
 154 regcache_raw_supply (regcache, MIPS_SP_REGNUM, &sf.val[_L_SP]);
 155 regcache_raw_supply (regcache, MIPS_RA_REGNUM, &sf.val[_L_RA]);
 156 regcache_raw_supply (regcache, MIPS_PS_REGNUM, &sf.val[_L_SR]);
 157
 158 /* provide the return address of the savectx as the current pc */
 159 regcache_raw_supply (regcache, MIPS_EMBED_PC_REGNUM, &sf.val[_L_RA]);
 160
 161 return 0;
 162}
109  163
 164/* Wrapper functions. These are only used by nbsd-thread. */
 165void
 166supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregsetp)
 167{
 168 mipsnbsd_supply_reg (regcache, (const char *) gregsetp, -1);
 169}
 170
 171void
 172fill_gregset (const struct regcache *regcache,
 173 gdb_gregset_t *gregsetp, int regno)
 174{
 175 mipsnbsd_fill_reg (regcache, (char *) gregsetp, -1);
 176}
 177
 178void
 179supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
 180{
 181 mipsnbsd_supply_fpreg (regcache, (const char *) fpregsetp, -1);
 182}
 183
 184void
 185fill_fpregset (const struct regcache *regcache,
 186 gdb_fpregset_t *fpregsetp, int regno)
 187{
 188 mipsnbsd_fill_fpreg (regcache, (char *) fpregsetp, -1);
 189}
110 190
111/* Provide a prototype to silence -Wmissing-prototypes. */ 191/* Provide a prototype to silence -Wmissing-prototypes. */
112void _initialize_mipsnbsd_nat (void); 192void _initialize_mipsnbsd_nat (void);
113 193
114void 194void
115_initialize_mipsnbsd_nat (void) 195_initialize_mipsnbsd_nat (void)
116{ 196{
117 struct target_ops *t; 197 struct target_ops *t;
118 198
119 t = inf_ptrace_target (); 199 t = inf_ptrace_target ();
120 t->to_fetch_registers = mipsnbsd_fetch_inferior_registers; 200 t->to_fetch_registers = mipsnbsd_fetch_inferior_registers;
121 t->to_store_registers = mipsnbsd_store_inferior_registers; 201 t->to_store_registers = mipsnbsd_store_inferior_registers;
122 add_target (t); 202 add_target (t);
 203
 204 /* Support debugging kernel virtual memory images. */
 205 bsd_kvm_add_target (mipsnbsd_supply_pcb);
123} 206}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.c 2017/11/28 18:18:25 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/mips. 1/* Target-dependent code for NetBSD/mips.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "defs.h" 22#include "defs.h"
23#include "gdbcore.h" 23#include "gdbcore.h"
24#include "regcache.h" 24#include "regcache.h"
25#include "regset.h" 25#include "regset.h"
26#include "target.h" 26#include "target.h"
27#include "value.h" 27#include "value.h"
28#include "osabi.h" 28#include "osabi.h"
29 29
30#include "nbsd-tdep.h" 30#include "nbsd-tdep.h"
31#include "mips-nbsd-tdep.h" 31#include "mipsnbsd-tdep.h"
32#include "mips-tdep.h" 32#include "mips-tdep.h"
33 33
34#include "solib-svr4.h" 34#include "solib-svr4.h"
35 35
36/* Shorthand for some register numbers used below. */ 36/* Shorthand for some register numbers used below. */
37#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM 37#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM
38#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM 38#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM
39#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32 39#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32
40 40
41/* Core file support. */ 41/* Core file support. */
42 42
43/* Number of registers in `struct reg' from <machine/reg.h>. */ 43/* Number of registers in `struct reg' from <machine/reg.h>. */
44#define MIPSNBSD_NUM_GREGS 38 44#define MIPSNBSD_NUM_GREGS 38
@@ -69,35 +69,43 @@ mipsnbsd_supply_fpregset (const struct r @@ -69,35 +69,43 @@ mipsnbsd_supply_fpregset (const struct r
69 } 69 }
70} 70}
71 71
72/* Supply register REGNUM from the buffer specified by GREGS and LEN 72/* Supply register REGNUM from the buffer specified by GREGS and LEN
73 in the general-purpose register set REGSET to register cache 73 in the general-purpose register set REGSET to register cache
74 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ 74 REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
75 75
76static void 76static void
77mipsnbsd_supply_gregset (const struct regset *regset, 77mipsnbsd_supply_gregset (const struct regset *regset,
78 struct regcache *regcache, int regnum, 78 struct regcache *regcache, int regnum,
79 const void *gregs, size_t len) 79 const void *gregs, size_t len)
80{ 80{
81 size_t regsize = mips_isa_regsize (get_regcache_arch (regcache)); 81 size_t regsize = mips_isa_regsize (get_regcache_arch (regcache));
 82 char zerobuf[MAX_REGISTER_SIZE];
82 const char *regs = (const char *) gregs; 83 const char *regs = (const char *) gregs;
83 int i; 84 int i;
84 85
 86 memset (zerobuf, 0, MAX_REGISTER_SIZE);
 87
85 gdb_assert (len >= MIPSNBSD_NUM_GREGS * regsize); 88 gdb_assert (len >= MIPSNBSD_NUM_GREGS * regsize);
86 89
87 for (i = 0; i <= MIPS_PC_REGNUM; i++) 90 for (i = 0; i <= MIPS_PC_REGNUM; i++)
88 { 91 {
89 if (regnum == i || regnum == -1) 92 if (regnum == i || regnum == -1)
90 regcache_raw_supply (regcache, i, regs + i * regsize); 93 {
 94 if (i == MIPS_ZERO_REGNUM || i == MIPS_UNUSED_REGNUM)
 95 regcache_raw_supply (regcache, i, zerobuf);
 96 else
 97 regcache_raw_supply (regcache, i, regs + i * regsize);
 98 }
91 } 99 }
92 100
93 if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * regsize) 101 if (len >= (MIPSNBSD_NUM_GREGS + MIPSNBSD_NUM_FPREGS) * regsize)
94 { 102 {
95 regs += MIPSNBSD_NUM_GREGS * regsize; 103 regs += MIPSNBSD_NUM_GREGS * regsize;
96 len -= MIPSNBSD_NUM_GREGS * regsize; 104 len -= MIPSNBSD_NUM_GREGS * regsize;
97 mipsnbsd_supply_fpregset (regset, regcache, regnum, regs, len); 105 mipsnbsd_supply_fpregset (regset, regcache, regnum, regs, len);
98 } 106 }
99} 107}
100 108
101/* NetBSD/mips register sets. */ 109/* NetBSD/mips register sets. */
102 110
103static const struct regset mipsnbsd_gregset = 111static const struct regset mipsnbsd_gregset =
@@ -128,33 +136,38 @@ mipsnbsd_iterate_over_regset_sections (s @@ -128,33 +136,38 @@ mipsnbsd_iterate_over_regset_sections (s
128 NULL, cb_data); 136 NULL, cb_data);
129 cb (".reg2", MIPSNBSD_NUM_FPREGS * regsize, &mipsnbsd_fpregset, 137 cb (".reg2", MIPSNBSD_NUM_FPREGS * regsize, &mipsnbsd_fpregset,
130 NULL, cb_data); 138 NULL, cb_data);
131} 139}
132  140
133 141
134/* Conveniently, GDB uses the same register numbering as the 142/* Conveniently, GDB uses the same register numbering as the
135 ptrace register structure used by NetBSD/mips. */ 143 ptrace register structure used by NetBSD/mips. */
136 144
137void 145void
138mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno) 146mipsnbsd_supply_reg (struct regcache *regcache, const char *regs, int regno)
139{ 147{
140 struct gdbarch *gdbarch = get_regcache_arch (regcache); 148 struct gdbarch *gdbarch = get_regcache_arch (regcache);
 149 char zerobuf[MAX_REGISTER_SIZE];
141 int i; 150 int i;
142 151
 152 memset (zerobuf, 0, MAX_REGISTER_SIZE);
 153
143 for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++) 154 for (i = 0; i <= gdbarch_pc_regnum (gdbarch); i++)
144 { 155 {
145 if (regno == i || regno == -1) 156 if (regno == i || regno == -1)
146 { 157 {
147 if (gdbarch_cannot_fetch_register (gdbarch, i)) 158 if (i == MIPS_ZERO_REGNUM || i == MIPS_UNUSED_REGNUM)
 159 regcache_raw_supply (regcache, i, zerobuf);
 160 else if (gdbarch_cannot_fetch_register (gdbarch, i))
148 regcache_raw_supply (regcache, i, NULL); 161 regcache_raw_supply (regcache, i, NULL);
149 else 162 else
150 regcache_raw_supply (regcache, i, 163 regcache_raw_supply (regcache, i,
151 regs + (i * mips_isa_regsize (gdbarch))); 164 regs + (i * mips_isa_regsize (gdbarch)));
152 } 165 }
153 } 166 }
154} 167}
155 168
156void 169void
157mipsnbsd_fill_reg (const struct regcache *regcache, char *regs, int regno) 170mipsnbsd_fill_reg (const struct regcache *regcache, char *regs, int regno)
158{ 171{
159 struct gdbarch *gdbarch = get_regcache_arch (regcache); 172 struct gdbarch *gdbarch = get_regcache_arch (regcache);
160 int i; 173 int i;

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.h (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.h 2017/11/28 18:18:11 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/mips-nbsd-tdep.h 2017/11/29 03:35:15 1.2
@@ -1,29 +1,29 @@ @@ -1,29 +1,29 @@
1/* Common target dependent code for GDB on MIPS systems running NetBSD. 1/* Common target dependent code for GDB on MIPS systems running NetBSD.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#ifndef MIPS_NBSD_TDEP_H 20#ifndef MIPSNBSD_TDEP_H
21#define MIPS_NBSD_TDEP_H 21#define MIPSNBSD_TDEP_H
22 22
23void mipsnbsd_supply_reg (struct regcache *, const char *, int); 23void mipsnbsd_supply_reg (struct regcache *, const char *, int);
24void mipsnbsd_fill_reg (const struct regcache *, char *, int); 24void mipsnbsd_fill_reg (const struct regcache *, char *, int);
25 25
26void mipsnbsd_supply_fpreg (struct regcache *, const char *, int); 26void mipsnbsd_supply_fpreg (struct regcache *, const char *, int);
27void mipsnbsd_fill_fpreg (const struct regcache *, char *, int); 27void mipsnbsd_fill_fpreg (const struct regcache *, char *, int);
28 28
29#endif /* MIPS_NBSD_TDEP_H */ 29#endif /* MIPSNBSD_TDEP_H */

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c 2017/11/28 18:18:13 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,51 +1,65 @@ @@ -1,51 +1,65 @@
1/* Native-dependent code for NetBSD/powerpc. 1/* Native-dependent code for NetBSD/powerpc.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
 22#define _KMEMUSER
22#include "defs.h" 23#include "defs.h"
23 24
24#include <sys/types.h> 25#include <sys/types.h>
25#include <sys/ptrace.h> 26#include <sys/ptrace.h>
26#include <machine/reg.h> 27#include <machine/reg.h>
27#include <machine/frame.h> 28#include <machine/frame.h>
28#include <machine/pcb.h> 29#include <machine/pcb.h>
29 30
30#include "gdbcore.h" 31#include "gdbcore.h"
31#include "inferior.h" 32#include "inferior.h"
32#include "regcache.h" 33#include "regcache.h"
33 34
 35#include "gdb_assert.h"
 36
 37#include "nbsd-nat.h"
34#include "ppc-tdep.h" 38#include "ppc-tdep.h"
35#include "ppc-nbsd-tdep.h" 39#include "ppcnbsd-tdep.h"
36#include "bsd-kvm.h" 40#include "bsd-kvm.h"
37#include "inf-ptrace.h" 41#include "inf-ptrace.h"
38 42
 43#ifndef HAVE_GREGSET_T
 44typedef struct reg gregset_t;
 45#endif
 46
 47#ifndef HAVE_FPREGSET_T
 48typedef struct fpreg fpregset_t;
 49#endif
 50#include "gregset.h"
 51
 52
39/* Returns true if PT_GETREGS fetches this register. */ 53/* Returns true if PT_GETREGS fetches this register. */
40 54
41static int 55static int
42getregs_supplies (struct gdbarch *gdbarch, int regnum) 56getregs_supplies (struct gdbarch *gdbarch, int regnum)
43{ 57{
44 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 58 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
45 59
46 return ((regnum >= tdep->ppc_gp0_regnum 60 return ((regnum >= tdep->ppc_gp0_regnum
47 && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs) 61 && regnum < tdep->ppc_gp0_regnum + ppc_num_gprs)
48 || regnum == tdep->ppc_lr_regnum 62 || regnum == tdep->ppc_lr_regnum
49 || regnum == tdep->ppc_cr_regnum 63 || regnum == tdep->ppc_cr_regnum
50 || regnum == tdep->ppc_xer_regnum 64 || regnum == tdep->ppc_xer_regnum
51 || regnum == tdep->ppc_ctr_regnum 65 || regnum == tdep->ppc_ctr_regnum
@@ -71,123 +85,160 @@ getfpregs_supplies (struct gdbarch *gdba @@ -71,123 +85,160 @@ getfpregs_supplies (struct gdbarch *gdba
71 combination to the problem. */ 85 combination to the problem. */
72 gdb_assert (ppc_floating_point_unit_p (gdbarch)); 86 gdb_assert (ppc_floating_point_unit_p (gdbarch));
73 87
74 return ((regnum >= tdep->ppc_fp0_regnum 88 return ((regnum >= tdep->ppc_fp0_regnum
75 && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs) 89 && regnum < tdep->ppc_fp0_regnum + ppc_num_fprs)
76 || regnum == tdep->ppc_fpscr_regnum); 90 || regnum == tdep->ppc_fpscr_regnum);
77} 91}
78 92
79static void 93static void
80ppcnbsd_fetch_inferior_registers (struct target_ops *ops, 94ppcnbsd_fetch_inferior_registers (struct target_ops *ops,
81 struct regcache *regcache, int regnum) 95 struct regcache *regcache, int regnum)
82{ 96{
83 struct gdbarch *gdbarch = get_regcache_arch (regcache); 97 struct gdbarch *gdbarch = get_regcache_arch (regcache);
84 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
85 98
86 if (regnum == -1 || getregs_supplies (gdbarch, regnum)) 99 if (regnum == -1 || getregs_supplies (gdbarch, regnum))
87 { 100 {
88 struct reg regs; 101 struct reg regs;
89 102
90 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 103 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 104 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
91 perror_with_name (_("Couldn't get registers")); 105 perror_with_name (_("Couldn't get registers"));
92 106
93 ppc_supply_gregset (&ppcnbsd_gregset, regcache, 107 ppc_supply_gregset (&ppcnbsd_gregset, regcache,
94 regnum, &regs, sizeof regs); 108 regnum, &regs, sizeof regs);
95 } 109 }
96 110
97 if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) 111 if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
98 { 112 {
99 struct fpreg fpregs; 113 struct fpreg fpregs;
100 114
101 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 115 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 116 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
102 perror_with_name (_("Couldn't get FP registers")); 117 perror_with_name (_("Couldn't get FP registers"));
103 118
104 ppc_supply_fpregset (&ppcnbsd_fpregset, regcache, 119 ppc_supply_fpregset (&ppcnbsd_fpregset, regcache,
105 regnum, &fpregs, sizeof fpregs); 120 regnum, &fpregs, sizeof fpregs);
106 } 121 }
107} 122}
108 123
109static void 124static void
110ppcnbsd_store_inferior_registers (struct target_ops *ops, 125ppcnbsd_store_inferior_registers (struct target_ops *ops,
111 struct regcache *regcache, int regnum) 126 struct regcache *regcache, int regnum)
112{ 127{
113 struct gdbarch *gdbarch = get_regcache_arch (regcache); 128 struct gdbarch *gdbarch = get_regcache_arch (regcache);
114 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
115 129
116 if (regnum == -1 || getregs_supplies (gdbarch, regnum)) 130 if (regnum == -1 || getregs_supplies (gdbarch, regnum))
117 { 131 {
118 struct reg regs; 132 struct reg regs;
119 133
120 if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 134 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 135 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
121 perror_with_name (_("Couldn't get registers")); 136 perror_with_name (_("Couldn't get registers"));
122 137
123 ppc_collect_gregset (&ppcnbsd_gregset, regcache, 138 ppc_collect_gregset (&ppcnbsd_gregset, regcache,
124 regnum, &regs, sizeof regs); 139 regnum, &regs, sizeof regs);
125 140
126 if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) &regs, 0) == -1) 141 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
 142 (PTRACE_TYPE_ARG3) &regs, ptid_get_lwp (inferior_ptid)) == -1)
127 perror_with_name (_("Couldn't write registers")); 143 perror_with_name (_("Couldn't write registers"));
128 } 144 }
129 145
130 if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) 146 if (regnum == -1 || getfpregs_supplies (gdbarch, regnum))
131 { 147 {
132 struct fpreg fpregs; 148 struct fpreg fpregs;
133 149
134 if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 150 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 151 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
135 perror_with_name (_("Couldn't get FP registers")); 152 perror_with_name (_("Couldn't get FP registers"));
136 153
137 ppc_collect_fpregset (&ppcnbsd_fpregset, regcache, 154 ppc_collect_fpregset (&ppcnbsd_fpregset, regcache,
138 regnum, &fpregs, sizeof fpregs); 155 regnum, &fpregs, sizeof fpregs);
139 156
140 if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) 157 if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
 158 (PTRACE_TYPE_ARG3) &fpregs, ptid_get_lwp (inferior_ptid)) == -1)
141 perror_with_name (_("Couldn't set FP registers")); 159 perror_with_name (_("Couldn't set FP registers"));
142 } 160 }
143} 161}
144 162
 163void
 164supply_gregset (struct regcache *regcache, const gregset_t *gregs)
 165{
 166 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
 167 (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1)
 168 perror_with_name (_("Couldn't write registers"));
 169}
 170
 171void
 172supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs)
 173{
 174 if (ptrace (PT_SETFPREGS, ptid_get_pid (inferior_ptid),
 175 (PTRACE_TYPE_ARG3) fpregs, ptid_get_lwp (inferior_ptid)) == -1)
 176 perror_with_name (_("Couldn't set FP registers"));
 177}
 178
 179void
 180fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum)
 181{
 182 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 183 (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1)
 184 perror_with_name (_("Couldn't get registers"));
 185}
 186
 187void
 188fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum)
 189{
 190 if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid),
 191 (PTRACE_TYPE_ARG3) fpregs, ptid_get_lwp (inferior_ptid)) == -1)
 192 perror_with_name (_("Couldn't get FP registers"));
 193}
 194
145static int 195static int
146ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 196ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
147{ 197{
148 struct switchframe sf; 198 struct switchframe sf;
149 struct callframe cf; 199 struct callframe cf;
150 struct gdbarch *gdbarch = get_regcache_arch (regcache); 200 struct gdbarch *gdbarch = get_regcache_arch (regcache);
151 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 201 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
152 int i; 202 int i;
153 203
154 /* The stack pointer shouldn't be zero. */ 204 /* The stack pointer shouldn't be zero. */
155 if (pcb->pcb_sp == 0) 205 if (pcb->pcb_sp == 0)
156 return 0; 206 return 0;
157 207
158 read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf); 208 read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf);
159 regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr); 209 regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.sf_cr);
160 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2); 210 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.sf_fixreg2);
161 for (i = 0 ; i < 19 ; i++) 211 for (i = 0 ; i < 19 ; i++)
162 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 13 + i, 212 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 13 + i,
163 &sf.fixreg[i]); 213 &sf.sf_fixreg[i]);
164 214
165 read_memory(sf.sp, (gdb_byte *)&cf, sizeof(cf)); 215 read_memory(sf.sf_sp, (gdb_byte *)&cf, sizeof(cf));
166 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30); 216 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.cf_r30);
167 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31); 217 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.cf_r31);
168 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 1, &cf.sp); 218 regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 1, &cf.cf_sp);
169 219
170 read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf)); 220 read_memory(cf.cf_sp, (gdb_byte *)&cf, sizeof(cf));
171 regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.lr); 221 regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.cf_lr);
172 regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr); 222 regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.cf_lr);
173 223
174 return 1; 224 return 1;
175} 225}
176 226
177/* Provide a prototype to silence -Wmissing-prototypes. */ 227/* Provide a prototype to silence -Wmissing-prototypes. */
178void _initialize_ppcnbsd_nat (void); 228void _initialize_ppcnbsd_nat (void);
179 229
180void 230void
181_initialize_ppcnbsd_nat (void) 231_initialize_ppcnbsd_nat (void)
182{ 232{
183 struct target_ops *t; 233 struct target_ops *t;
184 234
185 /* Support debugging kernel virtual memory images. */ 235 /* Support debugging kernel virtual memory images. */
186 bsd_kvm_add_target (ppcnbsd_supply_pcb); 236 bsd_kvm_add_target (ppcnbsd_supply_pcb);
187 237
188 /* Add in local overrides. */ 238 /* Add in local overrides. */
189 t = inf_ptrace_target (); 239 t = inf_ptrace_target ();
190 t->to_fetch_registers = ppcnbsd_fetch_inferior_registers; 240 t->to_fetch_registers = ppcnbsd_fetch_inferior_registers;
191 t->to_store_registers = ppcnbsd_store_inferior_registers; 241 t->to_store_registers = ppcnbsd_store_inferior_registers;
 242 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
192 add_target (t); 243 add_target (t);
193} 244}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.c 2017/11/28 18:18:03 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/powerpc. 1/* Target-dependent code for NetBSD/powerpc.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "defs.h" 22#include "defs.h"
23#include "gdbtypes.h" 23#include "gdbtypes.h"
24#include "osabi.h" 24#include "osabi.h"
25#include "regcache.h" 25#include "regcache.h"
26#include "regset.h" 26#include "regset.h"
27#include "trad-frame.h" 27#include "trad-frame.h"
28#include "tramp-frame.h" 28#include "tramp-frame.h"
29 29
30#include "ppc-tdep.h" 30#include "ppc-tdep.h"
31#include "ppc-nbsd-tdep.h" 31#include "ppcnbsd-tdep.h"
32#include "solib-svr4.h" 32#include "solib-svr4.h"
33 33
34/* Register offsets from <machine/reg.h>. */ 34/* Register offsets from <machine/reg.h>. */
35struct ppc_reg_offsets ppcnbsd_reg_offsets; 35struct ppc_reg_offsets ppcnbsd_reg_offsets;
36  36
37 37
38/* Core file support. */ 38/* Core file support. */
39 39
40/* NetBSD/powerpc register sets. */ 40/* NetBSD/powerpc register sets. */
41 41
42const struct regset ppcnbsd_gregset = 42const struct regset ppcnbsd_gregset =
43{ 43{
44 &ppcnbsd_reg_offsets, 44 &ppcnbsd_reg_offsets,
@@ -189,27 +189,27 @@ ppcnbsd_init_abi (struct gdbarch_info in @@ -189,27 +189,27 @@ ppcnbsd_init_abi (struct gdbarch_info in
189} 189}
190  190
191 191
192/* Provide a prototype to silence -Wmissing-prototypes. */ 192/* Provide a prototype to silence -Wmissing-prototypes. */
193void _initialize_ppcnbsd_tdep (void); 193void _initialize_ppcnbsd_tdep (void);
194 194
195void 195void
196_initialize_ppcnbsd_tdep (void) 196_initialize_ppcnbsd_tdep (void)
197{ 197{
198 gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_NETBSD, 198 gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_NETBSD,
199 ppcnbsd_init_abi); 199 ppcnbsd_init_abi);
200 200
201 /* Avoid initializing the register offsets again if they were 201 /* Avoid initializing the register offsets again if they were
202 already initialized by ppcnbsd-nat.c. */ 202 already initailized by ppcnbsd-nat.c. */
203 if (ppcnbsd_reg_offsets.pc_offset == 0) 203 if (ppcnbsd_reg_offsets.pc_offset == 0)
204 { 204 {
205 /* General-purpose registers. */ 205 /* General-purpose registers. */
206 ppcnbsd_reg_offsets.r0_offset = 0; 206 ppcnbsd_reg_offsets.r0_offset = 0;
207 ppcnbsd_reg_offsets.gpr_size = 4; 207 ppcnbsd_reg_offsets.gpr_size = 4;
208 ppcnbsd_reg_offsets.xr_size = 4; 208 ppcnbsd_reg_offsets.xr_size = 4;
209 ppcnbsd_reg_offsets.lr_offset = 128; 209 ppcnbsd_reg_offsets.lr_offset = 128;
210 ppcnbsd_reg_offsets.cr_offset = 132; 210 ppcnbsd_reg_offsets.cr_offset = 132;
211 ppcnbsd_reg_offsets.xer_offset = 136; 211 ppcnbsd_reg_offsets.xer_offset = 136;
212 ppcnbsd_reg_offsets.ctr_offset = 140; 212 ppcnbsd_reg_offsets.ctr_offset = 140;
213 ppcnbsd_reg_offsets.pc_offset = 144; 213 ppcnbsd_reg_offsets.pc_offset = 144;
214 ppcnbsd_reg_offsets.ps_offset = -1; 214 ppcnbsd_reg_offsets.ps_offset = -1;
215 ppcnbsd_reg_offsets.mq_offset = -1; 215 ppcnbsd_reg_offsets.mq_offset = -1;

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.h (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.h 2017/11/28 18:18:13 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/ppc-nbsd-tdep.h 2017/11/29 03:35:15 1.2
@@ -1,32 +1,32 @@ @@ -1,32 +1,32 @@
1/* Target-dependent code for NetBSD/powerpc. 1/* Target-dependent code for NetBSD/powerpc.
2 2
3 Copyright (C) 2004-2017 Free Software Foundation, Inc. 3 Copyright (C) 2004-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#ifndef PPC_NBSD_TDEP_H 20#ifndef PPCNBSD_TDEP_H
21#define PPC_NBSD_TDEP_H 21#define PPCNBSD_TDEP_H
22 22
23struct regset; 23struct regset;
24 24
25/* Register offsets for NetBSD/powerpc. */ 25/* Register offsets for NetBSD/powerpc. */
26extern struct ppc_reg_offsets ppcnbsd_reg_offsets; 26extern struct ppc_reg_offsets ppcnbsd_reg_offsets;
27 27
28/* Register sets for NetBSD/powerpc. */ 28/* Register sets for NetBSD/powerpc. */
29extern const struct regset ppcnbsd_gregset; 29extern const struct regset ppcnbsd_gregset;
30extern const struct regset ppcnbsd_fpregset; 30extern const struct regset ppcnbsd_fpregset;
31 31
32#endif /* ppc-nbsd-tdep.h */ 32#endif /* ppcnbsd-tdep.h */

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c 2017/11/28 18:18:11 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sh-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Native-dependent code for NetBSD/sh. 1/* Native-dependent code for NetBSD/sh.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -19,88 +19,113 @@ @@ -19,88 +19,113 @@
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "defs.h" 22#include "defs.h"
23#include "inferior.h" 23#include "inferior.h"
24 24
25#include <sys/types.h> 25#include <sys/types.h>
26#include <sys/ptrace.h> 26#include <sys/ptrace.h>
27#include <machine/reg.h> 27#include <machine/reg.h>
28 28
29#include "sh-tdep.h" 29#include "sh-tdep.h"
30#include "inf-ptrace.h" 30#include "inf-ptrace.h"
31#include "regcache.h" 31#include "regcache.h"
 32#include "inf-ptrace.h"
32 33
 34#include "nbsd-nat.h"
33 35
 36#ifndef HAVE_GREGSET_T
 37typedef struct reg gregset_t;
 38#endif
 39
 40#ifndef HAVE_FPREGSET_T
 41struct fpreg { };
 42typedef struct fpreg fpregset_t;
 43#endif
 44#include "gregset.h"
 45
34/* Determine if PT_GETREGS fetches this register. */ 46/* Determine if PT_GETREGS fetches this register. */
35#define GETREGS_SUPPLIES(gdbarch, regno) \ 47#define GETREGS_SUPPLIES(gdbarch, regno) \
36 (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \ 48 (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \
37|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \ 49|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \
38|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \ 50|| (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \
39|| (regno) == SR_REGNUM) 51|| (regno) == SR_REGNUM || (regno) == GBR_REGNUM)
40 52
41/* Sizeof `struct reg' in <machine/reg.h>. */ 53/* Sizeof `struct reg' in <machine/reg.h>. */
42#define SHNBSD_SIZEOF_GREGS (21 * 4) 54#define SHNBSD_SIZEOF_GREGS (22 * 4)
43 55
44static void 56static void
45shnbsd_fetch_inferior_registers (struct target_ops *ops, 57shnbsd_fetch_inferior_registers (struct target_ops *ops,
46 struct regcache *regcache, int regno) 58 struct regcache *regcache, int regno)
47{ 59{
48 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
49 
50 if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno)) 60 if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
51 { 61 {
52 struct reg inferior_registers; 62 struct reg inferior_registers;
53 63
54 if (ptrace (PT_GETREGS, pid, 64 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
55 (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) 65 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1)
56 perror_with_name (_("Couldn't get registers")); 66 perror_with_name (_("Couldn't get registers"));
57 67
58 sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno, 68 sh_corefile_supply_regset (&sh_corefile_gregset, regcache, regno,
59 (char *) &inferior_registers, 69 (char *) &inferior_registers,
60 SHNBSD_SIZEOF_GREGS); 70 SHNBSD_SIZEOF_GREGS);
61 71
62 if (regno != -1) 72 if (regno != -1)
63 return; 73 return;
64 } 74 }
65} 75}
66 76
67static void 77static void
68shnbsd_store_inferior_registers (struct target_ops *ops, 78shnbsd_store_inferior_registers (struct target_ops *ops,
69 struct regcache *regcache, int regno) 79 struct regcache *regcache, int regno)
70{ 80{
71 pid_t pid = ptid_get_pid (regcache_get_ptid (regcache)); 
72 
73 if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno)) 81 if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno))
74 { 82 {
75 struct reg inferior_registers; 83 struct reg inferior_registers;
76 84
77 if (ptrace (PT_GETREGS, pid, 85 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
78 (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) 86 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1)
79 perror_with_name (_("Couldn't get registers")); 87 perror_with_name (_("Couldn't get registers"));
80 88
81 sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno, 89 sh_corefile_collect_regset (&sh_corefile_gregset, regcache, regno,
82 (char *) &inferior_registers, 90 (char *) &inferior_registers,
83 SHNBSD_SIZEOF_GREGS); 91 SHNBSD_SIZEOF_GREGS);
84 92
85 if (ptrace (PT_SETREGS, pid, 93 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
86 (PTRACE_TYPE_ARG3) &inferior_registers, 0) == -1) 94 (PTRACE_TYPE_ARG3) &inferior_registers, ptid_get_lwp (inferior_ptid)) == -1)
87 perror_with_name (_("Couldn't set registers")); 95 perror_with_name (_("Couldn't set registers"));
88 96
89 if (regno != -1) 97 if (regno != -1)
90 return; 98 return;
91 } 99 }
92} 100}
93 101
 102void
 103supply_gregset (struct regcache *regcache, const gregset_t *gregs)
 104{
 105 if (ptrace (PT_SETREGS, ptid_get_pid (inferior_ptid),
 106 (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1)
 107 perror_with_name (_("Couldn't set registers"));
 108}
 109
 110void
 111fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum)
 112{
 113 if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid),
 114 (PTRACE_TYPE_ARG3) gregs, ptid_get_lwp (inferior_ptid)) == -1)
 115 perror_with_name (_("Couldn't get registers"));
 116}
 117
94/* Provide a prototype to silence -Wmissing-prototypes. */ 118/* Provide a prototype to silence -Wmissing-prototypes. */
95void _initialize_shnbsd_nat (void); 119void _initialize_shnbsd_nat (void);
96 120
97void 121void
98_initialize_shnbsd_nat (void) 122_initialize_shnbsd_nat (void)
99{ 123{
100 struct target_ops *t; 124 struct target_ops *t;
101 125
102 t = inf_ptrace_target (); 126 t = inf_ptrace_target ();
103 t->to_fetch_registers = shnbsd_fetch_inferior_registers; 127 t->to_fetch_registers = shnbsd_fetch_inferior_registers;
104 t->to_store_registers = shnbsd_store_inferior_registers; 128 t->to_store_registers = shnbsd_store_inferior_registers;
 129 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
105 add_target (t); 130 add_target (t);
106} 131}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c 2017/11/28 18:18:06 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,84 +1,241 @@ @@ -1,84 +1,241 @@
1/* Target-dependent code for NetBSD/sh. 1/* Target-dependent code for NetBSD/sh.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 Contributed by Wasabi Systems, Inc. 5 Contributed by Wasabi Systems, Inc.
6 6
7 This file is part of GDB. 7 This file is part of GDB.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or 11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14 This program is distributed in the hope that it will be useful, 14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details. 17 GNU General Public License for more details.
18 18
19 You should have received a copy of the GNU General Public License 19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 20 along with this program; if not, write to the Free Software
 21 Foundation, Inc., 51 Franklin Street, Fifth Floor,
 22 Boston, MA 02110-1301, USA. */
21 23
22#include "defs.h" 24#include "defs.h"
23#include "gdbcore.h" 25#include "gdbcore.h"
 26#include "inferior.h"
 27#include "regcache.h"
24#include "regset.h" 28#include "regset.h"
25#include "value.h" 29#include "value.h"
26#include "osabi.h" 30#include "osabi.h"
27 31
28#include "sh-tdep.h" 32#include "trad-frame.h"
 33#include "tramp-frame.h"
 34
 35#include "gdb_assert.h"
 36
29#include "solib-svr4.h" 37#include "solib-svr4.h"
30 38
 39#include "sh-tdep.h"
 40#include "shnbsd-tdep.h"
 41#include "nbsd-tdep.h"
 42
31/* Convert a register number into an offset into a ptrace 43/* Convert a register number into an offset into a ptrace
32 register structure. */ 44 register structure. */
33static const struct sh_corefile_regmap regmap[] = 45static const struct sh_corefile_regmap gregs_table[] =
34{ 46{
35 {R0_REGNUM, 20 * 4}, 47 {R0_REGNUM, 20 * 4},
36 {R0_REGNUM + 1, 19 * 4}, 48 {R0_REGNUM + 1, 19 * 4},
37 {R0_REGNUM + 2, 18 * 4}, 49 {R0_REGNUM + 2, 18 * 4},
38 {R0_REGNUM + 3, 17 * 4}, 50 {R0_REGNUM + 3, 17 * 4},
39 {R0_REGNUM + 4, 16 * 4}, 51 {R0_REGNUM + 4, 16 * 4},
40 {R0_REGNUM + 5, 15 * 4}, 52 {R0_REGNUM + 5, 15 * 4},
41 {R0_REGNUM + 6, 14 * 4}, 53 {R0_REGNUM + 6, 14 * 4},
42 {R0_REGNUM + 7, 13 * 4}, 54 {R0_REGNUM + 7, 13 * 4},
43 {R0_REGNUM + 8, 12 * 4}, 55 {R0_REGNUM + 8, 12 * 4},
44 {R0_REGNUM + 9, 11 * 4}, 56 {R0_REGNUM + 9, 11 * 4},
45 {R0_REGNUM + 10, 10 * 4}, 57 {R0_REGNUM + 10, 10 * 4},
46 {R0_REGNUM + 11, 9 * 4}, 58 {R0_REGNUM + 11, 9 * 4},
47 {R0_REGNUM + 12, 8 * 4}, 59 {R0_REGNUM + 12, 8 * 4},
48 {R0_REGNUM + 13, 7 * 4}, 60 {R0_REGNUM + 13, 7 * 4},
49 {R0_REGNUM + 14, 6 * 4}, 61 {R0_REGNUM + 14, 6 * 4},
50 {R0_REGNUM + 15, 5 * 4}, 62 {R0_REGNUM + 15, 5 * 4},
51 {PC_REGNUM, 0 * 4}, 63 {PC_REGNUM, 0 * 4},
52 {SR_REGNUM, 1 * 4}, 64 {SR_REGNUM, 1 * 4},
53 {PR_REGNUM, 2 * 4}, 65 {PR_REGNUM, 2 * 4},
54 {MACH_REGNUM, 3 * 4}, 66 {MACH_REGNUM, 3 * 4},
55 {MACL_REGNUM, 4 * 4}, 67 {MACL_REGNUM, 4 * 4},
 68 {GBR_REGNUM, 21 * 4},
56 {-1 /* Terminator. */, 0} 69 {-1 /* Terminator. */, 0}
57}; 70};
 71
 72
 73#define REGSx16(base) \
 74 {(base), 0}, \
 75 {(base) + 1, 4}, \
 76 {(base) + 2, 8}, \
 77 {(base) + 3, 12}, \
 78 {(base) + 4, 16}, \
 79 {(base) + 5, 20}, \
 80 {(base) + 6, 24}, \
 81 {(base) + 7, 28}, \
 82 {(base) + 8, 32}, \
 83 {(base) + 9, 36}, \
 84 {(base) + 10, 40}, \
 85 {(base) + 11, 44}, \
 86 {(base) + 12, 48}, \
 87 {(base) + 13, 52}, \
 88 {(base) + 14, 56}, \
 89 {(base) + 15, 60}
 90
 91/* Convert an FPU register number into an offset into a ptrace
 92 register structure. */
 93static const struct sh_corefile_regmap fpregs_table[] =
 94{
 95 REGSx16 (FR0_REGNUM),
 96 /* XXX: REGSx16(XF0_REGNUM) omitted. */
 97 {FPSCR_REGNUM, 128},
 98 {FPUL_REGNUM, 132},
 99 {-1 /* Terminator. */, 0}
 100};
 101
 102
 103/* From <machine/mcontext.h>. */
 104static const int shnbsd_mc_reg_offset[] =
 105{
 106 (20 * 4), /* r0 */
 107 (19 * 4), /* r1 */
 108 (18 * 4), /* r2 */
 109 (17 * 4), /* r3 */
 110 (16 * 4), /* r4 */
 111 (15 * 4), /* r5 */
 112 (14 * 4), /* r6 */
 113 (13 * 4), /* r7 */
 114 (12 * 4), /* r8 */
 115 (11 * 4), /* r9 */
 116 (10 * 4), /* r10 */
 117 ( 9 * 4), /* r11 */
 118 ( 8 * 4), /* r12 */
 119 ( 7 * 4), /* r13 */
 120 ( 6 * 4), /* r14 */
 121 (21 * 4), /* r15/sp */
 122 ( 1 * 4), /* pc */
 123 ( 5 * 4), /* pr */
 124 ( 0 * 4), /* gbr */
 125 -1,
 126 ( 4 * 4), /* mach */
 127 ( 3 * 4), /* macl */
 128 ( 2 * 4), /* sr */
 129};
 130
 131/* SH register sets. */
 132
58  133
 134static void
 135shnbsd_sigtramp_cache_init (const struct tramp_frame *,
 136 struct frame_info *,
 137 struct trad_frame_cache *,
 138 CORE_ADDR);
 139
 140/* The siginfo signal trampoline for NetBSD/sh3 versions 2.0 and later */
 141static const struct tramp_frame shnbsd_sigtramp_si2 =
 142{
 143 SIGTRAMP_FRAME,
 144 2,
 145 {
 146 { 0x64f3, -1 }, /* mov r15,r4 */
 147 { 0xd002, -1 }, /* mov.l .LSYS_setcontext */
 148 { 0xc380, -1 }, /* trapa #-128 */
 149 { 0xa003, -1 }, /* bra .Lskip1 */
 150 { 0x0009, -1 }, /* nop */
 151 { 0x0009, -1 }, /* nop */
 152 /* .LSYS_setcontext */
 153 { 0x0134, -1 }, { 0x0000, -1 }, /* 0x134 */
 154 /* .Lskip1 */
 155 { 0x6403, -1 }, /* mov r0,r4 */
 156 { 0xd002, -1 }, /* mov.l .LSYS_exit */
 157 { 0xc380, -1 }, /* trapa #-128 */
 158 { 0xa003, -1 }, /* bra .Lskip2 */
 159 { 0x0009, -1 }, /* nop */
 160 { 0x0009, -1 }, /* nop */
 161 /* .LSYS_exit */
 162 { 0x0001, -1 }, { 0x0000, -1 }, /* 0x1 */
 163/* .Lskip2 */
 164 { TRAMP_SENTINEL_INSN, -1 }
 165 },
 166 shnbsd_sigtramp_cache_init
 167};
 168
 169static void
 170shnbsd_sigtramp_cache_init (const struct tramp_frame *self,
 171 struct frame_info *next_frame,
 172 struct trad_frame_cache *this_cache,
 173 CORE_ADDR func)
 174{
 175 struct gdbarch *gdbarch = get_frame_arch (next_frame);
 176 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 177 int sp_regnum = gdbarch_sp_regnum (gdbarch);
 178 CORE_ADDR sp = get_frame_register_unsigned (next_frame, sp_regnum);
 179 CORE_ADDR base;
 180 const int *reg_offset;
 181 int num_regs;
 182 int i;
 183
 184 reg_offset = shnbsd_mc_reg_offset;
 185 num_regs = ARRAY_SIZE (shnbsd_mc_reg_offset);
 186 /* SP already points at the ucontext. */
 187 base = sp;
 188 /* offsetof(ucontext_t, uc_mcontext) == 36 */
 189 base += 36;
 190
 191 for (i = 0; i < num_regs; i++)
 192 if (reg_offset[i] != -1)
 193 trad_frame_set_reg_addr (this_cache, i, base + reg_offset[i]);
 194
 195 /* Construct the frame ID using the function start. */
 196 trad_frame_set_id (this_cache, frame_id_build (sp, func));
 197}
59 198
60static void 199static void
61shnbsd_init_abi (struct gdbarch_info info, 200shnbsd_init_abi (struct gdbarch_info info,
62 struct gdbarch *gdbarch) 201 struct gdbarch *gdbarch)
63{ 202{
64 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 203 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
65 204
66 tdep->core_gregmap = (struct sh_corefile_regmap *)regmap; 205 tdep->core_gregmap = (struct sh_corefile_regmap *)gregs_table;
67 tdep->sizeof_gregset = 84; 206 tdep->sizeof_gregset = 88;
 207
 208 tdep->core_fpregmap = (struct sh_corefile_regmap *)fpregs_table;
 209 tdep->sizeof_fpregset = 0; /* XXX */
68 210
69 set_solib_svr4_fetch_link_map_offsets 211 set_solib_svr4_fetch_link_map_offsets
70 (gdbarch, svr4_ilp32_fetch_link_map_offsets); 212 (gdbarch, nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
 213
 214 tramp_frame_prepend_unwinder (gdbarch, &shnbsd_sigtramp_si2);
71} 215}
72  216
73 217
 218#define GDB_OSABI_NETBSD_CORE GDB_OSABI_NETBSD
 219
 220static enum gdb_osabi
 221shnbsd_core_osabi_sniffer (bfd *abfd)
 222{
 223 if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
 224 return GDB_OSABI_NETBSD_CORE;
 225
 226 return GDB_OSABI_UNKNOWN;
 227}
 228
74/* Provide a prototype to silence -Wmissing-prototypes. */ 229/* Provide a prototype to silence -Wmissing-prototypes. */
75extern initialize_file_ftype _initialize_shnbsd_tdep; 230extern initialize_file_ftype _initialize_shnbsd_tdep;
76 231
77void 232void
78_initialize_shnbsd_tdep (void) 233_initialize_shnbsd_tdep (void)
79{ 234{
 235 /* BFD doesn't set a flavour for NetBSD style a.out core files. */
 236 gdbarch_register_osabi_sniffer (bfd_arch_sh, bfd_target_unknown_flavour,
 237 shnbsd_core_osabi_sniffer);
 238
80 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD, 239 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
81 shnbsd_init_abi); 240 shnbsd_init_abi);
82 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD, 
83 shnbsd_init_abi); 
84} 241}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c 2017/11/28 18:18:22 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sparc-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,46 +1,81 @@ @@ -1,46 +1,81 @@
1/* Native-dependent code for NetBSD/sparc. 1/* Native-dependent code for NetBSD/sparc.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "regcache.h" 21#include "regcache.h"
22#include "target.h" 22#include "target.h"
23 23
 24#include "nbsd-nat.h"
24#include "sparc-tdep.h" 25#include "sparc-tdep.h"
25#include "sparc-nat.h" 26#include "sparc-nat.h"
26 27
27/* Support for debugging kernel virtual memory images. */ 28/* Support for debugging kernel virtual memory images. */
28 29
29#include <sys/types.h> 30#include <sys/types.h>
30#include <machine/pcb.h> 31#include <machine/pcb.h>
 32#include <machine/reg.h>
31 33
32#include "bsd-kvm.h" 34#include "bsd-kvm.h"
33 35
 36#ifndef HAVE_GREGSET_T
 37typedef struct reg gregset_t;
 38#endif
 39
 40#ifndef HAVE_FPREGSET_T
 41typedef struct fpreg fpregset_t;
 42#endif
 43#include "gregset.h"
 44
 45void
 46supply_gregset (struct regcache *regcache, const gregset_t *gregs)
 47{
 48 sparc_supply_gregset (sparc_gregmap, regcache, -1, gregs);
 49}
 50
 51void
 52supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs)
 53{
 54 sparc_supply_fpregset (sparc_fpregmap, regcache, -1, fpregs);
 55}
 56
 57void
 58fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum)
 59{
 60 sparc_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
 61}
 62
 63void
 64fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum)
 65{
 66 sparc_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs);
 67}
 68
34static int 69static int
35sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 70sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
36{ 71{
37 /* The following is true for NetBSD 1.6.2: 72 /* The following is true for NetBSD 1.6.2:
38 73
39 The pcb contains %sp, %pc, %psr and %wim. From this information 74 The pcb contains %sp, %pc, %psr and %wim. From this information
40 we reconstruct the register state as it would look when we just 75 we reconstruct the register state as it would look when we just
41 returned from cpu_switch(). */ 76 returned from cpu_switch(). */
42 77
43 /* The stack pointer shouldn't be zero. */ 78 /* The stack pointer shouldn't be zero. */
44 if (pcb->pcb_sp == 0) 79 if (pcb->pcb_sp == 0)
45 return 0; 80 return 0;
46 81
@@ -52,22 +87,25 @@ sparc32nbsd_supply_pcb (struct regcache  @@ -52,22 +87,25 @@ sparc32nbsd_supply_pcb (struct regcache
52 87
53 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1); 88 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
54 89
55 return 1; 90 return 1;
56} 91}
57  92
58 93
59/* Provide a prototype to silence -Wmissing-prototypes. */ 94/* Provide a prototype to silence -Wmissing-prototypes. */
60void _initialize_sparcnbsd_nat (void); 95void _initialize_sparcnbsd_nat (void);
61 96
62void 97void
63_initialize_sparcnbsd_nat (void) 98_initialize_sparcnbsd_nat (void)
64{ 99{
 100 struct target_ops *t;
65 sparc_gregmap = &sparc32nbsd_gregmap; 101 sparc_gregmap = &sparc32nbsd_gregmap;
66 sparc_fpregmap = &sparc32_bsd_fpregmap; 102 sparc_fpregmap = &sparc32_bsd_fpregmap;
67 103
68 /* We've got nothing to add to the generic SPARC target. */ 104 /* Add some extra features to the generic SPARC target. */
69 add_target (sparc_target ()); 105 t = sparc_target ();
 106 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
 107 add_target (t);
70 108
71 /* Support debugging kernel virtual memory images. */ 109 /* Support debugging kernel virtual memory images. */
72 bsd_kvm_add_target (sparc32nbsd_supply_pcb); 110 bsd_kvm_add_target (sparc32nbsd_supply_pcb);
73} 111}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c 2017/11/28 18:18:07 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sparc-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/sparc. 1/* Target-dependent code for NetBSD/sparc.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 Contributed by Wasabi Systems, Inc. 4 Contributed by Wasabi Systems, Inc.
5 5
6 This file is part of GDB. 6 This file is part of GDB.
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
@@ -280,47 +280,84 @@ sparcnbsd_step_trap (struct frame_info * @@ -280,47 +280,84 @@ sparcnbsd_step_trap (struct frame_info *
280} 280}
281  281
282 282
283static const struct regset sparc32nbsd_gregset = 283static const struct regset sparc32nbsd_gregset =
284 { 284 {
285 NULL, sparc32nbsd_supply_gregset, NULL 285 NULL, sparc32nbsd_supply_gregset, NULL
286 }; 286 };
287 287
288static const struct regset sparc32nbsd_fpregset = 288static const struct regset sparc32nbsd_fpregset =
289 { 289 {
290 NULL, sparc32nbsd_supply_fpregset, NULL 290 NULL, sparc32nbsd_supply_fpregset, NULL
291 }; 291 };
292 292
293void 293static void
294sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) 294sparc32nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
295{ 295{
296 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 296 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
297 297
298 /* NetBSD doesn't support the 128-bit `long double' from the psABI. */ 298 /* NetBSD doesn't support the 128-bit `long double' from the psABI. */
299 set_gdbarch_long_double_bit (gdbarch, 64); 299 set_gdbarch_long_double_bit (gdbarch, 64);
300 set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double); 300 set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
301 301
302 tdep->gregset = &sparc32nbsd_gregset; 302 tdep->gregset = &sparc32nbsd_gregset;
303 tdep->sizeof_gregset = 20 * 4; 303 tdep->sizeof_gregset = 20 * 4;
304 304
305 tdep->fpregset = &sparc32nbsd_fpregset; 305 tdep->fpregset = &sparc32nbsd_fpregset;
306 tdep->sizeof_fpregset = 33 * 4; 306 tdep->sizeof_fpregset = 33 * 4;
307 307
308 /* Make sure we can single-step "new" syscalls. */ 308 /* Make sure we can single-step "new" syscalls. */
309 tdep->step_trap = sparcnbsd_step_trap; 309 tdep->step_trap = sparcnbsd_step_trap;
310 310
311 frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind); 311 frame_unwind_append_unwinder (gdbarch, &sparc32nbsd_sigcontext_frame_unwind);
 312}
 313
 314static void
 315sparc32nbsd_aout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 316{
 317 sparc32nbsd_init_abi (info, gdbarch);
 318}
 319
 320void
 321sparc32nbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 322{
 323 sparc32nbsd_init_abi (info, gdbarch);
312 324
313 set_solib_svr4_fetch_link_map_offsets 325 set_solib_svr4_fetch_link_map_offsets
314 (gdbarch, svr4_ilp32_fetch_link_map_offsets); 326 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
315} 327}
316 328
 329/* OpenBSD uses the traditional NetBSD core file format, even for
 330 ports that use ELF. Therefore, if the default OS ABI is OpenBSD
 331 ELF, we return that instead of NetBSD a.out. This is mainly for
 332 the benfit of OpenBSD/sparc64, which inherits the sniffer below
 333 since we include this file for an OpenBSD/sparc64 target. For
 334 OpenBSD/sparc, the NetBSD a.out OS ABI is probably similar enough
 335 to both the OpenBSD a.out and the OpenBSD ELF OS ABI. */
 336#define GDB_OSABI_NETBSD_CORE GDB_OSABI_NETBSD
 337
 338static enum gdb_osabi
 339sparcnbsd_core_osabi_sniffer (bfd *abfd)
 340{
 341 if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
 342 return GDB_OSABI_NETBSD_CORE;
 343
 344 return GDB_OSABI_UNKNOWN;
 345}
 346
317  347
318/* Provide a prototype to silence -Wmissing-prototypes. */ 348/* Provide a prototype to silence -Wmissing-prototypes. */
319void _initialize_sparcnbsd_tdep (void); 349void _initialize_sparcnbsd_tdep (void);
320 350
321void 351void
322_initialize_sparcnbsd_tdep (void) 352_initialize_sparcnbsd_tdep (void)
323{ 353{
 354 gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_aout_flavour,
 355 sparcnbsd_aout_osabi_sniffer);
 356
 357 /* BFD doesn't set a flavour for NetBSD style a.out core files. */
 358 gdbarch_register_osabi_sniffer (bfd_arch_sparc, bfd_target_unknown_flavour,
 359 sparcnbsd_core_osabi_sniffer);
 360
324 gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD, 361 gdbarch_register_osabi (bfd_arch_sparc, 0, GDB_OSABI_NETBSD,
325 sparc32nbsd_init_abi); 362 sparc32nbsd_elf_init_abi);
326} 363}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c 2017/11/28 18:18:03 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-nat.c 2017/11/29 03:35:15 1.2
@@ -1,40 +1,52 @@ @@ -1,40 +1,52 @@
1/* Native-dependent code for NetBSD/sparc64. 1/* Native-dependent code for NetBSD/sparc64.
2 2
3 Copyright (C) 2003-2017 Free Software Foundation, Inc. 3 Copyright (C) 2003-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include "defs.h" 20#include "defs.h"
21#include "gdbcore.h" 21#include "gdbcore.h"
22#include "regcache.h" 22#include "regcache.h"
23#include "target.h" 23#include "target.h"
24 24
 25#include "nbsd-nat.h"
25#include "sparc64-tdep.h" 26#include "sparc64-tdep.h"
26#include "sparc-nat.h" 27#include "sparc-nat.h"
27 28
 29#include <machine/reg.h>
 30
 31#ifndef HAVE_GREGSET_T
 32typedef struct reg gregset_t;
 33#endif
 34
 35#ifndef HAVE_FPREGSET_T
 36typedef struct fpreg fpregset_t;
 37#endif
 38#include "gregset.h"
 39
28/* NetBSD is different from the other OSes that support both SPARC and 40/* NetBSD is different from the other OSes that support both SPARC and
29 UltraSPARC in that the result of ptrace(2) depends on whether the 41 UltraSPARC in that the result of ptrace(2) depends on whether the
30 traced process is 32-bit or 64-bit. */ 42 traced process is 32-bit or 64-bit. */
31 43
32static void 44static void
33sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap, 45sparc64nbsd_supply_gregset (const struct sparc_gregmap *gregmap,
34 struct regcache *regcache, 46 struct regcache *regcache,
35 int regnum, const void *gregs) 47 int regnum, const void *gregs)
36{ 48{
37 int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32); 49 int sparc32 = (gdbarch_ptr_bit (get_regcache_arch (regcache)) == 32);
38 50
39 if (sparc32) 51 if (sparc32)
40 sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs); 52 sparc32_supply_gregset (&sparc32nbsd_gregmap, regcache, regnum, gregs);
@@ -116,27 +128,49 @@ sparc64nbsd_fpregset_supplies_p (struct  @@ -116,27 +128,49 @@ sparc64nbsd_fpregset_supplies_p (struct
116 128
117 /* Floating-point registers. */ 129 /* Floating-point registers. */
118 if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM) 130 if ((regnum >= SPARC_F0_REGNUM && regnum <= SPARC_F31_REGNUM)
119 || (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM)) 131 || (regnum >= SPARC64_F32_REGNUM && regnum <= SPARC64_F62_REGNUM))
120 return 1; 132 return 1;
121 133
122 /* Control registers. */ 134 /* Control registers. */
123 if (regnum == SPARC64_FSR_REGNUM) 135 if (regnum == SPARC64_FSR_REGNUM)
124 return 1; 136 return 1;
125 137
126 return 0; 138 return 0;
127} 139}
128  140
 141void
 142supply_gregset (struct regcache *regcache, const gregset_t *gregs)
 143{
 144 sparc64nbsd_supply_gregset (sparc_gregmap, regcache, -1, gregs);
 145}
 146
 147void
 148supply_fpregset (struct regcache *regcache, const fpregset_t *fpregs)
 149{
 150 sparc64nbsd_supply_fpregset (sparc_fpregmap, regcache, -1, fpregs);
 151}
129 152
 153void
 154fill_gregset (const struct regcache *regcache, gregset_t *gregs, int regnum)
 155{
 156 sparc64nbsd_collect_gregset (sparc_gregmap, regcache, regnum, gregs);
 157}
 158
 159void
 160fill_fpregset (const struct regcache *regcache, fpregset_t *fpregs, int regnum)
 161{
 162 sparc64nbsd_collect_fpregset (sparc_fpregmap, regcache, regnum, fpregs);
 163}
130/* Support for debugging kernel virtual memory images. */ 164/* Support for debugging kernel virtual memory images. */
131 165
132#include <sys/types.h> 166#include <sys/types.h>
133#include <machine/pcb.h> 167#include <machine/pcb.h>
134 168
135#include "bsd-kvm.h" 169#include "bsd-kvm.h"
136 170
137static int 171static int
138sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) 172sparc64nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
139{ 173{
140 u_int64_t state; 174 u_int64_t state;
141 int regnum; 175 int regnum;
142 176
@@ -164,26 +198,30 @@ sparc64nbsd_supply_pcb (struct regcache  @@ -164,26 +198,30 @@ sparc64nbsd_supply_pcb (struct regcache
164 198
165 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1); 199 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
166 200
167 return 1; 201 return 1;
168} 202}
169 203
170  204
171/* Provide a prototype to silence -Wmissing-prototypes. */ 205/* Provide a prototype to silence -Wmissing-prototypes. */
172void _initialize_sparc64nbsd_nat (void); 206void _initialize_sparc64nbsd_nat (void);
173 207
174void 208void
175_initialize_sparc64nbsd_nat (void) 209_initialize_sparc64nbsd_nat (void)
176{ 210{
 211 struct target_ops *t;
 212
177 sparc_supply_gregset = sparc64nbsd_supply_gregset; 213 sparc_supply_gregset = sparc64nbsd_supply_gregset;
178 sparc_collect_gregset = sparc64nbsd_collect_gregset; 214 sparc_collect_gregset = sparc64nbsd_collect_gregset;
179 sparc_supply_fpregset = sparc64nbsd_supply_fpregset; 215 sparc_supply_fpregset = sparc64nbsd_supply_fpregset;
180 sparc_collect_fpregset = sparc64nbsd_collect_fpregset; 216 sparc_collect_fpregset = sparc64nbsd_collect_fpregset;
181 sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p; 217 sparc_gregset_supplies_p = sparc64nbsd_gregset_supplies_p;
182 sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p; 218 sparc_fpregset_supplies_p = sparc64nbsd_fpregset_supplies_p;
183 219
184 /* We've got nothing to add to the generic SPARC target. */ 220 /* Add some extra features to the generic SPARC target. */
185 add_target (sparc_target ()); 221 t = sparc_target ();
 222 t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
 223 add_target (t);
186 224
187 /* Support debugging kernel virtual memory images. */ 225 /* Support debugging kernel virtual memory images. */
188 bsd_kvm_add_target (sparc64nbsd_supply_pcb); 226 bsd_kvm_add_target (sparc64nbsd_supply_pcb);
189} 227}

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-tdep.c 2017/11/28 18:18:11 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/sparc64-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/sparc64. 1/* Target-dependent code for NetBSD/sparc64.
2 2
3 Copyright (C) 2002-2017 Free Software Foundation, Inc. 3 Copyright (C) 2002-2016 Free Software Foundation, Inc.
4 Based on code contributed by Wasabi Systems, Inc. 4 Based on code contributed by Wasabi Systems, Inc.
5 5
6 This file is part of GDB. 6 This file is part of GDB.
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or 10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version. 11 (at your option) any later version.
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.

cvs diff -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/vax-nbsd-tdep.c (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/vax-nbsd-tdep.c 2017/11/28 18:18:04 1.1.1.1
+++ src/external/gpl3/gdb/dist/gdb/vax-nbsd-tdep.c 2017/11/29 03:35:15 1.2
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1/* Target-dependent code for NetBSD/vax. 1/* Target-dependent code for NetBSD/vax.
2 2
3 Copyright (C) 2004-2017 Free Software Foundation, Inc. 3 Copyright (C) 2004-2016 Free Software Foundation, Inc.
4 4
5 This file is part of GDB. 5 This file is part of GDB.
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or 9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/alpha/Attic/nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/alpha/Attic/nbsd.mh 2012/02/06 10:46:34 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/alpha/Attic/nbsd.mh 2017/11/29 03:35:16 1.4
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
1# Host: NetBSD/alpha 1# Host: NetBSD/alpha
2NATDEPFILES= fork-child.o inf-ptrace.o alphabsd-nat.o bsd-kvm.o nbsd-nat.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o alpha-bsd-nat.o bsd-kvm.o nbsd-nat.o \
3 nbsd-thread.o 3 nbsd-thread.o
4 4
5LOADLIBES= -lkvm 5LOADLIBES= -lkvm

cvs diff -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/config/arm/Attic/nbsdelf.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/arm/Attic/nbsdelf.mh 2016/10/22 14:57:50 1.5
+++ src/external/gpl3/gdb/dist/gdb/config/arm/Attic/nbsdelf.mh 2017/11/29 03:35:16 1.6
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
1# Host: NetBSD/arm 1# Host: NetBSD/arm
2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o armnbsd-nat.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o arm-nbsd-nat.o \
3 bsd-kvm.o nbsd-thread.o 3 bsd-kvm.o nbsd-thread.o
4 4
5LOADLIBES= -lkvm 5LOADLIBES= -lkvm

cvs diff -r1.4 -r1.5 src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsd64.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsd64.mh 2016/10/12 20:20:33 1.4
+++ src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsd64.mh 2017/11/29 03:35:16 1.5
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
1# Host: NetBSD/amd64 1# Host: NetBSD/amd64
2NATDEPFILES= fork-child.o inf-ptrace.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o \
3 nbsd-nat.o amd64-nat.o x86bsd-nat.o amd64bsd-nat.o amd64nbsd-nat.o \ 3 nbsd-nat.o amd64-nat.o x86-bsd-nat.o amd64-bsd-nat.o amd64-nbsd-nat.o \
4 bsd-kvm.o nbsd-thread.o 4 bsd-kvm.o nbsd-thread.o
5 5
6LOADLIBES= -lkvm 6LOADLIBES= -lkvm

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsdelf.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsdelf.mh 2016/10/12 20:20:33 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/i386/Attic/nbsdelf.mh 2017/11/29 03:35:16 1.4
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
1# Host: NetBSD/i386 ELF 1# Host: NetBSD/i386 ELF
2NATDEPFILES= fork-child.o inf-ptrace.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o \
3 nbsd-nat.o x86bsd-nat.o i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o \ 3 nbsd-nat.o nbsd-thread.o x86-bsd-nat.o x86-nat.o x86-dregs.o \
4 nbsd-thread.o 4 i386-bsd-nat.o i386-nbsd-nat.o \
 5 bsd-kvm.o
5 6
6LOADLIBES= -lkvm 7LOADLIBES= -lkvm

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/m68k/Attic/nbsdelf.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/m68k/Attic/nbsdelf.mh 2012/02/06 10:46:35 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/m68k/Attic/nbsdelf.mh 2017/11/29 03:35:16 1.4
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
1# Host: NetBSD/m68k ELF 1# Host: NetBSD/m68k ELF
2NATDEPFILES= nbsd-nat.o m68kbsd-nat.o bsd-kvm.o fork-child.o inf-ptrace.o \ 2NATDEPFILES= nbsd-nat.o m68k-bsd-nat.o bsd-kvm.o fork-child.o inf-ptrace.o \
3 nbsd-thread.o 3 nbsd-thread.o
4 4
5LOADLIBES= -lkvm 5LOADLIBES= -lkvm

cvs diff -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/config/mips/Attic/nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/mips/Attic/nbsd.mh 2012/11/03 15:07:40 1.5
+++ src/external/gpl3/gdb/dist/gdb/config/mips/Attic/nbsd.mh 2017/11/29 03:35:16 1.6
@@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
1# Host: NetBSD/mips 1# Host: NetBSD/mips
2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mipsnbsd-nat.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o mips-nbsd-nat.o \
3 nbsd-thread.o bsd-kvm.o 3 nbsd-thread.o bsd-kvm.o
4LOADLIBES= -lkvm 4LOADLIBES= -lkvm

cvs diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/config/pa/Attic/nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/pa/Attic/nbsd.mh 2012/02/06 10:46:35 1.2
+++ src/external/gpl3/gdb/dist/gdb/config/pa/Attic/nbsd.mh 2017/11/29 03:35:16 1.3
@@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
1# Host: NetBSD/hppa 1# Host: NetBSD/hppa
2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o hppanbsd-nat.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o hppa-nbsd-nat.o \
3 nbsd-thread.o 3 nbsd-thread.o

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/powerpc/Attic/nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/powerpc/Attic/nbsd.mh 2012/02/06 10:46:35 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/powerpc/Attic/nbsd.mh 2017/11/29 03:35:16 1.4
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
1# Host: NetBSD/powerpc 1# Host: NetBSD/powerpc
2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ppcnbsd-nat.o bsd-kvm.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ppc-nbsd-nat.o bsd-kvm.o \
3 nbsd-thread.o 3 nbsd-thread.o
4 4
5LOADLIBES= -lkvm 5LOADLIBES= -lkvm

cvs diff -r1.2 -r1.3 src/external/gpl3/gdb/dist/gdb/config/powerpc/ppc64-nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/powerpc/ppc64-nbsd.mh 2012/02/06 10:46:35 1.2
+++ src/external/gpl3/gdb/dist/gdb/config/powerpc/ppc64-nbsd.mh 2017/11/29 03:35:16 1.3
@@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
1# Host: NetBSD/powerpc64 1# Host: NetBSD/powerpc64
2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ppcnbsd-nat.o bsd-kvm.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o nbsd-nat.o ppc-nbsd-nat.o bsd-kvm.o \
3 nbsd-thread.o 3 nbsd-thread.o
4 4
5LOADLIBES= -lkvm 5LOADLIBES= -lkvm

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sh/Attic/nbsd.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/sh/Attic/nbsd.mh 2012/02/06 10:46:36 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/sh/Attic/nbsd.mh 2017/11/29 03:35:16 1.4
@@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
1# Host: NetBSD/sh 1# Host: NetBSD/sh
2NATDEPFILES= inf-ptrace.o fork-child.o nbsd-nat.o shnbsd-nat.o \ 2NATDEPFILES= inf-ptrace.o fork-child.o nbsd-nat.o sh-nbsd-nat.o \
3 nbsd-thread.o 3 nbsd-thread.o

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsd64.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsd64.mh 2012/02/06 10:46:36 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsd64.mh 2017/11/29 03:35:16 1.4
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
1# Host: NetBSD/sparc64 1# Host: NetBSD/sparc64
2NATDEPFILES= fork-child.o inf-ptrace.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o \
3 nbsd-nat.o sparc64nbsd-nat.o sparc-nat.o bsd-kvm.o \ 3 nbsd-nat.o sparc64-nbsd-nat.o sparc-nat.o bsd-kvm.o \
4 nbsd-thread.o 4 nbsd-thread.o
5 5
6LOADLIBES= -lkvm 6LOADLIBES= -lkvm

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsdelf.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsdelf.mh 2012/02/06 10:46:36 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/sparc/Attic/nbsdelf.mh 2017/11/29 03:35:16 1.4
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
1# Host: NetBSD/sparc ELF 1# Host: NetBSD/sparc ELF
2NATDEPFILES= fork-child.o inf-ptrace.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o \
3 nbsd-nat.o sparcnbsd-nat.o sparc-nat.o bsd-kvm.o \ 3 nbsd-nat.o sparc-nbsd-nat.o sparc-nat.o bsd-kvm.o \
4 nbsd-thread.o 4 nbsd-thread.o
5 5
6LOADLIBES= -lkvm 6LOADLIBES= -lkvm

cvs diff -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/config/vax/Attic/nbsdelf.mh (expand / switch to unified diff)

--- src/external/gpl3/gdb/dist/gdb/config/vax/Attic/nbsdelf.mh 2012/02/06 10:46:36 1.3
+++ src/external/gpl3/gdb/dist/gdb/config/vax/Attic/nbsdelf.mh 2017/11/29 03:35:16 1.4
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
1# Host: NetBSD/vax ELF 1# Host: NetBSD/vax ELF
2NATDEPFILES= fork-child.o inf-ptrace.o \ 2NATDEPFILES= fork-child.o inf-ptrace.o \
3 nbsd-nat.o vaxbsd-nat.o bsd-kvm.o \ 3 nbsd-nat.o vax-bsd-nat.o bsd-kvm.o \
4 nbsd-thread.o 4 nbsd-thread.o
5 5
6LOADLIBES= -lkvm 6LOADLIBES= -lkvm