Debugging quality-of-life improvements (#810)

* Debugging quality-of-life improvements

- Use std::abort for `CHECK`/`FATAL` failures, which acts as a debugger breakpoint as well as automatically printing a stack trace.
- Re-enable printing continuations in `--trace` mode.
- Log the source location of each step in `--trace` mode.

Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
This commit is contained in:
Geoff Romer
2021-09-08 09:25:16 -07:00
committed by GitHub
co-authored by Jon Meow
parent f931a8cead
commit 33dd9a873d
5 changed files with 56 additions and 60 deletions
@@ -362,7 +362,8 @@ auto Interpreter::StepLvalue() -> Transition {
Ptr<Action> act = stack.Top()->todo.Top();
Ptr<const Expression> exp = cast<LValAction>(*act).Exp();
if (tracing_output) {
llvm::outs() << "--- step lvalue " << *exp << " --->\n";
llvm::outs() << "--- step lvalue " << *exp << " (" << exp->SourceLoc()
<< ") --->\n";
}
switch (exp->Tag()) {
case Expression::Kind::IdentifierExpression: {
@@ -449,7 +450,8 @@ auto Interpreter::StepExp() -> Transition {
Ptr<Action> act = stack.Top()->todo.Top();
Ptr<const Expression> exp = cast<ExpressionAction>(*act).Exp();
if (tracing_output) {
llvm::outs() << "--- step exp " << *exp << " --->\n";
llvm::outs() << "--- step exp " << *exp << " (" << exp->SourceLoc()
<< ") --->\n";
}
switch (exp->Tag()) {
case Expression::Kind::IndexExpression: {
@@ -647,7 +649,8 @@ auto Interpreter::StepPattern() -> Transition {
Ptr<Action> act = stack.Top()->todo.Top();
Ptr<const Pattern> pattern = cast<PatternAction>(*act).Pat();
if (tracing_output) {
llvm::outs() << "--- step pattern " << *pattern << " --->\n";
llvm::outs() << "--- step pattern " << *pattern << " ("
<< pattern->SourceLoc() << ") --->\n";
}
switch (pattern->Tag()) {
case Pattern::Kind::AutoPattern: {
@@ -745,7 +748,7 @@ auto Interpreter::StepStmt() -> Transition {
if (tracing_output) {
llvm::outs() << "--- step stmt ";
stmt->PrintDepth(1, llvm::outs());
llvm::outs() << " --->\n";
llvm::outs() << " (" << stmt->SourceLoc() << ") --->\n";
}
switch (stmt->Tag()) {
case Statement::Kind::Match: {