Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix backtrace file names
  • Loading branch information
sorear committed Dec 28, 2010
1 parent 711b4c6 commit 396dce8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/CLRBackend.cs
Expand Up @@ -58,6 +58,7 @@ sealed class JScalar {
throw new ArgumentException(s);
}
public static int I(object x) { return (int)((JScalar)x).num; }
public static double N(object x) { return ((JScalar)x).num; }
public static int IN(object x) { return x == null ? -1 : (int)((JScalar)x).num; }
public static string S(object x) { return x == null ? null : ((JScalar)x).str; }
public override string ToString() { return text; }
Expand Down Expand Up @@ -162,6 +163,8 @@ class Unit {
public readonly object[] log;
public readonly string setting;
public readonly Xref bottom_ref;
public readonly string filename;
public readonly double modtime;
public readonly object[] xref;
public readonly object[] tdeps;

Expand All @@ -176,7 +179,9 @@ class Unit {
log = from[2] as object[];
setting = JScalar.S(from[3]);
bottom_ref = Xref.from(from[4]);
xref = from[5] as object[];
filename = JScalar.S(from[5]);
modtime = from[6] == null ? 0 : JScalar.N(from[6]);
xref = from[7] as object[];
exp_pkg = new Dictionary<string,Package>();
for (int i = 0; i < xref.Length; i++) {
if (xref[i] == null) continue;
Expand All @@ -188,7 +193,7 @@ class Unit {
(xref[i] as Package).NoteExports(exp_pkg);
}
}
tdeps = from[6] as object[];
tdeps = from[8] as object[];
}

public void BindDepends() {
Expand Down Expand Up @@ -3677,6 +3682,9 @@ public class CLRBackend {
}
});

thaw.Add(CpsOp.MethodCall(null, Tokens.SubInfo.GetMethod("SetStringHint"), new CpsOp[] {
CpsOp.GetSField(unit.mainline_ref.Resolve<StaticSub>().subinfo),
CpsOp.StringLiteral("$?FILE"), CpsOp.StringLiteral(unit.filename ?? "(eval)") }));
thaw.Add(CpsOp.MethodCall(null, Tokens.Kernel_FirePhasers,
new CpsOp[] { CpsOp.IntLiteral(2), CpsOp.BoolLiteral(false) }));
if (asmain)
Expand Down
4 changes: 4 additions & 0 deletions lib/Kernel.cs
Expand Up @@ -459,6 +459,10 @@ public class SubInfo {
return hints[name] = new BValue(Kernel.NewROScalar(Kernel.AnyP));
}

public void SetStringHint(string name, string value) {
AddHint(name).v = Kernel.BoxAnyMO<string>(value, Kernel.StrMO);
}

public bool GetLocalHint(string name, out BValue val) {
return (hints != null && hints.TryGetValue(name, out val));
}
Expand Down
2 changes: 2 additions & 0 deletions src/NAMBackend.pm
Expand Up @@ -45,6 +45,8 @@ sub Metamodel::Unit::to_nam {
$self->ns->log,
$self->setting,
$self->bottom_ref,
$self->filename,
$self->modtime,
[ map { $_ && $_->to_nam } @{ $self->xref } ],
[ map { [$_, @{ $self->tdeps->{$_} }] } sort keys %{ $self->tdeps } ],
]
Expand Down

0 comments on commit 396dce8

Please sign in to comment.