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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [sentinel-frame.c] - Blame information for rev 476

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

Line No. Rev Author Line
1 330 jeremybenn
/* Code dealing with register stack frames, for GDB, the GNU debugger.
2
 
3
   Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
4
   1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2008, 2009, 2010
5
   Free Software Foundation, Inc.
6
 
7
   This file is part of GDB.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 3 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
 
22
 
23
#include "defs.h"
24
#include "regcache.h"
25
#include "sentinel-frame.h"
26
#include "inferior.h"
27
#include "frame-unwind.h"
28
 
29
struct frame_unwind_cache
30
{
31
  struct regcache *regcache;
32
};
33
 
34
void *
35
sentinel_frame_cache (struct regcache *regcache)
36
{
37
  struct frame_unwind_cache *cache =
38
    FRAME_OBSTACK_ZALLOC (struct frame_unwind_cache);
39
 
40
  cache->regcache = regcache;
41
  return cache;
42
}
43
 
44
/* Here the register value is taken direct from the register cache.  */
45
 
46
static struct value *
47
sentinel_frame_prev_register (struct frame_info *this_frame,
48
                              void **this_prologue_cache,
49
                              int regnum)
50
{
51
  struct gdbarch *gdbarch = get_frame_arch (this_frame);
52
  struct frame_unwind_cache *cache = *this_prologue_cache;
53
  struct value *value;
54
 
55
  /* Return the actual value.  */
56
  value = allocate_value (register_type (gdbarch, regnum));
57
  VALUE_LVAL (value) = lval_register;
58
  VALUE_REGNUM (value) = regnum;
59
  VALUE_FRAME_ID (value) = get_frame_id (this_frame);
60
 
61
  /* Use the regcache_cooked_read() method so that it, on the fly,
62
     constructs either a raw or pseudo register from the raw
63
     register cache.  */
64
  regcache_cooked_read (cache->regcache, regnum, value_contents_raw (value));
65
 
66
  return value;
67
}
68
 
69
static void
70
sentinel_frame_this_id (struct frame_info *this_frame,
71
                        void **this_prologue_cache,
72
                        struct frame_id *this_id)
73
{
74
  /* The sentinel frame is used as a starting point for creating the
75
     previous (inner most) frame.  That frame's THIS_ID method will be
76
     called to determine the inner most frame's ID.  Not this one.  */
77
  internal_error (__FILE__, __LINE__, _("sentinel_frame_this_id called"));
78
}
79
 
80
static struct gdbarch *
81
sentinel_frame_prev_arch (struct frame_info *this_frame,
82
                          void **this_prologue_cache)
83
{
84
  struct frame_unwind_cache *cache = *this_prologue_cache;
85
 
86
  return get_regcache_arch (cache->regcache);
87
}
88
 
89
const struct frame_unwind sentinel_frame_unwinder =
90
{
91
  SENTINEL_FRAME,
92
  sentinel_frame_this_id,
93
  sentinel_frame_prev_register,
94
  NULL,
95
  NULL,
96
  NULL,
97
  sentinel_frame_prev_arch,
98
};
99
 
100
const struct frame_unwind *const sentinel_frame_unwind = &sentinel_frame_unwinder;

powered by: WebSVN 2.1.0

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