Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Expand blame stack trace #1279

Description

@JCGoran

This mod file:

NEURON {
    SUFFIX recursion
}

FUNCTION f(n) {
    f = f(n)
}

provides the following stack trace when running nmodl --neuron [MODFILE] blame --line 206:

    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 546, in print_statement_block
       545:              !statement->is_mutex_unlock() && !statement->is_protect_statement()) {
    >  546:              printer->add_indent();
       547:          }
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 623, in visit_string
       622:      }
    >  623:      printer->add_text(name);
       624:  }
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 776, in visit_binary_expression
       775:          lhs->accept(*this);
    >  776:          printer->add_text(" " + op + " ");
       777:          rhs->accept(*this);
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 466, in print_function_call
       465:      const auto& arguments = node.get_arguments();
    >  466:      printer->add_text(function_name, '(');
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.hpp", line 1396, in print_vector_elements<std::shared_ptr<nmodl::
ast::Expression> >
      1395:      for (auto iter = elements.begin(); iter != elements.end(); iter++) {
    > 1396:          printer->add_text(prefix);
      1397:          (*iter)->accept(*this);
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 623, in visit_string
       622:      }
    >  623:      printer->add_text(name);
       624:  }
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 482, in print_function_call
       481:      print_vector_elements(arguments, ", ");
    >  482:      printer->add_text(')');
       483:  }
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 550, in print_statement_block
       549:          if (need_semicolon(*statement)) {
    >  550:              printer->add_text(';');
       551:          }
    Source: "/nmodl/src/codegen/codegen_cpp_visitor.cpp", line 553, in print_statement_block
       552:          if (!statement->is_mutex_lock() && !statement->is_mutex_unlock()) {
    >  553:              printer->add_newline();
       554:          }

For reference, the blamed line in question is:

ret_f = ret_f(n);

While the trace is much more manageable than before merging #1265, and provides a good starting point, it is a bit too short, and is missing the vital part, namely, anything from codegen_neuron_cpp_visitor.cpp, so having a slightly expanded trace would greatly speed-up debugging.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions