GDB (xrefs)
/tmp/gdb-8.1/gdb/sparc64-obsd-nat.c
Go to the documentation of this file.
1 /* Native-dependent code for OpenBSD/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 "gdbcore.h"
22 #include "regcache.h"
23 #include "target.h"
24 
25 #include "sparc64-tdep.h"
26 #include "sparc-nat.h"
27 #include "obsd-nat.h"
28 
29 /* Determine whether `gregset_t' contains register REGNUM. */
30 
31 static int
33 {
34  /* Integer registers. */
39  return 1;
40 
41  /* Control registers. */
46  return 1;
47 
48  return 0;
49 }
50 
51 /* Determine whether `fpregset_t' contains register REGNUM. */
52 
53 static int
55 {
56  /* Floating-point registers. */
59  return 1;
60 
61  /* Control registers. */
63  return 1;
64 
65  return 0;
66 }
67 
68 
69 /* Support for debugging kernel virtual memory images. */
70 
71 #include <sys/types.h>
72 #include <machine/pcb.h>
73 
74 #include "bsd-kvm.h"
75 
76 static int
77 sparc64obsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
78 {
79  u_int64_t state;
80  int regnum;
81 
82  /* The following is true for OpenBSD 3.0:
83 
84  The pcb contains %sp and %pc, %pstate and %cwp. From this
85  information we reconstruct the register state as it would look
86  when we just returned from cpu_switch(). */
87 
88  /* The stack pointer shouldn't be zero. */
89  if (pcb->pcb_sp == 0)
90  return 0;
91 
92  /* If the program counter is zero, this is probably a core dump, and
93  we can get %pc from the stack. */
94  if (pcb->pcb_pc == 0)
95  read_memory(pcb->pcb_sp + BIAS - 176 + (11 * 8),
96  (gdb_byte *)&pcb->pcb_pc, sizeof pcb->pcb_pc);
97 
100 
101  state = pcb->pcb_pstate << 8 | pcb->pcb_cwp;
103 
104  sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
105 
106  return 1;
107 }
108 
109 void
111 {
118 
121 
122  /* Add some extra features to the generic SPARC target. */
124 
125  /* Support debugging kernel virtual memory images. */
127 }
void sparc64_collect_fpregset(const struct sparc_fpregmap *fpregmap, const struct regcache *regcache, int regnum, void *fpregs)
static int sparc64obsd_gregset_supplies_p(struct gdbarch *gdbarch, int regnum)
void obsd_add_target(struct target_ops *t)
Definition: obsd-nat.c:181
static int sparc64obsd_supply_pcb(struct regcache *regcache, struct pcb *pcb)
#define BIAS
Definition: sparc-tdep.c:72
struct target_ops * sparc_target(void)
Definition: sparc-nat.c:329
#define sparc_supply_fpregset
void sparc64_collect_gregset(const struct sparc_gregmap *gregmap, const struct regcache *regcache, int regnum, void *gregs)
void sparc64_supply_gregset(const struct sparc_gregmap *gregmap, struct regcache *regcache, int regnum, const void *gregs)
void sparc_supply_rwindow(struct regcache *regcache, CORE_ADDR sp, int regnum)
Definition: sparc-tdep.c:1925
static int sparc64obsd_fpregset_supplies_p(struct gdbarch *gdbarch, int regnum)
#define sparc_supply_gregset
const struct sparc_fpregmap sparc64_bsd_fpregmap
void sparc64_supply_fpregset(const struct sparc_fpregmap *fpregmap, struct regcache *regcache, int regnum, const void *fpregs)
#define sparc_collect_fpregset
const struct sparc_gregmap sparc64nbsd_gregmap
int regnum
Definition: aarch64-tdep.c:77
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: corefile.c:258
void _initialize_sparc64obsd_nat(void)
bfd_byte gdb_byte
Definition: common-types.h:38
#define sparc_collect_gregset
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
Definition: regcache.c:1004
int(* sparc_fpregset_supplies_p)(struct gdbarch *, int)
Definition: sparc-nat.c:93
void bsd_kvm_add_target(int(*supply_pcb)(struct regcache *, struct pcb *))
Definition: bsd-kvm.c:354
int(* sparc_gregset_supplies_p)(struct gdbarch *, int)
Definition: sparc-nat.c:92