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

Subversion Repositories openrisc_me

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for i386 BSD's.
2
 
3
   Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008
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 "arch-utils.h"
23
#include "frame.h"
24
#include "gdbcore.h"
25
#include "regcache.h"
26
#include "osabi.h"
27
 
28
#include "gdb_string.h"
29
 
30
#include "i386-tdep.h"
31
 
32
/* Support for signal handlers.  */
33
 
34
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
35
   routine, return the address of the associated sigcontext structure.  */
36
 
37
static CORE_ADDR
38
i386bsd_sigcontext_addr (struct frame_info *next_frame)
39
{
40
  gdb_byte buf[4];
41
  CORE_ADDR sp;
42
 
43
  frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
44
  sp = extract_unsigned_integer (buf, 4);
45
 
46
  return read_memory_unsigned_integer (sp + 8, 4);
47
}
48
 
49
 
50
/* Support for shared libraries.  */
51
 
52
/* Traditional BSD (4.3 BSD, still used for BSDI and 386BSD).  */
53
 
54
/* From <machine/signal.h>.  */
55
int i386bsd_sc_reg_offset[] =
56
{
57
  -1,                           /* %eax */
58
  -1,                           /* %ecx */
59
  -1,                           /* %edx */
60
  -1,                           /* %ebx */
61
  8 + 0 * 4,                     /* %esp */
62
  8 + 1 * 4,                    /* %ebp */
63
  -1,                           /* %esi */
64
  -1,                           /* %edi */
65
  8 + 3 * 4,                    /* %eip */
66
  8 + 4 * 4,                    /* %eflags */
67
  -1,                           /* %cs */
68
  -1,                           /* %ss */
69
  -1,                           /* %ds */
70
  -1,                           /* %es */
71
  -1,                           /* %fs */
72
  -1                            /* %gs */
73
};
74
 
75
void
76
i386bsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
77
{
78
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
79
 
80
  tdep->jb_pc_offset = 0;
81
 
82
  tdep->sigtramp_start = 0xfdbfdfc0;
83
  tdep->sigtramp_end = 0xfdbfe000;
84
  tdep->sigcontext_addr = i386bsd_sigcontext_addr;
85
  tdep->sc_reg_offset = i386bsd_sc_reg_offset;
86
  tdep->sc_num_regs = ARRAY_SIZE (i386bsd_sc_reg_offset);
87
}
88
 
89
 
90
static enum gdb_osabi
91
i386bsd_aout_osabi_sniffer (bfd *abfd)
92
{
93
  if (strcmp (bfd_get_target (abfd), "a.out-i386-netbsd") == 0)
94
    return GDB_OSABI_NETBSD_AOUT;
95
 
96
  if (strcmp (bfd_get_target (abfd), "a.out-i386-freebsd") == 0)
97
    return GDB_OSABI_FREEBSD_AOUT;
98
 
99
  return GDB_OSABI_UNKNOWN;
100
}
101
 
102
static enum gdb_osabi
103
i386bsd_core_osabi_sniffer (bfd *abfd)
104
{
105
  if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
106
    return GDB_OSABI_NETBSD_AOUT;
107
 
108
  return GDB_OSABI_UNKNOWN;
109
}
110
 
111
 
112
/* Provide a prototype to silence -Wmissing-prototypes.  */
113
void _initialize_i386bsd_tdep (void);
114
 
115
void
116
_initialize_i386bsd_tdep (void)
117
{
118
  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_aout_flavour,
119
                                  i386bsd_aout_osabi_sniffer);
120
 
121
  /* BFD doesn't set a flavour for NetBSD style a.out core files.  */
122
  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_unknown_flavour,
123
                                  i386bsd_core_osabi_sniffer);
124
}

powered by: WebSVN 2.1.0

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