Enclosed please find the diff for adding the trace invocation exit traceline to complement the trace invocation (>I>) traceline.

The reason is mainly to make sure that the changes are sensible and acceptable.

While working on this I noticed that in RexxActivation.cpp there is a superfluous call to RexxActivation::termination() in case an explicitly given EXIT statement gets processed. After commenting it out running the entire test suite only the expected failures (e.g. in TRACE.testGroup) occur and those test cases need to be adjusted, which I would also do before committing the enclosed diff. The same goes for updating the rexxref docbook.

Before committing I would open an RFE tracker item to record all commits related to this RFE such that one can research the changes also at a later time and to not overlook it to be included it in the changes log of the next release of ooRexx.

---rony

Index: interpreter/execution/RexxActivation.cpp
===================================================================
--- interpreter/execution/RexxActivation.cpp    (revision 12827)
+++ interpreter/execution/RexxActivation.cpp    (working copy)
@@ -512,7 +512,7 @@
                     // For proper diagnostic in case of deadlock, do the trace 
now
                     if (tracingLabels() && isMethodOrRoutine())
                     {
-                        traceEntry();
+                        traceEntryOrExit(TRACE_PREFIX_INVOCATION);
                         if (!tracingAll())
                         {
                             // we pause on the label only for ::OPTIONS TRACE 
LABELS
@@ -587,7 +587,7 @@
     // Must be one of ::OPTIONS TRACE ALL/RESULTS/INTERMEDIATES/LABELS
     if (!traceEntryDone && tracingLabels() && isMethodOrRoutine())
     {
-        traceEntry();
+        traceEntryOrExit(TRACE_PREFIX_INVOCATION);
         if (!tracingAll())
         {
             // we pause on the label only for ::OPTIONS TRACE LABELS
@@ -1379,8 +1379,9 @@
         {
             activity->callTerminationExit(this);
         }
+// TODO: superfluous for an explicit EXIT (cf. ::returnFrom(RexxObject 
*resultObj) )
         // terminate this level
-        termination();
+//        termination();
     }
     else
     {
@@ -1433,6 +1434,17 @@
 {
     // remove any guard locks for this activity.
     guardOff();
+
+    if (tracingLabels() && isMethodOrRoutine())
+    {
+        traceEntryOrExit(TRACE_PREFIX_INVOCATION_EXIT);
+        if (!tracingAll())
+        {
+            // we pause on the label only for ::OPTIONS TRACE LABELS
+            pauseLabel();
+        }
+    }
+
     // have any setlocals we need to undo?
     if (environmentList != OREF_NULL && !environmentList->isEmpty())
     {
@@ -3527,6 +3539,7 @@
   ">N>",                               // TRACE_PREFIX_NAMESPACE
   ">K>",                               // TRACE_PREFIX_KEYWORD
   ">R>",                               // TRACE_PREFIX_ALIAS
+  "<I<",                               // TRACE_PREFIX_INVOCATION_EXIT
 };
 
 // size of a line number
@@ -3562,9 +3575,9 @@
 
 
 /**
- * Trace program entry for a method or routine
+ * Trace program entry or exit for a method or routine
  */
-void RexxActivation::traceEntry()
+void RexxActivation::traceEntryOrExit(TracePrefix tp)
 {
     // since we're advertising the entry location up front, we want to disable
     // the normal trace-turn on notice.  We'll get one or the other, but not
@@ -3596,7 +3609,7 @@
     // insert the leading blanks for the prefix area
     buffer->set(0, ' ', INSTRUCTION_OVERHEAD);
     // copy in the prefix information
-    buffer->put(PREFIX_OFFSET, trace_prefix_table[TRACE_PREFIX_INVOCATION], 
PREFIX_LENGTH);
+    buffer->put(PREFIX_OFFSET, trace_prefix_table[tp], PREFIX_LENGTH);
     // copy the message stuff over this
     buffer->put(INSTRUCTION_OVERHEAD, message->getStringData(), 
message->getLength());
     // and write out the trace line
Index: interpreter/execution/RexxActivation.hpp
===================================================================
--- interpreter/execution/RexxActivation.hpp    (revision 12827)
+++ interpreter/execution/RexxActivation.hpp    (working copy)
@@ -108,6 +108,7 @@
         TRACE_PREFIX_NAMESPACE,
         TRACE_PREFIX_KEYWORD,
         TRACE_PREFIX_ALIAS,
+        TRACE_PREFIX_INVOCATION_EXIT,
     } TracePrefix;
 
    void *operator new(size_t);
@@ -229,7 +230,7 @@
    void              traceOperatorValue(TracePrefix prefix, const char *tag, 
RexxObject *value);
    void              traceSourceString();
    void              traceClause(RexxInstruction *, TracePrefix);
-   void              traceEntry();
+   void              traceEntryOrExit(TracePrefix);
    void              resetElapsed();
    RexxString      * formatTrace(RexxInstruction *, PackageClass *);
    RexxString      * getTraceBack();
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to