15796c8dcSSimon Schubert /* Per-frame user registers, for GDB, the GNU debugger. 25796c8dcSSimon Schubert 3*ef5ccd6cSJohn Marino Copyright (C) 2002-2013 Free Software Foundation, Inc. 45796c8dcSSimon Schubert 55796c8dcSSimon Schubert Contributed by Red Hat. 65796c8dcSSimon Schubert 75796c8dcSSimon Schubert This file is part of GDB. 85796c8dcSSimon Schubert 95796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 105796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 115796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 125796c8dcSSimon Schubert (at your option) any later version. 135796c8dcSSimon Schubert 145796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 155796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 165796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 175796c8dcSSimon Schubert GNU General Public License for more details. 185796c8dcSSimon Schubert 195796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 205796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 215796c8dcSSimon Schubert 225796c8dcSSimon Schubert #ifndef USER_REGS_H 235796c8dcSSimon Schubert #define USER_REGS_H 245796c8dcSSimon Schubert 255796c8dcSSimon Schubert /* Implement both builtin, and architecture specific, per-frame user 265796c8dcSSimon Schubert visible registers. 275796c8dcSSimon Schubert 285796c8dcSSimon Schubert Builtin registers apply to all architectures, where as architecture 295796c8dcSSimon Schubert specific registers are present when the architecture is selected. 305796c8dcSSimon Schubert 315796c8dcSSimon Schubert These registers are assigned register numbers outside the 325796c8dcSSimon Schubert architecture's register range 335796c8dcSSimon Schubert [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs]. 345796c8dcSSimon Schubert Their values should be constructed using per-frame information. */ 355796c8dcSSimon Schubert 365796c8dcSSimon Schubert /* TODO: cagney/2003-06-27: Need to think more about how these 375796c8dcSSimon Schubert registers are added, read, and modified. At present they are kind 385796c8dcSSimon Schubert of assumed to be read-only. Should it, for instance, return a 395796c8dcSSimon Schubert register descriptor that contains all the relvent access methods. */ 405796c8dcSSimon Schubert 415796c8dcSSimon Schubert struct frame_info; 425796c8dcSSimon Schubert struct gdbarch; 435796c8dcSSimon Schubert 445796c8dcSSimon Schubert /* Given an architecture, map a user visible register name onto its 455796c8dcSSimon Schubert index. */ 465796c8dcSSimon Schubert 475796c8dcSSimon Schubert extern int user_reg_map_name_to_regnum (struct gdbarch *gdbarch, 485796c8dcSSimon Schubert const char *str, int len); 495796c8dcSSimon Schubert 505796c8dcSSimon Schubert extern const char *user_reg_map_regnum_to_name (struct gdbarch *gdbarch, 515796c8dcSSimon Schubert int regnum); 525796c8dcSSimon Schubert 535796c8dcSSimon Schubert /* Return the value of the frame register in the specified frame. 545796c8dcSSimon Schubert 555796c8dcSSimon Schubert Note; These methods return a "struct value" instead of the raw 565796c8dcSSimon Schubert bytes as, at the time the register is being added, the type needed 575796c8dcSSimon Schubert to describe the register has not bee initialized. */ 585796c8dcSSimon Schubert 595796c8dcSSimon Schubert typedef struct value *(user_reg_read_ftype) (struct frame_info *frame, 605796c8dcSSimon Schubert const void *baton); 615796c8dcSSimon Schubert extern struct value *value_of_user_reg (int regnum, struct frame_info *frame); 625796c8dcSSimon Schubert 635796c8dcSSimon Schubert /* Add a builtin register (present in all architectures). */ 645796c8dcSSimon Schubert extern void user_reg_add_builtin (const char *name, 65c50c785cSJohn Marino user_reg_read_ftype *read, 66c50c785cSJohn Marino const void *baton); 675796c8dcSSimon Schubert 685796c8dcSSimon Schubert /* Add a per-architecture frame register. */ 695796c8dcSSimon Schubert extern void user_reg_add (struct gdbarch *gdbarch, const char *name, 705796c8dcSSimon Schubert user_reg_read_ftype *read, const void *baton); 715796c8dcSSimon Schubert 725796c8dcSSimon Schubert #endif 73