How to capture crashes
#1
I only poked around a little bit and couldn't find it: Is there a mode (connected and capturing) or a log I should be looking at for capturing crashes?  I haven't got the toolchain up yet for compiling the firmware, but I seem to be pretty good about getting it to crash and I'd like to help fix it.
  Reply
#2
Code:
idf.py monitor
from the firmware dev tools will get you a live log capture over USB. That's been my main debugging tool for firmware hacking. It reboots the device when you run it, so have it running before you go trying to reproduce your problem.
  Reply
#3
Gamer Tip: idf.py monitor -p /dev/whatever --no-reset
  Reply
#4
Fun!

Mem alloc fail. size 0x0000340c caps 0x00000804


Backtrace: 0x40081a86:0x3ffd0370 0x40091861:0x3ffd0390 0x40082072:0x3ffd03b0 0x40082093:0x3ffd0420 0x4014461b:0x3ffd0440 0x40144169:0x3ffd0460 0x400ff436:0x3ffd0490 0x40084797:0x3ffd0530 0x400ffac5:0x3ffd0570 0x401d9a67:0x3ffd0590
  Reply
#5
Got compiling working and now the dumps are useful. What should I be doing with these?


This one happened after connecting to bluetooth, and then just selecting any song to play, scrolling to another song, clicking play. When replaying the song it crashed on after rebooting, it won't crash.

Code:
Mem alloc fail. size 0x0000340c caps 0x00000804


Backtrace: 0x40081a86:0x3ffd0310 0x40091861:0x3ffd0330 0x40082072:0x3ffd0350 0x40082093:0x3ffd03c0 0x401454c3:0x3ffd03e0 0x40145011:0x3ffd0400 0x400ff75a:0x3ffd0430 0x40084797:0x3ffd04d0 0x400ffde9:0x3ffd0510 0x401daafb:0x3ffd0530
--- 0x40081a86: panic_abort at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/lib/esp-idf/components/esp_system/panic.c:463
0x40091861: esp_system_abort at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/lib/esp-idf/components/esp_system/port/esp_system_chip.c:92
0x40082072: heap_caps_alloc_failed at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/lib/esp-idf/components/heap/heap_caps.c:58
0x40082093: heap_caps_malloc at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/lib/esp-idf/components/heap/heap_caps.c:88
0x401454c3: codecs::MadMp3Decoder::MadMp3Decoder() at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/codecs/mad.cpp:38
0x40145011: codecs::CreateCodecForType(codecs::StreamType) at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/codecs/codec.cpp:44 (discriminator 1)
0x400ff75a: audio::Decoder::prepareDecode(std::shared_ptr<audio::TaggedStream>) at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/tangara/audio/audio_decoder.cpp:138 (discriminator 2)
0x40084797: audio::Decoder::Main() at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/tangara/audio/audio_decoder.cpp:111 (discriminator 1)
0x400ffde9: std::_Function_handler<void (), audio::Decoder::Start(std::shared_ptr<audio::SampleProcessor>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/tangara/audio/audio_decoder.cpp:55
(inlined by) __invoke_impl<void, audio::Decoder::Start(std::shared_ptr<audio::SampleProcessor>)::<lambda()>&> at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61
(inlined by) __invoke_r<void, audio::Decoder::Start(std::shared_ptr<audio::SampleProcessor>)::<lambda()>&> at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:111
(inlined by) _M_invoke at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:290
0x401daafb: std::function<void ()>::operator()() const at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/std_function.h:591
(inlined by) void std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:61
(inlined by) std::__invoke_result<std::function<void ()>&>::type std::__invoke<std::function<void ()>&>(std::function<void ()>&) at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/bits/invoke.h:96
(inlined by) std::invoke_result<std::function<void ()>&>::type std::invoke<std::function<void ()>&>(std::function<void ()>&) at /Users/mspl/.espressif/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/xtensa-esp-elf/include/c++/13.2.0/functional:113
(inlined by) tasks::PersistentMain(void*) at /Users/mspl/Projects/Repositories/Public_Editing/tangara-fw/src/tasks/tasks.cpp:110





ELF file SHA256: b0a334021

Rebooting...
  Reply
#6
I’m not sure, but it looks like the OS run out of the available memory.
  Reply
#7
Hmm, a 13KiB internal alloc is very reasonable from the Mp3 decoder. Most likely there's memory pressure being caused by an issue elsewhere, and the large allocs from decoding are just what's pushing things over the line.

Are you able to reproduce this issue with automatic database updates disabled? We still have some outstanding issues with high memory usage when parsing the tags of certain file types (mostly Oggs with embedded art).
  Reply


Forum Jump: