Skip to content

Commit

Permalink
NIECZA_VERBOSE_EXCEPTIONS to print .args.perl in backtraces
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed May 29, 2011
1 parent de5e663 commit 048c930
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
29 changes: 27 additions & 2 deletions lib/Kernel.cs
Expand Up @@ -1045,6 +1045,8 @@ public class Frame: P6any {

public static readonly bool TraceCalls =
Environment.GetEnvironmentVariable("NIECZA_TRACE_CALLS") != null;
public static readonly bool VerboseExceptions =
Environment.GetEnvironmentVariable("NIECZA_VERBOSE_EXCEPTIONS") != null;

public Frame MakeChild(Frame outer, SubInfo info) {
if (reusable_child == null) {
Expand Down Expand Up @@ -1113,6 +1115,27 @@ public class Frame: P6any {
}
}

public Variable GetArgs() {
P6any nw = new P6opaque(Kernel.CaptureMO);
nw.SetSlot("positionals", pos ?? new Variable[0]);
nw.SetSlot("named", named);
return Kernel.NewROScalar(nw);
}

public string DescribeArgs() {
string ret = null;
try {
Variable a = GetArgs();
Variable sa = Kernel.RunInferior(a.Fetch().InvokeMethod(
Kernel.GetInferiorRoot(), "perl", new Variable[] { a },
null));
ret = sa.Fetch().mo.mro_raw_Str.Get(sa);
} catch (Exception ex) {
ret = "[cannot display arguments: " + ex + "]";
}
return ret;
}

public string ExecutingFile() {
BValue l;
SubInfo i = info;
Expand Down Expand Up @@ -3258,10 +3281,12 @@ class LastFrameNode {
while (from != upto) {
sb.Append(Console.Out.NewLine);
try {
sb.AppendFormat(" at {0} line {1} ({2} @ {3})",
sb.AppendFormat(" at {0} line {1} ({2} @ {3}) {4}",
new object[] {
from.ExecutingFile(), from.ExecutingLine(),
from.info.name, from.ip });
from.info.name, from.ip,
Frame.VerboseExceptions ? from.DescribeArgs() : ""
});
} catch (Exception ex) {
sb.AppendFormat(" (frame display failed: {0})", ex);
}
Expand Down
6 changes: 4 additions & 2 deletions perf/perf.TODO
Expand Up @@ -8,13 +8,15 @@ Experiment with "if non-overriden, then replace method" hooks
Experiment with making P6any: Variable

Make LISTSTORE off-loop?

push, shift, etc off-loop?

Avoid calling a function for trivial attribute (or parameter) defaults

Improve isa, somehow.

Subquadratic nibbling.
Subquadratic nibbling. Also improve nibbler's use of GetKey and push.

Reduce redundant Cursor creation for, e.g., { say 2 }
Reduce ContextHelper use in ws, or make it faster.

81537 Mu.new attr: 14093 RxOp.zyg,

0 comments on commit 048c930

Please sign in to comment.