CVS update by aidan xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Tue Sep 4 17:20:48 EDT 2007


  User: aidan   
  Date: 07/09/04 23:20:48

  Modified:    xemacs/src ChangeLog profile.h eval.c
Log:
Eliminate a crash when profiling; only pass the backtrace record to
profile_record_about_to_call, profile_record_just_called when it's non-nil.

Revision  Changes    Path
1.1094    +13 -0     XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1093
retrieving revision 1.1094
diff -u -p -r1.1093 -r1.1094
--- ChangeLog	2007/08/28 09:49:36	1.1093
+++ ChangeLog	2007/09/04 21:20:18	1.1094
@@ -1,3 +1,16 @@
+2006-11-26  Aidan Kehoe  <kehoea at parhasard.net>
+
+	* eval.c (Fcommand_execute):
+	* eval.c (Feval):
+	* eval.c (Ffuncall):
+	Use the PROFILE_DECLARE macro instead of declaring `struct
+	backtrace backtrace' by hand. 
+	* profile.h:
+	* profile.h (PROFILE_EXIT_FUNCTION):
+	* profile.h (PROFILE_ENTER_FUNCTION):
+	Check do_backtrace before passing the backtrace structure to
+	profile_record_about_to_call, profile_record_just_called. 
+
 2007-08-28  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* mule-ccl.c (ccl_driver):



1.5       +10 -3     XEmacs/xemacs/src/profile.h

Index: profile.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/profile.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- profile.h	2006/03/14 19:31:43	1.4
+++ profile.h	2007/09/04 21:20:26	1.5
@@ -47,11 +47,18 @@ struct backtrace backtrace
    This ensures correct behavior (e.g. we never modify the profiling info
    when profiling is not active) because we seed and reap all functions
    currently on the stack when starting and stopping.  See
-   `start-profiling'. */
+   `start-profiling'.
+
+   We check do_backtrace to make sure that the backtrace structure is
+   initialised. If it isn't, we can enter a function with profiling turned
+   off, and exit it with it turned on, with the consequence that an
+   unitialised backtrace structure is passed to
+   profile_record_just_called. Since do_backtrace is function-local (apart
+   from in the garbage collector) this avoids that.  */
 #define PROFILE_ENTER_FUNCTION()		\
 do						\
 {						\
-  if (profiling_active)				\
+  if (profiling_active && do_backtrace)		\
     profile_record_about_to_call (&backtrace);	\
 }						\
 while (0)
@@ -59,7 +66,7 @@ while (0)
 #define PROFILE_EXIT_FUNCTION()			\
 do						\
 {						\
-  if (profiling_active)				\
+  if (profiling_active && do_backtrace)		\
     profile_record_just_called (&backtrace);	\
 }						\
 while (0)



1.99      +3 -3      XEmacs/xemacs/src/eval.c

Index: eval.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/eval.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -p -r1.98 -r1.99
--- eval.c	2007/08/08 14:54:43	1.98
+++ eval.c	2007/09/04 21:20:26	1.99
@@ -3100,7 +3100,7 @@ when reading the arguments.
   /* This function can GC */
   Lisp_Object prefixarg;
   Lisp_Object final = cmd;
-  struct backtrace backtrace;
+  PROFILE_DECLARE();
   struct console *con = XCONSOLE (Vselected_console);
 
   prefixarg = con->prefix_arg;
@@ -3533,7 +3533,7 @@ Evaluate FORM and return its value.
   /* This function can GC */
   Lisp_Object fun, val, original_fun, original_args;
   int nargs;
-  struct backtrace backtrace;
+  PROFILE_DECLARE();
 
 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
   check_proper_critical_section_lisp_protection ();
@@ -3841,7 +3841,7 @@ Thus, (funcall 'cons 'x 'y) returns (x .
   /* This function can GC */
   Lisp_Object fun;
   Lisp_Object val;
-  struct backtrace backtrace;
+  PROFILE_DECLARE();
   int fun_nargs = nargs - 1;
   Lisp_Object *fun_args = args + 1;
 





More information about the XEmacs-CVS mailing list