[pypy-commit] lang-smalltalk storage: Added trace option to only show process switches, stack overflows and sender chain manipulations.

anton_gulenko noreply at buildbot.pypy.org
Sun Jul 27 12:22:20 CEST 2014


Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage
Changeset: r957:4e239fce82f4
Date: 2014-07-26 10:24 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/4e239fce82f4/

Log:	Added trace option to only show process switches, stack overflows
	and sender chain manipulations.

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -58,7 +58,7 @@
 
 class Interpreter(object):
     _immutable_fields_ = ["space", "image",
-                          "interrupt_counter_size",
+                          "interrupt_counter_size", "trace_important",
                           "startup_time", "evented", "interrupts"]
 
     jit_driver = jit.JitDriver(
@@ -68,7 +68,7 @@
         get_printable_location=get_printable_location
     )
 
-    def __init__(self, space, image=None,
+    def __init__(self, space, image=None, trace_important=False,
                 trace=False, evented=True, interrupts=True):
         # === Initialize immutable variables
         self.space = space
@@ -79,6 +79,7 @@
             self.startup_time = constants.CompileTime
         self.evented = evented
         self.interrupts = interrupts
+        self.trace_important = trace_important
         try:
             self.interrupt_counter_size = int(os.environ["SPY_ICS"])
         except KeyError:
@@ -100,7 +101,7 @@
                 self.loop_bytecodes(s_new_context)
                 raise Exception("loop_bytecodes left without raising...")
             except ContextSwitchException, e:
-                if self.is_tracing():
+                if self.is_tracing() or self.trace_important:
                     e.print_trace(s_new_context)
                 s_new_context = e.s_new_context
             except Return, nlr:
diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py
--- a/targetimageloadingsmalltalk.py
+++ b/targetimageloadingsmalltalk.py
@@ -12,7 +12,7 @@
 
 def _usage(argv):
     print """
-    Usage: %s <path> [-r|-m|-h] [-naPu] [-jpiS] [-tslLE]
+    Usage: %s <path> [-r|-m|-h] [-naPu] [-jpiS] [-tTslLE]
             <path> - image path (default: Squeak.image)
 
           Execution mode:
@@ -40,7 +40,8 @@
             
           Logging parameters:
             -t|--trace                 - Output a trace of each message, primitive, return value and process switch.
-            -s|--safe-trace            - Like -t, but without printing contents of BytesObjects
+            -T                         - Trace important events (Process switch, stack overflow, sender chain manipulation)
+            -s|--safe-trace            - If tracing is active, omit printing contents of BytesObjects
             -l|--storage-log           - Output a log of storage operations.
             -L|--storage-log-aggregate - Output an aggregated storage log at the end of execution.
             -E|--storage-log-elements  - Include classnames of elements into the storage log.
@@ -94,6 +95,7 @@
     poll = False
     interrupts = True
     trace = False
+    trace_important = False
     
     space = prebuilt_space
     idx = 1
@@ -114,8 +116,9 @@
                 selector, idx = get_parameter(argv, idx, arg)
             elif arg in ["-t", "--trace"]:
                 trace = True
+            elif arg in ["-T"]:
+                trace_important = True
             elif arg in ["-s", "--safe-trace"]:
-                trace = True
                 space.omit_printing_raw_bytes.activate()
             elif arg in ["-p", "--poll"]:
                 poll = True
@@ -169,8 +172,8 @@
     image_reader = squeakimage.reader_for_image(space, squeakimage.Stream(data=imagedata))
     image = create_image(space, image_reader)
     interp = interpreter.Interpreter(space, image,
-                trace=trace, evented=not poll,
-                interrupts=interrupts)
+                trace=trace, trace_important=trace_important,
+                evented=not poll, interrupts=interrupts)
     space.runtime_setup(argv[0], path)
     print_error("") # Line break after image-loading characters
     


More information about the pypy-commit mailing list