Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / gdb-7 / gdb / user-regs.h
1 /* Per-frame user registers, for GDB, the GNU debugger.
2
3    Copyright (C) 2002, 2003, 2007, 2008, 2009, 2010, 2011
4    Free Software Foundation, Inc.
5
6    Contributed by Red Hat.
7
8    This file is part of GDB.
9
10    This program is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3 of the License, or
13    (at your option) any later version.
14
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
23 #ifndef USER_REGS_H
24 #define USER_REGS_H
25
26 /* Implement both builtin, and architecture specific, per-frame user
27    visible registers.
28
29    Builtin registers apply to all architectures, where as architecture
30    specific registers are present when the architecture is selected.
31
32    These registers are assigned register numbers outside the
33    architecture's register range
34    [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs].
35    Their values should be constructed using per-frame information.  */
36
37 /* TODO: cagney/2003-06-27: Need to think more about how these
38    registers are added, read, and modified.  At present they are kind
39    of assumed to be read-only.  Should it, for instance, return a
40    register descriptor that contains all the relvent access methods.  */
41
42 struct frame_info;
43 struct gdbarch;
44
45 /* Given an architecture, map a user visible register name onto its
46    index.  */
47
48 extern int user_reg_map_name_to_regnum (struct gdbarch *gdbarch,
49                                         const char *str, int len);
50
51 extern const char *user_reg_map_regnum_to_name (struct gdbarch *gdbarch,
52                                                 int regnum);
53
54 /* Return the value of the frame register in the specified frame.
55
56    Note; These methods return a "struct value" instead of the raw
57    bytes as, at the time the register is being added, the type needed
58    to describe the register has not bee initialized.  */
59
60 typedef struct value *(user_reg_read_ftype) (struct frame_info *frame,
61                                              const void *baton);
62 extern struct value *value_of_user_reg (int regnum, struct frame_info *frame);
63
64 /* Add a builtin register (present in all architectures).  */
65 extern void user_reg_add_builtin (const char *name,
66                                   user_reg_read_ftype *read,
67                                   const void *baton);
68
69 /* Add a per-architecture frame register.  */
70 extern void user_reg_add (struct gdbarch *gdbarch, const char *name, 
71                           user_reg_read_ftype *read, const void *baton);
72
73 #endif