This is the mail archive of the gdb-patches@sources.redhat.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]
Other format: [Raw text]

[commit] frame_extra_info_zalloc()


Hello,

The attached adds the method:
struct frame_extra_info *
frame_extra_info_zalloc(fi, sizeof extra info)
to frame.[hc]. It makes it possible for non-frame code to initialize the extra info field.

I should note that I also experimented with modifying INIT_EXTRA_FRAME_INFO so that it returned the initialized extra info (instead of directly setting it). I found, though, that tdep files do strange things such as initializing extra info in strange places. Hence, I think this method is easier.

A follow-up patch will modify the init extra info code so that it uses it.

committed,
Andrew
2002-12-13  Andrew Cagney  <ac131313@redhat.com>

	* frame.c (frame_extra_info_zalloc): New function.
	* frame.h (frame_extra_info_zalloc): Declare.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.42
diff -u -r1.42 frame.c
--- frame.c	12 Dec 2002 00:56:44 -0000	1.42
+++ frame.c	13 Dec 2002 16:06:49 -0000
@@ -1209,6 +1209,14 @@
   return fi->extra_info;
 }
 
+struct frame_extra_info *
+frame_extra_info_zalloc (struct frame_info *fi, long size)
+{
+  fi->extra_info = frame_obstack_alloc (size);
+  memset (fi->extra_info, 0, size);
+  return fi->extra_info;
+}
+
 void
 _initialize_frame (void)
 {
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.46
diff -u -r1.46 frame.h
--- frame.h	12 Dec 2002 00:56:44 -0000	1.46
+++ frame.h	13 Dec 2002 16:06:59 -0000
@@ -644,11 +644,12 @@
 extern struct frame_info *create_new_frame (CORE_ADDR, CORE_ADDR);
 
 
-/* NOTE: cagney/2002-12-10:
-
-   Let older code access the member `extra_info'.  This member is
-   always initialized during frame creation so is always non-null.  */
+/* Create/access the frame's `extra info'.  The extra info is used by
+   older code to store information such as the analyzed prologue.  The
+   zalloc() should only be called by the INIT_EXTRA_INFO method.  */
 
+extern struct frame_extra_info *frame_extra_info_zalloc (struct frame_info *fi,
+							 long size);
 extern struct frame_extra_info *get_frame_extra_info (struct frame_info *fi);
 
 #endif /* !defined (FRAME_H)  */

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