Assistance with GDB debugging

I have run mos debug-core-dump on my local machine to debug some code running on an ESP32. This is part of the GDB output, possible to get some help interpreting it?

Dump contains FreeRTOS task info
Loaded core dump from last snippet in  /core
0x40186bb9 in TwoWire::read (this=0x3ffb6d98 <Wire>)
    at /home/harry/MOS/VersionJ_Mongoose/deps/arduino-wire/src/mgos_arduino_wire.cpp:133
133       return (pbyte_to_recv < recv_buf + n_bytes_avail) ? *pbyte_to_recv++ : -1;
#0  0x40186bb9 in TwoWire::read (this=0x3ffb6d98 <Wire>)
    at /home/harry/MOS/VersionJ_Mongoose/deps/arduino-wire/src/mgos_arduino_wire---Type <return> to continue, or q <return> to quit---
.cpp:133
#1  0x400d72db in ACS71020::getRaw (this=0x3ffb4b14 <mySensor>, 
    reg_address=48 '0')
    at /home/harry/MOS/VersionJ_Mongoose/src/ACS71020.cpp:115
#2  0x400d7496 in ACS71020::custom_en (this=0x3ffb4b14 <mySensor>)
    at /home/harry/MOS/VersionJ_Mongoose/src/ACS71020.cpp:425
#3  0x400d9131 in mgos_app_init ()
    at /home/harry/MOS/VersionJ_Mongoose/src/main.cpp:476
#4  0x400d3466 in mgos_init () at /mongoose-os/src/mgos_init.c:29
#5  0x400db5ba in mgos_init2 ()
    at /home/harry/MOS/VersionJ_Mongoose/deps/freertos/src/mgos_freertos.c:169
#6  0x4008279b in mgos_task (arg=0x0)
    at /home/harry/MOS/VersionJ_Mongoose/deps/freertos/src/mgos_freertos.c:180

also here are some related code snippets from ACS71020.cpp:


UpOHF

What was the reason of the core dump?

Thats what I’m hoping to find out. I ran my code on an ESP32 dev board with no sensors attached, potentially that had caused an error with my ACS71020 library in this case… Not very familiar with GDB at all…

Maybe my wording was not clear.
I mean what was in the console log before catching the core dump. E.g.:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

The error seems to be here.
If you are running the code without the sensor attached, weird things can happen if you don’t check the return codes of the Wire functions.

ahh that’s a good question. Perhaps I can try recreating the core dump.
My inference is that the ACS71020 getRaw function is trying to read a buffer which is not there, and so there is a bug where the ACS71020 cannot handle this case - I’m just stoked I got this far! :sweat_smile:

I suppose checking the endtransmission return value before calling wire read could solve the issue. Am I right?