Trouble using debug-core-dump

If you are asking a question, please follow this template:

  1. I am trying to debug a core dump
  2. In my attempt to do this I am running mos version Version: 2.20.0 but am using 2.15.0 as my target build
  3. I am receiving the following error when the debug-core-dump tool
Using core ...
Core dump by ...
Using ELF file at: /home/matt/...
Using Docker image: docker.io/mgos/esp8266-build:2.2.1-1.5.0-r5
Running docker run --rm -i --tty=true -v .../fw.elf -v /home/matt/.../...-esp8266-20220201-132804.334526996:/core -v /home/matt/../..:/home/matt/../...docker.io/mgos/esp8266-build:2.2.1-1.5.0-r5 bash -c /usr/local/bin/serve_core.py --rom=/opt/Espressif/rom/rom.bin --rom_addr=0x40000000 /fw.elf /core & $MGOS_TARGET_GDB /fw.elf -ex 'target remote 127.0.0.1:1234' -ex 'set confirm off' -ex bt
GNU gdb (crosstool-NG crosstool-ng-1.22.0-60-g37b07f6f) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-lx106-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /fw.elf...Waiting for gdb on 1234
done.
Found core at 23 - 133118
Mapping DRAM: 98304 @ 0x3ffe8000
Remote debugging using 127.0.0.1:1234
Mapping /opt/Espressif/rom/rom.bin at 0x40000000
Mapping /fw.elf .data: 2760 @ 0x3ffe8000
Mapping /fw.elf .rodata: 8 @ 0x3ffe8ac8
Mapping /fw.elf .bss: 31904 @ 0x3ffe8ad0
Mapping /fw.elf .text: 29497 @ 0x40100000
Mapping /fw.elf .irom0.text: 823807 @ 0x40200010
Loaded core dump from last snippet in  /core
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 57272)
Traceback (most recent call last):
  File "/usr/lib/python3.6/socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 348, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/usr/local/bin/serve_core.py", line 211, in handle
    self._curtask = core.tasks.get(tid)
AttributeError: 'Core' object has no attribute 'tasks'
----------------------------------------
Remote connection closed
No stack.

Any help would be sincerely appreciated !

Cheers,
Matt

It looks like there is a bug in 2.17.0 (which you are using). I don’t know if it’s in the sdk or in mongoose-os.

#include "mgos.h"

static void timer_cb(void *arg) {
  static bool s_tick_tock = false;
  static int count = 5;
  LOG(LL_INFO, ("%s uptime: %.2lf, RAM: %lu, %lu free, count: %d",
                (s_tick_tock ? "Tick" : "Tock"), mgos_uptime(),
                (unsigned long) mgos_get_heap_size(),
                (unsigned long) mgos_get_free_heap_size(), count));
  s_tick_tock = !s_tick_tock;
#ifdef LED_PIN
  mgos_gpio_toggle(LED_PIN);
#endif

  if (count == 0) {
    count = 5;
    int *val = (int *) arg;
    LOG(LL_INFO, ("val: %d", *val));
  }
  count--;
  (void) arg;
}

enum mgos_app_init_result mgos_app_init(void) {
#ifdef LED_PIN
  mgos_gpio_setup_output(LED_PIN, 0);
#endif
  mgos_set_timer(1000 /* ms */, MGOS_TIMER_REPEAT, timer_cb, NULL);
  return MGOS_APP_INIT_SUCCESS;
}

This example triggers a core dump and when analyzed gives the same result as yours when built for 2.17.0 and a correct trace when built with >= 2.18.0.

Thank you for the helpful advice @nliviu !

Please excuse my ignorance in this matter, how does one see that I am using version 2.17.0?

mos version returns

The Mongoose OS command line tool
Version: 2.20.0
Build ID: 20211215-002601/2.20.0-g0278853
Update channel: release

Further my mos.yml shows the following target

libs_version: 2.15.0
modules_version: 2.15.0
mongoose_os_version: 2.15.0

Thank you again :slight_smile:

I browsed the previous versions of mongoose-os and found the sdk version esp8266-build:2.2.1-1.5.0-r5 in 2.17.0.
Apparently it has been in use for some time :slight_smile:

Ah I see !

Looking at version 2.15.0 indicates the same sdk version.

Thank you for the insight :slight_smile: