Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Include sub names in backtraces
  • Loading branch information
sorear committed Oct 5, 2010
1 parent 2dd2dee commit c25514f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions lib/Kernel.cs
Expand Up @@ -1107,9 +1107,11 @@ class ExitRunloopException : Exception { }
case 2:
if (th.lex0 == null)
Environment.Exit(1);
Console.Error.WriteLine(" at {0} line {1}",
((Frame)th.lex0).ExecutingFile(),
((Frame)th.lex0).ExecutingLine());
Frame f = (Frame) th.lex0;
Console.Error.WriteLine(" at {0} line {1} ({2} @ {3})",
new object[] {
f.ExecutingFile(), f.ExecutingLine(),
f.info.name, f.ip });
th.lex0 = ((Frame) th.lex0).caller;
goto case 2;
default:
Expand Down
6 changes: 3 additions & 3 deletions src/CSharpBackend.pm
Expand Up @@ -103,8 +103,8 @@ EOM
});
push @thaw, CgOp::return;

push @cgs, CodeGen->new(csname => 'BOOT', usednamed => 1,
ops => CgOp::prog(@thaw))->csharp;
push @cgs, CodeGen->new(csname => 'BOOT', name => 'BOOT',
usednamed => 1, ops => CgOp::prog(@thaw))->csharp;
}

for (@decls) {
Expand Down Expand Up @@ -348,7 +348,7 @@ sub codegen_sub {

local %haslet;
resolve_lex($_, $ops);
CodeGen->new(csname => $_->{peer}{cbase}, ops => $ops,
CodeGen->new(csname => $_->{peer}{cbase}, name => $_->name, ops => $ops,
usednamed => $_->{peer}{uname}, minlets => $_->{peer}{nlexn});
}

Expand Down
3 changes: 2 additions & 1 deletion src/CodeGen.pm
Expand Up @@ -10,6 +10,7 @@ use CLRTypes;
use Moose;

has ops => (is => 'ro', required => 1);
has name => (isa => 'Str', is => 'ro');
has csname => (isa => 'Str', is => 'ro');
has minlets => (isa => 'Int', is => 'ro', default => 0);
has usednamed => (isa => 'Bool', is => 'ro', default => 0);
Expand Down Expand Up @@ -450,7 +451,7 @@ use CLRTypes;
for (@{ $self->buffer }, @{ $self->consttab }, @{ $self->ehspans }) {
s/\@\@L(\w+)/$self->labelname->{$1}/eg;
}
(CgOp::clr_string("$::UNITNAME " . $self->csname),
(CgOp::clr_string("$::UNITNAME " . $self->name),
CgOp::rawnewarr('int', map { CgOp::int($_//0) } @{ $self->lineinfo }),
CgOp::rawsget($::UNITNAME . '.' . $self->csname . ':f,DynBlockDelegate'),
$outersi, $ltm,
Expand Down

0 comments on commit c25514f

Please sign in to comment.