* gdbarch.sh: Emit a definition and declaration for gdbarch_free,
authorJim Blandy <jimb@codesourcery.com>
Tue, 21 Mar 2000 20:40:43 +0000 (20:40 +0000)
committerJim Blandy <jimb@codesourcery.com>
Tue, 21 Mar 2000 20:40:43 +0000 (20:40 +0000)
a companion to gdbarch_alloc, which allows a gdbarch init function
to free partially-built gdbarch structures.
* gdbarch.c, gdbarch.h: Regenerated.

gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh

index f33536d..b23ec91 100644 (file)
@@ -357,6 +357,19 @@ gdbarch_alloc (const struct gdbarch_info *info,
 }
 
 
+/* 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 ee695ab..8d37120 100644 (file)
@@ -909,6 +909,10 @@ extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *ar
 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.
index 66e16c5..32b8d94 100755 (executable)
@@ -512,6 +512,10 @@ extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *ar
 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.
@@ -961,6 +965,23 @@ cat <<EOF
 }
 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
+
 # verify a new architecture
 echo ""
 echo ""