Adrian had further crashes with this code (from November 2006 ...) but it
just bit me again, and looking at the backtraces now, they are independent
bugs. I’ll forward them to xemacs-beta, since he sent them to me privately
(which I didn’t realise at the time.)
APPROVE COMMIT
NOTE: This patch has been committed.
src/ChangeLog addition:
2006-11-26 Aidan Kehoe <kehoea(a)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.
XEmacs Trunk source patch:
Diff command: cvs -q diff -Nu
Files affected: src/eval.c
===================================================================
RCS src/profile.h
===================================================================
RCS
Index: src/profile.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/profile.h,v
retrieving revision 1.4
diff -u -u -r1.4 profile.h
--- src/profile.h 2006/03/14 19:31:43 1.4
+++ src/profile.h 2007/09/04 21:09:39
@@ -47,11 +47,18 @@
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 @@
#define PROFILE_EXIT_FUNCTION() \
do \
{ \
- if (profiling_active) \
+ if (profiling_active && do_backtrace) \
profile_record_just_called (&backtrace); \
} \
while (0)
Index: src/eval.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/eval.c,v
retrieving revision 1.98
diff -u -u -r1.98 eval.c
--- src/eval.c 2007/08/08 14:54:43 1.98
+++ src/eval.c 2007/09/04 21:09:41
@@ -3100,7 +3100,7 @@
/* 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 @@
/* 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 @@
/* 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;
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches