Soft WDT reset when using a function taking an address (call by reference)

I'm getting the following dump on the serial port (USB) (sorry, copy/paste somehow doesn't work from the serial console, so please see the attached image). I'm going to try to avoid adding a lot of extra code - but here's a short version of the code segment(s) that fail:

int isTime(unsigned long *fromMillis, unsigned long maxMillis) {

  unsigned long n=millis();
  Serial.println("isTime called");
  if ((n - (*fromMillis)) >= maxMillis) {
    // Time expired - do action
    *fromMillis = n; // Reset Count
    return true;
  }
  return false;
}

void loop() {
    static unsigned long sensorTime = 0;
    static uint16_t dist=100, strength=5000;
    if (isTime(&sensorTime, 100)) {
        dist = tfmini.getDistance();
        strength = tfmini.getRecentSignalStrength();
    }
}

That's it - the code fails in "isTime" when called from the function above (the assignment of *fromMillis seems to be it). This function is called A LOT and I only see it called once using debug statements. running this code segment directly in gcc works just fine:

#include <stdio.h>
#include <stdbool.h>
#include <time.h>
#include <stdlib.h>

long long gettimeofday_ms() {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  long long ms = ts.tv_sec*1000LL + 1e-6*ts.tv_nsec;

  return ms;
}

bool isTime(long long *fromMillis, long long maxMillis) {
  long long now=gettimeofday_ms();
  if ((now - *fromMillis) >= maxMillis) {
    // Time expired - do action
    *fromMillis = now; // Reset Count
    return true;
  }
  return false;
}

long long waits[] = {200,600,1200,5000,2000};

void main() {
  long long now = gettimeofday_ms();

  for (int i=0;i<5;i++) {
    while (!isTime(&now, waits[i])) { };
    printf("Wait %d is complete - was %ld. ms=%lld\n", i, waits[i], now);
  }
}

Outside of the call to millis() being replaced by standard C's time feature, this works. I know "millis()" returns unsigned long, so no "long long" is required.
Does anyone see what I fat-fingered wrong here?

Is the device a ESP32 or ESP8266?

Install and use the ESP Exception Decoder GitHub - me-no-dev/EspExceptionDecoder: Exception Stack Trace Decoder for ESP8266 and ESP32

If you highlight the text in the serial console, and use the keyboard command of control-c to copy you can then paste.

Idahowalker:
Is the device a ESP32 or ESP8266?

ESP8266 - Wemo d1 mini.

Install and use the ESP Exception Decoder GitHub - me-no-dev/EspExceptionDecoder: Exception Stack Trace Decoder for ESP8266 and ESP32

I've tried but the menu doesn't show up. I've placed it in same parent directory "libraries" is in, but the tools menu doesn't change.

If you highlight the text in the serial console, and use the keyboard command of control-c to copy you can then paste.

21:56:58.975 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:56:58.975 ->
21:56:58.975 -> Soft WDT reset
21:56:58.975 ->
21:56:58.975 -> >>>stack>>>
21:56:58.975 ->
21:56:58.975 -> ctx: cont
21:56:58.975 -> sp: 3ffffd60 end: 3fffffc0 offset: 01a0
21:56:58.975 -> 3fffff00: 40202c30 3ffee888 3ffe89ab 40202ec5
21:56:59.008 -> 3fffff10: 00000064 0000000d 3ffee7e0 40205902
21:56:59.008 -> 3fffff20: 00000064 000000a8 3ffee888 40202f70
21:56:59.008 -> 3fffff30: 3ffee7e0 0000000b 3ffee7e0 40202b8c
21:56:59.008 -> 3fffff40: 3fffdad0 3ffee888 3ffe84ce 402013be
21:56:59.008 -> 3fffff50: 0001c200 3ffee888 3ffee888 40202f70
21:56:59.008 -> 3fffff60: 0001c200 3ffee888 3ffee7ec 40201148
21:56:59.008 -> 3fffff70: 00000040 00000000 feefeffe feefeffe
21:56:59.041 -> 3fffff80: 0000004d 00000096 00000050 00000064
21:56:59.041 -> 3fffff90: 00000032 feefeffe feefeffe 3ffee9a4
21:56:59.041 -> 3fffffa0: 3fffdad0 00000000 3ffee964 40203ca8
21:56:59.041 -> 3fffffb0: feefeffe feefeffe 3ffe8794 40101819
21:56:59.041 -> <<<stack<<<
21:56:59.041 ->
21:56:59.041 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
21:56:59.074 ->
21:56:59.074 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)

I swear I tried that ... well, now it works! Thanks!

Update - no go on the EspExceptionDecoder - it requires "rather old" python and ncurses libraries - Fedora 32 finally got rid of Python2, now 5 (I'm pretty sure) years after it was deprecated. So all I get is a prompt of an ELF binary which most likely is the python2.7 executable.

That said - I've noticed the stack trace comes before the setup() debug statement. But since I can add more statements before the one I pointed out and they are all output after the stack-dump it seems like a buffer issue to me. Clearly the unit is resetting due to a software error. I can run other code on the Wemo D1, from "blinky" to more complex code. So it's not a hardware issue.