GDB (xrefs)

/tmp/gdb-8.1/gdb/sparc64-fbsd-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for FreeBSD/sparc64.
2
3 Copyright (C) 2003-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 "fbsd-nat.h"
25 #include "sparc64-tdep.h"
26 #include "sparc-nat.h"
27
28
29 /* Support for debugging kernel virtual memory images. */
30
31 #include <sys/types.h>
32 #include <machine/pcb.h>
33
34 #include "bsd-kvm.h"
35
36 static int
37 sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
38 {
39 /* The following is true for FreeBSD 5.4:
40
41 The pcb contains %sp and %pc. Since the register windows are
42 explicitly flushed, we can find the `local' and `in' registers on
43 the stack. */
44
45 /* The stack pointer shouldn't be zero. */
46 if (pcb->pcb_sp == 0)
47 return 0;
48
49 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
50 regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
51
52 /* Synthesize %npc. */
53 pcb->pcb_pc += 4;
54 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM, &pcb->pcb_pc);
55
56 /* Read `local' and `in' registers from the stack. */
57 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
58
59 return 1;
60 }
61
62 void
63 _initialize_sparc64fbsd_nat (void)
64 {
65 struct target_ops *t;
66
67 /* Add some extra features to the generic SPARC target. */
68 t = sparc_target ();
69 fbsd_nat_add_target (t);
70
71 sparc_gregmap = &sparc64fbsd_gregmap;
72
73 /* Support debugging kernel virtual memory images. */
74 bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
75 }
fbsd_nat_add_target
void fbsd_nat_add_target(struct target_ops *t)
Definition: fbsd-nat.c:1180
sparc64fbsd_kvm_supply_pcb
static int sparc64fbsd_kvm_supply_pcb(struct regcache *regcache, struct pcb *pcb)
Definition: sparc64-fbsd-nat.c:37
sparc-nat.h
sparc_target
struct target_ops * sparc_target(void)
Definition: sparc-nat.c:329
sparc64-tdep.h
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
SPARC64_PC_REGNUM
Definition: sparc64-tdep.h:53
target_ops
Definition: target.h:412
regcache.h
fbsd-nat.h
bsd-kvm.h
SPARC64_NPC_REGNUM
Definition: sparc64-tdep.h:54
_initialize_sparc64fbsd_nat
void _initialize_sparc64fbsd_nat(void)
Definition: sparc64-fbsd-nat.c:63
sparc64fbsd_gregmap
const struct sparc_gregmap sparc64fbsd_gregmap
Definition: sparc64-fbsd-tdep.c:35
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