1*5796c8dcSSimon Schubert /* Manage register sets. 2*5796c8dcSSimon Schubert 3*5796c8dcSSimon Schubert Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc. 4*5796c8dcSSimon Schubert 5*5796c8dcSSimon Schubert This file is part of GDB. 6*5796c8dcSSimon Schubert 7*5796c8dcSSimon Schubert This program is free software; you can redistribute it and/or modify 8*5796c8dcSSimon Schubert it under the terms of the GNU General Public License as published by 9*5796c8dcSSimon Schubert the Free Software Foundation; either version 3 of the License, or 10*5796c8dcSSimon Schubert (at your option) any later version. 11*5796c8dcSSimon Schubert 12*5796c8dcSSimon Schubert This program is distributed in the hope that it will be useful, 13*5796c8dcSSimon Schubert but WITHOUT ANY WARRANTY; without even the implied warranty of 14*5796c8dcSSimon Schubert MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*5796c8dcSSimon Schubert GNU General Public License for more details. 16*5796c8dcSSimon Schubert 17*5796c8dcSSimon Schubert You should have received a copy of the GNU General Public License 18*5796c8dcSSimon Schubert along with this program. If not, see <http://www.gnu.org/licenses/>. */ 19*5796c8dcSSimon Schubert 20*5796c8dcSSimon Schubert #include "defs.h" 21*5796c8dcSSimon Schubert #include "regset.h" 22*5796c8dcSSimon Schubert 23*5796c8dcSSimon Schubert #include "gdb_assert.h" 24*5796c8dcSSimon Schubert 25*5796c8dcSSimon Schubert /* Allocate a fresh 'struct regset' whose supply_regset function is 26*5796c8dcSSimon Schubert SUPPLY_REGSET, and whose collect_regset function is COLLECT_REGSET. 27*5796c8dcSSimon Schubert If the regset has no collect_regset function, pass NULL for 28*5796c8dcSSimon Schubert COLLECT_REGSET. 29*5796c8dcSSimon Schubert 30*5796c8dcSSimon Schubert The object returned is allocated on ARCH's obstack. */ 31*5796c8dcSSimon Schubert 32*5796c8dcSSimon Schubert struct regset * 33*5796c8dcSSimon Schubert regset_alloc (struct gdbarch *arch, 34*5796c8dcSSimon Schubert supply_regset_ftype *supply_regset, 35*5796c8dcSSimon Schubert collect_regset_ftype *collect_regset) 36*5796c8dcSSimon Schubert { 37*5796c8dcSSimon Schubert struct regset *regset = GDBARCH_OBSTACK_ZALLOC (arch, struct regset); 38*5796c8dcSSimon Schubert 39*5796c8dcSSimon Schubert regset->arch = arch; 40*5796c8dcSSimon Schubert regset->supply_regset = supply_regset; 41*5796c8dcSSimon Schubert regset->collect_regset = collect_regset; 42*5796c8dcSSimon Schubert 43*5796c8dcSSimon Schubert return regset; 44*5796c8dcSSimon Schubert } 45