# New Ticket Created by  Jason Gloudon 
# Please include the string:  [perl #19334]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=19334 >



Trying to run parrot with the PARROT_GC_DEBUG environment variable set to 1
causes parrot to fail during initialization.

The GC_DEBUG flag is set early based on the environment variable, but the
marker for the top of the C stack is not set so non-rooted PMCs created during
initialization are wrongly collected.

The patch sets the stack top pointer at the time the GC_DEBUG flag is set.

> set | grep PARRO
PARROT_GC_DEBUG=1
> ./parrot
Segmentation fault
> unset PARROT_GC_DEBUG
> ./parrot
Usage: parrot [switches] [--] programfile [arguments]
  -b    Activate bounds checks
  -d    Activate debugging
  -h    Display this message
  -j    Activate Just-In-Time compiler
  -p    Activate profiling
  -P    Activate predereferencing
  -g    Deactivate computed goto
  -t    Activate tracing
  -v    Display version information
  -.    Wait for a keypress (gives Windows users time to attach a debugger)
  --gc-debug
        Enable garbage collection debugging mode. This may also be enabled
        by setting the environment variable $PARROT_GC_DEBUG to 1.


-- 
Jason


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/46028/36011/bb8555/gcdebug.patch

Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.123
diff -u -r1.123 interpreter.c
--- interpreter.c       14 Dec 2002 23:44:49 -0000      1.123
+++ interpreter.c       21 Dec 2002 19:56:05 -0000
@@ -417,6 +417,7 @@
     if (env_var_set("PARROT_GC_DEBUG")) {
 #if ! DISABLE_GC_DEBUG
         Interp_flags_SET(interpreter, PARROT_GC_DEBUG_FLAG);
+       interpreter->lo_var_ptr = &interpreter;
 #else
         fprintf(stderr, "PARROT_GC_DEBUG is set but the binary was compiled "
                 "with DISABLE_GC_DEBUG.\n");

Reply via email to