GDB (xrefs)

/tmp/gdb-8.1/gdb/sparc-nbsd-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for NetBSD/sparc.
2
3 Copyright (C) 2002-2018 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
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/>. */
19
20 #include "defs.h"
21 #include "regcache.h"
22 #include "target.h"
23
24 #include "sparc-tdep.h"
25 #include "sparc-nat.h"
26
27 /* Support for debugging kernel virtual memory images. */
28
29 #include <sys/types.h>
30 #include <machine/pcb.h>
31
32 #include "bsd-kvm.h"
33
34 static int
35 sparc32nbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
36 {
37 /* The following is true for NetBSD 1.6.2:
38
39 The pcb contains %sp, %pc, %psr and %wim. From this information
40 we reconstruct the register state as it would look when we just
41 returned from cpu_switch(). */
42
43 /* The stack pointer shouldn't be zero. */
44 if (pcb->pcb_sp == 0)
45 return 0;
46
47 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
48 regcache_raw_supply (regcache, SPARC_O7_REGNUM, &pcb->pcb_pc);
49 regcache_raw_supply (regcache, SPARC32_PSR_REGNUM, &pcb->pcb_psr);
50 regcache_raw_supply (regcache, SPARC32_WIM_REGNUM, &pcb->pcb_wim);
51 regcache_raw_supply (regcache, SPARC32_PC_REGNUM, &pcb->pcb_pc);
52
53 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
54
55 return 1;
56 }
57
58 void
59 _initialize_sparcnbsd_nat (void)
60 {
61 sparc_gregmap = &sparc32nbsd_gregmap;
62 sparc_fpregmap = &sparc32_bsd_fpregmap;
63
64 /* We've got nothing to add to the generic SPARC target. */
65 add_target (sparc_target ());
66
67 /* Support debugging kernel virtual memory images. */
68 bsd_kvm_add_target (sparc32nbsd_supply_pcb);
69 }
add_target
void add_target(struct target_ops *t)
Definition: target.c:395
SPARC32_PC_REGNUM
Definition: sparc-tdep.h:152
sparc-nat.h
sparc_target
struct target_ops * sparc_target(void)
Definition: sparc-nat.c:329
SPARC_O7_REGNUM
Definition: sparc-tdep.h:116
sparc32nbsd_supply_pcb
static int sparc32nbsd_supply_pcb(struct regcache *regcache, struct pcb *pcb)
Definition: sparc-nbsd-nat.c:35
sparc_gregmap
Definition: sparc-tdep.h:37
defs.h
sparc_supply_rwindow
void sparc_supply_rwindow(struct regcache *regcache, CORE_ADDR sp, int regnum)
Definition: sparc-tdep.c:1925
SPARC_SP_REGNUM
Definition: sparc-tdep.h:115
sparc32nbsd_gregmap
const struct sparc_gregmap sparc32nbsd_gregmap
Definition: sparc-nbsd-tdep.c:41
regcache.h
bsd-kvm.h
sparc_fpregmap
Definition: sparc-tdep.h:50
SPARC32_PSR_REGNUM
Definition: sparc-tdep.h:149
sparc32_bsd_fpregmap
const struct sparc_fpregmap sparc32_bsd_fpregmap
Definition: sparc-tdep.c:2250
sparc-tdep.h
_initialize_sparcnbsd_nat
void _initialize_sparcnbsd_nat(void)
Definition: sparc-nbsd-nat.c:59
SPARC32_WIM_REGNUM
Definition: sparc-tdep.h:150
target.h
regcache_raw_supply
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1004
regcache
Definition: regcache.h:232
bsd_kvm_add_target
void bsd_kvm_add_target(int(*supply_pcb)(struct regcache *, struct pcb *))
Definition: bsd-kvm.c:354