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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [sparc64-sol2-tdep.c] - Blame information for rev 353

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

Line No. Rev Author Line
1 24 jeremybenn
/* Target-dependent code for Solaris UltraSPARC.
2
 
3
   Copyright (C) 2003, 2004, 2006, 2007, 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 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 "frame.h"
22
#include "frame-unwind.h"
23
#include "gdbarch.h"
24
#include "symtab.h"
25
#include "objfiles.h"
26
#include "osabi.h"
27
#include "trad-frame.h"
28
 
29
#include "gdb_assert.h"
30
 
31
#include "sol2-tdep.h"
32
#include "sparc64-tdep.h"
33
#include "solib-svr4.h"
34
 
35
/* From <sys/regset.h>.  */
36
const struct sparc_gregset sparc64_sol2_gregset =
37
{
38
  32 * 8,                       /* "tstate" */
39
  33 * 8,                       /* %pc */
40
  34 * 8,                       /* %npc */
41
  35 * 8,                       /* %y */
42
  -1,                           /* %wim */
43
  -1,                           /* %tbr */
44
  1 * 8,                        /* %g1 */
45
  16 * 8,                       /* %l0 */
46
  8                             /* sizeof (%y) */
47
};
48
 
49
 
50
static struct sparc_frame_cache *
51
sparc64_sol2_sigtramp_frame_cache (struct frame_info *next_frame,
52
                                   void **this_cache)
53
{
54
  struct sparc_frame_cache *cache;
55
  CORE_ADDR mcontext_addr, addr;
56
  int regnum;
57
 
58
  if (*this_cache)
59
    return *this_cache;
60
 
61
  cache = sparc_frame_cache (next_frame, this_cache);
62
  gdb_assert (cache == *this_cache);
63
 
64
  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
65
 
66
  /* The third argument is a pointer to an instance of `ucontext_t',
67
     which has a member `uc_mcontext' that contains the saved
68
     registers.  */
69
  regnum = (cache->frameless_p ? SPARC_O2_REGNUM : SPARC_I2_REGNUM);
70
  mcontext_addr = frame_unwind_register_unsigned (next_frame, regnum) + 64;
71
 
72
  cache->saved_regs[SPARC64_CCR_REGNUM].addr = mcontext_addr + 0 * 8;
73
  cache->saved_regs[SPARC64_PC_REGNUM].addr = mcontext_addr + 1 * 8;
74
  cache->saved_regs[SPARC64_NPC_REGNUM].addr = mcontext_addr + 2 * 8;
75
  cache->saved_regs[SPARC64_Y_REGNUM].addr = mcontext_addr + 3 * 8;
76
  cache->saved_regs[SPARC64_ASI_REGNUM].addr = mcontext_addr + 19 * 8;
77
  cache->saved_regs[SPARC64_FPRS_REGNUM].addr = mcontext_addr + 20 * 8;
78
 
79
  /* Since %g0 is always zero, keep the identity encoding.  */
80
  for (regnum = SPARC_G1_REGNUM, addr = mcontext_addr + 4 * 8;
81
       regnum <= SPARC_O7_REGNUM; regnum++, addr += 8)
82
    cache->saved_regs[regnum].addr = addr;
83
 
84
  if (get_frame_memory_unsigned (next_frame, mcontext_addr + 21 * 8, 8))
85
    {
86
      /* The register windows haven't been flushed.  */
87
      for (regnum = SPARC_L0_REGNUM; regnum <= SPARC_I7_REGNUM; regnum++)
88
        trad_frame_set_unknown (cache->saved_regs, regnum);
89
    }
90
  else
91
    {
92
      CORE_ADDR sp;
93
 
94
      addr = cache->saved_regs[SPARC_SP_REGNUM].addr;
95
      sp = get_frame_memory_unsigned (next_frame, addr, 8);
96
      for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
97
           regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
98
        cache->saved_regs[regnum].addr = addr;
99
    }
100
 
101
  return cache;
102
}
103
 
104
static void
105
sparc64_sol2_sigtramp_frame_this_id (struct frame_info *next_frame,
106
                                     void **this_cache,
107
                                     struct frame_id *this_id)
108
{
109
  struct sparc_frame_cache *cache =
110
    sparc64_sol2_sigtramp_frame_cache (next_frame, this_cache);
111
 
112
  (*this_id) = frame_id_build (cache->base, cache->pc);
113
}
114
 
115
static void
116
sparc64_sol2_sigtramp_frame_prev_register (struct frame_info *next_frame,
117
                                           void **this_cache,
118
                                           int regnum, int *optimizedp,
119
                                           enum lval_type *lvalp,
120
                                           CORE_ADDR *addrp,
121
                                           int *realnump, gdb_byte *valuep)
122
{
123
  struct sparc_frame_cache *cache =
124
    sparc64_sol2_sigtramp_frame_cache (next_frame, this_cache);
125
 
126
  trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
127
                                optimizedp, lvalp, addrp, realnump, valuep);
128
}
129
 
130
static const struct frame_unwind sparc64_sol2_sigtramp_frame_unwind =
131
{
132
  SIGTRAMP_FRAME,
133
  sparc64_sol2_sigtramp_frame_this_id,
134
  sparc64_sol2_sigtramp_frame_prev_register
135
};
136
 
137
static const struct frame_unwind *
138
sparc64_sol2_sigtramp_frame_sniffer (struct frame_info *next_frame)
139
{
140
  CORE_ADDR pc = frame_pc_unwind (next_frame);
141
  char *name;
142
 
143
  find_pc_partial_function (pc, &name, NULL, NULL);
144
  if (sparc_sol2_pc_in_sigtramp (pc, name))
145
    return &sparc64_sol2_sigtramp_frame_unwind;
146
 
147
  return NULL;
148
}
149
 
150
 
151
void
152
sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
153
{
154
  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
155
 
156
  frame_unwind_append_sniffer (gdbarch, sparc64_sol2_sigtramp_frame_sniffer);
157
 
158
  sparc64_init_abi (info, gdbarch);
159
 
160
  /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO)
161
     compiler puts out 0 instead of the address in N_SO stabs.  Starting with
162
     SunPRO 3.0, the compiler does this for N_FUN stabs too.  */
163
  set_gdbarch_sofun_address_maybe_missing (gdbarch, 1);
164
 
165
  /* The Sun compilers also do "globalization"; see the comment in
166
     sparc_sol2_static_transform_name for more information.  */
167
  set_gdbarch_static_transform_name
168
    (gdbarch, sparc_sol2_static_transform_name);
169
 
170
  /* Solaris has SVR4-style shared libraries...  */
171
  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
172
  set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
173
  set_solib_svr4_fetch_link_map_offsets
174
    (gdbarch, svr4_lp64_fetch_link_map_offsets);
175
 
176
  /* ...which means that we need some special handling when doing
177
     prologue analysis.  */
178
  tdep->plt_entry_size = 16;
179
 
180
  /* Solaris has kernel-assisted single-stepping support.  */
181
  set_gdbarch_software_single_step (gdbarch, NULL);
182
}
183
 
184
 
185
/* Provide a prototype to silence -Wmissing-prototypes.  */
186
void _initialize_sparc64_sol2_tdep (void);
187
 
188
void
189
_initialize_sparc64_sol2_tdep (void)
190
{
191
  gdbarch_register_osabi (bfd_arch_sparc, bfd_mach_sparc_v9,
192
                          GDB_OSABI_SOLARIS, sparc64_sol2_init_abi);
193
}

powered by: WebSVN 2.1.0

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