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

Subversion Repositories openrisc_me

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

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

Line No. Rev Author Line
1 330 jeremybenn
/* Definitions for frame address handler, for GDB, the GNU debugger.
2
 
3
   Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
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 "frame-base.h"
23
#include "frame.h"
24
#include "gdb_obstack.h"
25
 
26
/* A default frame base implementations.  If it wasn't for the old
27
   DEPRECATED_FRAME_LOCALS_ADDRESS and DEPRECATED_FRAME_ARGS_ADDRESS,
28
   these could be combined into a single function.  All architectures
29
   really need to override this.  */
30
 
31
static CORE_ADDR
32
default_frame_base_address (struct frame_info *this_frame, void **this_cache)
33
{
34
  return get_frame_base (this_frame); /* sigh! */
35
}
36
 
37
static CORE_ADDR
38
default_frame_locals_address (struct frame_info *this_frame, void **this_cache)
39
{
40
  return default_frame_base_address (this_frame, this_cache);
41
}
42
 
43
static CORE_ADDR
44
default_frame_args_address (struct frame_info *this_frame, void **this_cache)
45
{
46
  return default_frame_base_address (this_frame, this_cache);
47
}
48
 
49
const struct frame_base default_frame_base = {
50
  NULL, /* No parent.  */
51
  default_frame_base_address,
52
  default_frame_locals_address,
53
  default_frame_args_address
54
};
55
 
56
static struct gdbarch_data *frame_base_data;
57
 
58
struct frame_base_table_entry
59
{
60
  frame_base_sniffer_ftype *sniffer;
61
  struct frame_base_table_entry *next;
62
};
63
 
64
struct frame_base_table
65
{
66
  struct frame_base_table_entry *head;
67
  struct frame_base_table_entry **tail;
68
  const struct frame_base *default_base;
69
};
70
 
71
static void *
72
frame_base_init (struct obstack *obstack)
73
{
74
  struct frame_base_table *table
75
    = OBSTACK_ZALLOC (obstack, struct frame_base_table);
76
 
77
  table->tail = &table->head;
78
  table->default_base = &default_frame_base;
79
  return table;
80
}
81
 
82
void
83
frame_base_append_sniffer (struct gdbarch *gdbarch,
84
                           frame_base_sniffer_ftype *sniffer)
85
{
86
  struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data);
87
 
88
  (*table->tail) = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct frame_base_table_entry);
89
  (*table->tail)->sniffer = sniffer;
90
  table->tail = &(*table->tail)->next;
91
}
92
 
93
void
94
frame_base_set_default (struct gdbarch *gdbarch,
95
                        const struct frame_base *default_base)
96
{
97
  struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data);
98
 
99
  table->default_base = default_base;
100
}
101
 
102
const struct frame_base *
103
frame_base_find_by_frame (struct frame_info *this_frame)
104
{
105
  struct gdbarch *gdbarch = get_frame_arch (this_frame);
106
  struct frame_base_table *table = gdbarch_data (gdbarch, frame_base_data);
107
  struct frame_base_table_entry *entry;
108
 
109
  for (entry = table->head; entry != NULL; entry = entry->next)
110
    {
111
      const struct frame_base *desc = NULL;
112
 
113
      desc = entry->sniffer (this_frame);
114
      if (desc != NULL)
115
        return desc;
116
    }
117
  return table->default_base;
118
}
119
 
120
extern initialize_file_ftype _initialize_frame_base; /* -Wmissing-prototypes */
121
 
122
void
123
_initialize_frame_base (void)
124
{
125
  frame_base_data = gdbarch_data_register_pre_init (frame_base_init);
126
}

powered by: WebSVN 2.1.0

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