Tracker One crashes

Hello,

I’ve been working on a fork of the Tracker Edge firmware for some time, making use of GPS, BLE and CAN. After refactoring my application code (Implementing runtime polymorphism for CAN nodes, it crashes during the first run of the main loop. (Before the refactoring it was working)

The crash occurs in the can-mcp25x library, in the following function:

byte MCP_CAN::mcp2515_readRegister(const byte address)
{
    byte ret;

    // If I comment out this transaction there is no crash.
    SPI_BEGIN();
    MCP2515_SELECT();
    spi_readwrite(MCP_READ);
    spi_readwrite(address);
    ret = spi_read();
    MCP2515_UNSELECT();
    SPI_END();

    return ret;
}

(I have access to a debugger)
How should I go about troubleshooting this?

An observation I’ve made is that debug builds don’t seem to crash, but normal builds do.

What are the differences in the build types?
Does this observation give anyone a hint of what might be wrong?

Turns out I was dealing with an uninitialized pointer to my CAN interface. The issue got resolved by adding the keyword “virtual” when the parent classes inherited from the same grandparent class, diamond inheritance.