This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFA: gdbarch_free



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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]