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] Accessors for CFI's frame->context


Hello,

This adds accessor methods for the CFI code's `struct context context' field of `struct frame_info'.

The accessors are identified as deprecated since, instead of using this dedicated field, the CFI code should, like the dummy-frame.c code, instead be a cfi-frame object that uses the unwind cache.

committed,
Andrew
2003-01-07  Andrew Cagney  <cagney@redhat.com>

	* frame.c (deprecated_get_frame_context): New function.
	(deprecated_set_frame_context): New function.
	* frame.h (deprecated_get_frame_context): Declare.
	(deprecated_set_frame_context): Declare.
	* dwarf2cfi.c (UNWIND_CONTEXT): Use deprecated_get_frame_context.
	(cfi_init_extra_frame_info): Use deprecated_set_frame_context.
	
Index: dwarf2cfi.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2cfi.c,v
retrieving revision 1.24
diff -u -r1.24 dwarf2cfi.c
--- dwarf2cfi.c	2 Jan 2003 22:20:46 -0000	1.24
+++ dwarf2cfi.c	7 Jan 2003 22:52:01 -0000
@@ -156,7 +156,7 @@
   PE_funcrel = DW_EH_PE_funcrel
 };
 
-#define UNWIND_CONTEXT(fi) ((struct context *) (fi->context))
+#define UNWIND_CONTEXT(fi) ((struct context *) (deprecated_get_frame_context (fi)))
 
 
 static struct cie_unit *cie_chunks;
@@ -1770,7 +1770,7 @@
   unwind_tmp_obstack_init ();
 
   fs = frame_state_alloc ();
-  fi->context = frame_obstack_alloc (sizeof (struct context));
+  deprecated_set_frame_context (fi, frame_obstack_alloc (sizeof (struct context)));
   UNWIND_CONTEXT (fi)->reg =
     frame_obstack_alloc (sizeof (struct context_reg) * NUM_REGS);
   memset (UNWIND_CONTEXT (fi)->reg, 0,
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.54
diff -u -r1.54 frame.c
--- frame.c	7 Jan 2003 19:19:00 -0000	1.54
+++ frame.c	7 Jan 2003 22:52:01 -0000
@@ -1322,6 +1322,19 @@
   fi->prev = prev;
 }
 
+struct context *
+deprecated_get_frame_context (struct frame_info *fi)
+{
+  return fi->context;
+}
+
+void
+deprecated_set_frame_context (struct frame_info *fi,
+			      struct context *context)
+{
+  fi->context = context;
+}
+
 struct frame_info *
 deprecated_frame_xmalloc (void)
 {
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.57
diff -u -r1.57 frame.h
--- frame.h	7 Jan 2003 19:19:00 -0000	1.57
+++ frame.h	7 Jan 2003 22:52:02 -0000
@@ -701,4 +701,16 @@
 extern void deprecated_set_frame_prev_hack (struct frame_info *fi,
 					    struct frame_info *prev);
 
+/* FIXME: cagney/2003-01-07: Instead of the dwarf2cfi having its own
+   dedicated `struct frame_info . context' field, the code should use
+   the per frame `unwind_cache' that is passed to the
+   frame_pc_unwind(), frame_register_unwind() and frame_id_unwind()
+   methods.
+
+   See "dummy-frame.c" for an example of how a cfi-frame object can be
+   implemented using this.  */
+extern struct context *deprecated_get_frame_context (struct frame_info *fi);
+extern void deprecated_set_frame_context (struct frame_info *fi,
+					  struct context *context);
+
 #endif /* !defined (FRAME_H)  */

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