This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
RFA: gdbarch_free
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: RFA: gdbarch_free
- From: Jim Blandy <jimb at cygnus dot com>
- Date: Mon, 28 Feb 2000 18:02:01 -0500 (EST)
There are no uses for this yet, except in some code that's not ready
for release yet.
2000-02-28 Jim Blandy <jimb@redhat.com>
* gdbarch.sh: Emit a definition and declaration for gdbarch_free,
a companion to gdbarch_alloc, which allows a gdbarch init function
to free partially-built gdbarch structures.
* gdbarch.c, gdbarch.h: Regenerated.
Index: gdb/gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.4
diff -c -r1.4 gdbarch.sh
*** gdbarch.sh 2000/02/23 02:42:40 1.4
--- gdbarch.sh 2000/02/28 23:01:13
***************
*** 512,517 ****
--- 512,521 ----
extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
+ /* Helper function. Free a partially-constructed \`\`struct gdbarch''. */
+ extern void gdbarch_free (struct gdbarch *);
+
+
/* Helper function. Force an update of the current architecture. Used
by legacy targets that have added their own target specific
architecture manipulation commands.
***************
*** 958,963 ****
--- 962,984 ----
/* gdbarch_alloc() */
return gdbarch;
+ }
+ EOF
+
+ # Free a gdbarch struct.
+ echo ""
+ echo ""
+ cat <<EOF
+ /* Free a gdbarch struct. This should never happen in normal
+ operation --- once you've created a gdbarch, you keep it around.
+ However, if an architecture's init function encounters an error
+ building the structure, it may need to clean up a partially
+ constructed gdbarch. */
+ void
+ gdbarch_free (struct gdbarch *arch)
+ {
+ /* At the moment, this is trivial. */
+ free (arch);
}
EOF
Index: gdb/gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.3
diff -c -r1.3 gdbarch.c
*** gdbarch.c 2000/02/22 19:17:27 1.3
--- gdbarch.c 2000/02/28 23:01:16
***************
*** 357,362 ****
--- 357,375 ----
}
+ /* Free a gdbarch struct. This should never happen in normal
+ operation --- once you've created a gdbarch, you keep it around.
+ However, if an architecture's init function encounters an error
+ building the structure, it may need to clean up a partially
+ constructed gdbarch. */
+ void
+ gdbarch_free (struct gdbarch *arch)
+ {
+ /* At the moment, this is trivial. */
+ free (arch);
+ }
+
+
/* Ensure that all values in a GDBARCH are reasonable. */
static void
Index: gdb/gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.3
diff -c -r1.3 gdbarch.h
*** gdbarch.h 2000/02/23 02:42:40 1.3
--- gdbarch.h 2000/02/28 23:01:18
***************
*** 909,914 ****
--- 909,918 ----
extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
+ /* Helper function. Free a partially-constructed ``struct gdbarch''. */
+ extern void gdbarch_free (struct gdbarch *);
+
+
/* Helper function. Force an update of the current architecture. Used
by legacy targets that have added their own target specific
architecture manipulation commands.