include/elf/
[deliverable/binutils-gdb.git] / gdb / sparc64fbsd-nat.c
1 /* Native-dependent code for FreeBSD/sparc64.
2
3 Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
4 Free Software Foundation, Inc.
5
6 This file is part of GDB.
7
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
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 #include "defs.h"
22 #include "regcache.h"
23 #include "target.h"
24
25 #include "fbsd-nat.h"
26 #include "sparc64-tdep.h"
27 #include "sparc-nat.h"
28 \f
29
30 /* Support for debugging kernel virtual memory images. */
31
32 #include <sys/types.h>
33 #include <machine/pcb.h>
34
35 #include "bsd-kvm.h"
36
37 static int
38 sparc64fbsd_kvm_supply_pcb (struct regcache *regcache, struct pcb *pcb)
39 {
40 /* The following is true for FreeBSD 5.4:
41
42 The pcb contains %sp and %pc. Since the register windows are
43 explicitly flushed, we can find the `local' and `in' registers on
44 the stack. */
45
46 /* The stack pointer shouldn't be zero. */
47 if (pcb->pcb_sp == 0)
48 return 0;
49
50 regcache_raw_supply (regcache, SPARC_SP_REGNUM, &pcb->pcb_sp);
51 regcache_raw_supply (regcache, SPARC64_PC_REGNUM, &pcb->pcb_pc);
52
53 /* Synthesize %npc. */
54 pcb->pcb_pc += 4;
55 regcache_raw_supply (regcache, SPARC64_NPC_REGNUM, &pcb->pcb_pc);
56
57 /* Read `local' and `in' registers from the stack. */
58 sparc_supply_rwindow (regcache, pcb->pcb_sp, -1);
59
60 return 1;
61 }
62 \f
63
64 /* Provide a prototype to silence -Wmissing-prototypes. */
65 void _initialize_sparc64fbsd_nat (void);
66
67 void
68 _initialize_sparc64fbsd_nat (void)
69 {
70 struct target_ops *t;
71
72 /* Add some extra features to the generic SPARC target. */
73 t = sparc_target ();
74 t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
75 t->to_find_memory_regions = fbsd_find_memory_regions;
76 t->to_make_corefile_notes = fbsd_make_corefile_notes;
77 add_target (t);
78
79 sparc_gregset = &sparc64fbsd_gregset;
80
81 /* Support debugging kernel virtual memory images. */
82 bsd_kvm_add_target (sparc64fbsd_kvm_supply_pcb);
83 }
This page took 0.036613 seconds and 4 git commands to generate.