OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [hppaobsd-tdep.c] - Blame information for rev 157

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for OpenBSD/hppa
2
 
3
   Copyright (C) 2004, 2005, 2006, 2008 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 2 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, write to the Free Software
19
   Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
   Boston, MA 02110-1301, USA.  */
21
 
22
#include "defs.h"
23
#include "osabi.h"
24
#include "regcache.h"
25
#include "regset.h"
26
 
27
#include "gdb_assert.h"
28
#include "gdb_string.h"
29
 
30
#include "hppa-tdep.h"
31
 
32
/* Core file support.  */
33
 
34
/* Sizeof `struct reg' in <machine/reg.h>.  */
35
#define HPPABSD_SIZEOF_GREGS    (34 * 4)
36
 
37
/* Supply register REGNUM from the buffer specified by GREGS and LEN
38
   in the general-purpose register set REGSET to register cache
39
   REGCACHE.  If REGNUM is -1, do this for all registers in REGSET.  */
40
 
41
static void
42
hppabsd_supply_gregset (const struct regset *regset, struct regcache *regcache,
43
                     int regnum, const void *gregs, size_t len)
44
{
45
  const gdb_byte *regs = gregs;
46
  size_t offset;
47
  int i;
48
 
49
  gdb_assert (len >= HPPABSD_SIZEOF_GREGS);
50
 
51
  for (i = HPPA_R1_REGNUM, offset = 4; i <= HPPA_R31_REGNUM; i++, offset += 4)
52
    {
53
      if (regnum == -1 || regnum == i)
54
        regcache_raw_supply (regcache, i, regs + offset);
55
    }
56
 
57
  if (regnum == -1 || regnum == HPPA_SAR_REGNUM)
58
    regcache_raw_supply (regcache, HPPA_SAR_REGNUM, regs);
59
  if (regnum == -1 || regnum == HPPA_PCOQ_HEAD_REGNUM)
60
    regcache_raw_supply (regcache, HPPA_PCOQ_HEAD_REGNUM, regs + 32 * 4);
61
  if (regnum == -1 || regnum == HPPA_PCOQ_TAIL_REGNUM)
62
    regcache_raw_supply (regcache, HPPA_PCOQ_TAIL_REGNUM, regs + 33 * 4);
63
}
64
 
65
/* OpenBSD/hppa register set.  */
66
 
67
static struct regset hppabsd_gregset =
68
{
69
  NULL,
70
  hppabsd_supply_gregset
71
};
72
 
73
/* Return the appropriate register set for the core section identified
74
   by SECT_NAME and SECT_SIZE.  */
75
 
76
static const struct regset *
77
hppaobsd_regset_from_core_section (struct gdbarch *gdbarch,
78
                                  const char *sect_name, size_t sect_size)
79
{
80
  if (strcmp (sect_name, ".reg") == 0 && sect_size >= HPPABSD_SIZEOF_GREGS)
81
    return &hppabsd_gregset;
82
 
83
  return NULL;
84
}
85
 
86
 
87
void hppabsd_init_abi (struct gdbarch_info, struct gdbarch *);
88
 
89
void
90
hppaobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
91
{
92
  /* Obviously OpenBSD is BSD-based.  */
93
  hppabsd_init_abi (info, gdbarch);
94
 
95
  /* Core file support.  */
96
  set_gdbarch_regset_from_core_section
97
    (gdbarch, hppaobsd_regset_from_core_section);
98
 
99
}
100
 
101
 
102
/* OpenBSD uses uses the traditional NetBSD core file format, even for
103
   ports that use ELF.  */
104
#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
105
 
106
static enum gdb_osabi
107
hppaobsd_core_osabi_sniffer (bfd *abfd)
108
{
109
  if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
110
    return GDB_OSABI_NETBSD_CORE;
111
 
112
  return GDB_OSABI_UNKNOWN;
113
}
114
 
115
 
116
/* Provide a prototype to silence -Wmissing-prototypes.  */
117
void _initialize_hppabsd_tdep (void);
118
 
119
void
120
_initialize_hppabsd_tdep (void)
121
{
122
  /* BFD doesn't set a flavour for NetBSD style a.out core files.  */
123
  gdbarch_register_osabi_sniffer (bfd_arch_hppa, bfd_target_unknown_flavour,
124
                                  hppaobsd_core_osabi_sniffer);
125
 
126
  gdbarch_register_osabi (bfd_arch_hppa, 0, GDB_OSABI_OPENBSD_ELF,
127
                          hppaobsd_init_abi);
128
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.