1130803Smarcel/* Per-frame user registers, for GDB, the GNU debugger.
2130803Smarcel
3130803Smarcel   Copyright 2002, 2003 Free Software Foundation, Inc.
4130803Smarcel
5130803Smarcel   Contributed by Red Hat.
6130803Smarcel
7130803Smarcel   This file is part of GDB.
8130803Smarcel
9130803Smarcel   This program is free software; you can redistribute it and/or modify
10130803Smarcel   it under the terms of the GNU General Public License as published by
11130803Smarcel   the Free Software Foundation; either version 2 of the License, or
12130803Smarcel   (at your option) any later version.
13130803Smarcel
14130803Smarcel   This program is distributed in the hope that it will be useful,
15130803Smarcel   but WITHOUT ANY WARRANTY; without even the implied warranty of
16130803Smarcel   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17130803Smarcel   GNU General Public License for more details.
18130803Smarcel
19130803Smarcel   You should have received a copy of the GNU General Public License
20130803Smarcel   along with this program; if not, write to the Free Software
21130803Smarcel   Foundation, Inc., 59 Temple Place - Suite 330,
22130803Smarcel   Boston, MA 02111-1307, USA.  */
23130803Smarcel
24130803Smarcel#ifndef USER_REGS_H
25130803Smarcel#define USER_REGS_H
26130803Smarcel
27130803Smarcel/* Implement both builtin, and architecture specific, per-frame user
28130803Smarcel   visible registers.
29130803Smarcel
30130803Smarcel   Builtin registers apply to all architectures, where as architecture
31130803Smarcel   specific registers are present when the architecture is selected.
32130803Smarcel
33130803Smarcel   These registers are assigned register numbers outside the
34130803Smarcel   architecture's register range [0 .. NUM_REGS + NUM_PSEUDO_REGS).
35130803Smarcel   Their values should be constructed using per-frame information.  */
36130803Smarcel
37130803Smarcel/* TODO: cagney/2003-06-27: Need to think more about how these
38130803Smarcel   registers are added, read, and modified.  At present they are kind
39130803Smarcel   of assumed to be read-only.  Should it, for instance, return a
40130803Smarcel   register descriptor that contains all the relvent access methods.  */
41130803Smarcel
42130803Smarcelstruct frame_info;
43130803Smarcelstruct gdbarch;
44130803Smarcel
45130803Smarcel/* Given an architecture, map a user visible register name onto its
46130803Smarcel   index.  */
47130803Smarcel
48130803Smarcelextern int user_reg_map_name_to_regnum (struct gdbarch *gdbarch,
49130803Smarcel					const char *str, int len);
50130803Smarcel
51130803Smarcelextern const char *user_reg_map_regnum_to_name (struct gdbarch *gdbarch,
52130803Smarcel						int regnum);
53130803Smarcel
54130803Smarcel/* Return the value of the frame register in the specified frame.
55130803Smarcel
56130803Smarcel   Note; These methods return a "struct value" instead of the raw
57130803Smarcel   bytes as, at the time the register is being added, the type needed
58130803Smarcel   to describe the register has not bee initialized.  */
59130803Smarcel
60130803Smarceltypedef struct value *(user_reg_read_ftype) (struct frame_info *frame);
61130803Smarcelextern struct value *value_of_user_reg (int regnum, struct frame_info *frame);
62130803Smarcel
63130803Smarcel/* Add a builtin register (present in all architectures).  */
64130803Smarcelextern void user_reg_add_builtin (const char *name,
65130803Smarcel				  user_reg_read_ftype *read);
66130803Smarcel
67130803Smarcel/* Add a per-architecture frame register.  */
68130803Smarcelextern void user_reg_add (struct gdbarch *gdbarch, const char *name,
69130803Smarcel			  user_reg_read_ftype *read);
70130803Smarcel
71130803Smarcel#endif
72