Branch: Tag:

2003-01-08

2003-01-08 19:35:42 by Martin Stjernholm <mast@lysator.liu.se>

Fixed thread local trace flags that broke way back in 7.1.10. Took away the
--without-thread-trace configure option to make the trace flag always exist
in one place. Instead the trace() function is extended to be able to set the
trace flag in all threads.

Rev: src/acconfig.h:1.111
Rev: src/builtin.cmod:1.104
Rev: src/configure.in:1.673
Rev: src/interpret.h:1.121
Rev: src/main.c:1.161
Rev: src/main.h:1.21
Rev: src/opcodes.c:1.130
Rev: src/pike_threadlib.h:1.26

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin.cmod,v 1.103 2003/01/08 14:00:53 grubba Exp $ + || $Id: builtin.cmod,v 1.104 2003/01/08 19:35:42 mast Exp $   */      #include "global.h"
316:    RETURN mkmultiset(a);   }    - /*! @decl int trace(int t) + /*! @decl int trace(int trace_level, void|int all_threads)    *!    *! This function changes the debug trace level.    *! -  *! The old level is returned. -  *! +     *! Trace level 1 or higher means that calls to Pike functions are    *! printed to stderr, level 2 or higher means calls to builtin functions    *! are printed, 3 means every opcode interpreted is printed, 4 means    *! arguments to these opcodes are printed as well.    *!    *! See the @tt{-t@} command-line option for more information. -  +  *! +  *! @param trace_level +  *! The new trace level. +  *! +  *! @param all_threads +  *! The trace level is set in all threads if this is nonzero. +  *! Otherwise only the trace level in the current thread is +  *! affected. Setting it in all threads can be useful to track down +  *! deadlock bugs etc. +  *! +  *! @returns +  *! The old level in the current thread is returned.    */ - PIKEFUN int trace(int t) + PIKEFUN int trace(int t, void|int all_threads)    efun;    optflags OPT_SIDE_EFFECT;   {    pop_n_elems(args);    push_int(t_flag); -  + #ifdef PIKE_THREADS +  if (!all_threads || UNSAFE_IS_ZERO (all_threads))    t_flag=t; -  +  else { +  struct thread_state *s; +  FOR_EACH_THREAD(s, s->state.trace_level = t);    } -  + #else +  t_flag=t; + #endif + }      /*! @decl string ctime(int timestamp)    *!