Closed hitecSmartHome closed 5 months ago
Probably you need to convert the file from hexadecimal representation back to binary first, before passing it into the coredump-info command. Or looking at it the other way around, is there any specific reason you are encoding the binary data to hexadecimal before writing it into the file?
Oh, I tought the decoder will eat it anyway. So you say I should do something like this instead?
void Sys::saveCoreDumpBin() {
size_t size = 0;
size_t address = 0;
uint8_t* coreDump; // Change char* to uint8_t*
if (!alloc(coreDump, 640)) { return; }
if (esp_core_dump_image_get(&address, &size) != ESP_OK) { free(coreDump); return; }
const esp_partition_t* pt = NULL;
pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if (pt == NULL) { free(coreDump); return; }
uint8_t bf[256];
int16_t toRead;
db.remove(CORE_DUMP_PATH);
for (int16_t i = 0; i < (size / 256) + 1; i++) {
toRead = (size - i * 256) > 256 ? 256 : (size - i * 256);
esp_err_t er = esp_partition_read(pt, i * 256, bf, toRead);
if (er != ESP_OK) {
break;
}
memcpy(coreDump + i * 256, bf, toRead); // Copy directly into coreDump
}
db.appendBinary(CORE_DUMP_PATH, coreDump, size); // Append binary data
esp_core_dump_image_erase();
free(coreDump);
}
I have converted it back to binary with this tool: https://www.rapidtables.com/convert/number/hex-to-binary.html
But I still get the following error:
Executing action: coredump-info
Failed to load core dump: Core dump version "0x345d" is not supported!
is there any specific reason you are encoding the binary data to hexadecimal before writing it into the file?
Actually no.
Unfortunately I don't know what the functions alloc(coreDump, 640)
and db.appendBinary(CORE_DUMP_PATH, coreDump, size)
do, so I can't say if the code is correct or not.
If coreDump
array is so large that it can contain all the coredump binary, then I think you don't need the for
loop, you can simply call esp_partition_read
for the entire size
.
Failed to load core dump: Core dump version "0x345d" is not supported!
Your coreDumpBin.txt contains literal "0" and "1" characters instead of data. I think the tool means "binary" in the mathematical sense ("0" and "1" symbols) while coredump expects "binary" in the sense of "raw data". So the first byte of your binary file has to have value 0x34. Right now this byte instead gets encoded as 32 bytes, each a "0" or "1" character...
By the way, if you have difficulty implementing coredump analysis for your application, you might consider using our managed service, ESP Insights: https://insights.espressif.com/.
I see. So it should be that easy?
void Sys::readCoreDumpAndSave(){
size_t size = 0;
size_t address = 0;
// Get the pointer to the image
if (esp_core_dump_image_get(&address, &size) != ESP_OK) {
printf("[System] - Failed to get core dump info\n");
return;
}
// Allocate an array for the image buffer with ps_malloc()
uint8_t* coreDumpBuffer;
if( !alloc(coreDumpBuffer, size) ) {
printf("[System] - Failed to allocate core dump buffer\n");
return;
}
const esp_partition_t* pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if(!pt){
printf("[System] - Failed to find coredump partition\n");
free(coreDumpBuffer);
return;
}
// Read the whole image at once
esp_err_t er = esp_partition_read(pt, address, coreDumpBuffer, size);
if (er != ESP_OK) {
printf("[System] - Failed to read core dump\n");
free(coreDumpBuffer);
return;
}
}
Unfortunately I don't know what the functions alloc(coreDump, 640) and db.appendBinary(CORE_DUMP_PATH, coreDump, size) do, so I can't say if the code is correct or not.
As i said the alloc is just a wrapper for ps_malloc() and the db method call is just a wrapper for LittleFS write operation.
boolean Sys::alloc(uint8_t *&ptr, int size) {
ptr = (uint8_t *)ps_malloc(size * sizeof(uint8_t));
if (!ptr || ptr == NULL) {
return false;
}
return true;
}
This could be my final function where
#define CORE_DUMP_PATH "/system/coreDump.bin"
void Sys::readCoreDumpAndSave(){
size_t size = 0;
size_t address = 0;
// Get the pointer to the image
if (esp_core_dump_image_get(&address, &size) != ESP_OK) {
printf("[System] - Failed to get core dump info\n");
return;
}
// Allocate an array for the image buffer with ps_malloc()
uint8_t* coreDumpBuffer;
if( !alloc(coreDumpBuffer, size) ) {
printf("[System] - Failed to allocate core dump buffer\n");
return;
}
const esp_partition_t* pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if(!pt){
printf("[System] - Failed to find coredump partition\n");
free(coreDumpBuffer);
return;
}
// Read the whole image at once
esp_err_t er = esp_partition_read(pt, address, coreDumpBuffer, size);
if (er != ESP_OK) {
printf("[System] - Failed to read core dump\n");
free(coreDumpBuffer);
return;
}
db.remove(CORE_DUMP_PATH);
File coreDumpFile = db.getFileObject(CORE_DUMP_PATH,FILE_WRITE);
size_t written = coreDumpFile.write(coreDumpBuffer, size);
free(coreDumpBuffer);
if (written != size) {
printf("[System] - Failed to write core dump\n");
return;
}
printf("[System] - Successfully wrote core dump\n");
}
With this modification I'm still unable to decode it
Failed to load core dump: Invalid application image for coredump: coredump SHA256(b7fbaab6626d2226) != app SHA256()
I have got a 27kb bin file now.
By the way, if you have difficulty implementing coredump analysis for your application, you might consider using our managed service, ESP Insights: https://insights.espressif.com/.
Unfortunatelly I'm using Arduino as a component and can't move to more recent IDF releases so the Insight is unavailable for me.
@hitecSmartHome Does you application elf file modified after coredump has been saved to flash?
Nop. I'm doing a crash now intentionally and download the results after restart immidiatelly.
void crashMCU(){
printf("Crashing...\n");
while(true){
int i = 0;
int crash = 1/i;
printf("Crash: %d\n", crash);
}
}
I can see from the saved coredump file (after trimming the 20bytes header), your application elf sha is b7fbaab6626d2226
xtensa-esp32-elf-readelf -n trimmed.dmp
Displaying notes found at file offset 0x000067fc with length 0x00000114:
Owner Data size Description
ESP_CORE_DUMP_INFO 0x00000048 Unknown note type: (0x0000204a)
description data: 00 01 00 00 62 37 66 62 61 61 62 36 36 32 36 64 32 32 32 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
You can verify it using a tool like shasum -a 256 build/blink.elf
Results must be the same. And you can debug elf_write_core_dump_info
function to see what is going on.
So why does idf.py coredump-info -c C:\Users\Pc\Desktop\coreDump\coreDump.txt
fails?
Should i trim the 20 bytes header before i save it to file?
No, you don't need to trim. I did it to see the note section in the elf file. idf.py coredump-info
will take care of the headers for you.
Can you calculate and compare the elf sha256 outputs as I described above? Or you can ensure you save the coredump from scratch in every panic. If ESP_COREDUMP_FLASH_NO_OVERWRITE
is selected maybe you have an old coredump file but a new application built. Please send us the console logs until the coredump finishes so that we can have a better understanding.
I see. Will check it. Will crash it again and compare the new log to the file sha.
Here is my core dump sdkconfig
#
# Core dump
#
CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH=y
# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set
# CONFIG_ESP_COREDUMP_ENABLE_TO_NONE is not set
# CONFIG_ESP_COREDUMP_DATA_FORMAT_BIN is not set
CONFIG_ESP_COREDUMP_DATA_FORMAT_ELF=y
CONFIG_ESP_COREDUMP_CHECKSUM_CRC32=y
# CONFIG_ESP_COREDUMP_CHECKSUM_SHA256 is not set
CONFIG_ESP_COREDUMP_CHECK_BOOT=y
CONFIG_ESP_COREDUMP_ENABLE=y
CONFIG_ESP_COREDUMP_LOGS=y
CONFIG_ESP_COREDUMP_MAX_TASKS_NUM=64
CONFIG_ESP_COREDUMP_STACK_SIZE=0
# end of Core dump
I can't find ESP_COREDUMP_FLASH_NO_OVERWRITE
in the menuconfig
I do save it in every panic. When my esp boots up I have the following logic
esp_reset_reason_t resetReason = esp_reset_reason();
if( resetReason != ESP_RST_SW && resetReason != ESP_RST_POWERON ){
readCoreDumpAndSave();
}
void Sys::readCoreDumpAndSave(){
size_t size = 0;
size_t address = 0;
// Get the pointer to the image
if (esp_core_dump_image_get(&address, &size) != ESP_OK) {
printf("[System] - Failed to get core dump info\n");
return;
}
// Allocate an array for the image buffer with ps_malloc()
uint8_t* coreDumpBuffer;
if( !alloc(coreDumpBuffer, size) ) {
printf("[System] - Failed to allocate core dump buffer\n");
return;
}
const esp_partition_t* pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if(!pt){
printf("[System] - Failed to find coredump partition\n");
free(coreDumpBuffer);
return;
}
// Read the whole image at once
esp_err_t er = esp_partition_read(pt, 0, coreDumpBuffer, size);
if (er != ESP_OK) {
printf(
"[System] - Failed to read core dump. Error: %s\n",
esp_err_to_name(er)
);
free(coreDumpBuffer);
return;
}
File coreDumpFile = db.getFileObject(CORE_DUMP_PATH,FILE_WRITE);
size_t written = coreDumpFile.write(coreDumpBuffer, size);
free(coreDumpBuffer);
if (written != size) {
printf("[System] - Failed to write core dump\n");
return;
}
printf("[System] - Successfully wrote core dump\n");
esp_core_dump_image_erase();
}
esp_err_t Sys::esp_core_dump_image_erase() {
/* Find the partition that could potentially contain a (previous) core dump. */
const esp_partition_t* core_part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
ESP_PARTITION_SUBTYPE_DATA_COREDUMP,
"coredump");
if (!core_part) {
logger.write("No core dump partition found!|n");
return ESP_ERR_NOT_FOUND;
}
if (core_part->size < sizeof(uint32_t)) {
logger.write("Too small core dump partition!\n");
return ESP_ERR_INVALID_SIZE;
}
esp_err_t err = ESP_OK;
err = esp_partition_erase_range(core_part, 0, core_part->size);
if (err != ESP_OK) {
Serial.printf("Failed to erase core dump partition (%d)!\n", err);
return err;
}
// on encrypted flash esp_partition_erase_range will leave encrypted
// garbage instead of 0xFFFFFFFF so overwriting again to safely signalize
// deleted coredumps
const uint32_t invalid_size = 0xFFFFFFFF;
err = esp_partition_write(core_part, 0, &invalid_size, sizeof(invalid_size));
if (err != ESP_OK) {
logger.write("Failed to write core dump partition size (%d)!\n", err);
}
return err;
}
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Core 0 register dump:
PC : 0x3268e3a2 PS : 0x00060830 A0 : 0x38b38c81 A1 : 0x3ffd13e0
A2 : 0x3ffd1420 A3 : 0x3f81c66c A4 : 0x00ba41c3 A5 : 0x00004240
A6 : 0x00000003 A7 : 0x00060023 A8 : 0x8026f858 A9 : 0x00000000
A10 : 0x3ffd1420 A11 : 0x3f81c66c A12 : 0x1f2638c2 A13 : 0x3ff5f078
A14 : 0x3ff5f07c A15 : 0x00000001 SAR : 0x00000001 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x40083715 LEND : 0x4008371d LCOUNT : 0x00000027
Backtrace: 0x3268e39f:0x3ffd13e0 |<-CORRUPTED
#0 0x3268e39f:0x3ffd13e0 in ?? ??:0
ELF file SHA256: 93ed632490e2a93d
I (7513) esp_core_dump_flash: Save core dump to flash...
I (7520) esp_core_dump_flash: Erase flash 28672 bytes @ 0xfec000
[0;32mI (7747) esp_core_dump_flash: Write end offset 0x6c84, check sum length 4
I (7747) esp_core_dump_flash: Core dump has been saved to flash.
Rebooting...
This is the output to the console on crash.
Here is the console on boot
I (1387) esp_core_dump_flash: Init core dump to flash
I (1393) esp_core_dump_flash: Found partition 'coredump' @ fec000 65536 bytes
[0;32mI (1416) esp_core_dump_flash: Core dump data checksum is correct
I (1416) esp_core_dump_flash: Found core dump 27076 bytes in flash @ 0xfec000
My app reads and saves it
[System] - Successfully wrote core dump
Where should i call shasum -a 256
? It is unknown target when i call it with idf.py shasum -a 256 <path_to_built_elf>
So i did it on windows CMD certutil -hashfile C:\Users\Pc\Desktop\coreDump\coreDump.bin
and the sha of the coreDump.bin is 6506a9448fd3d9a30b3d70bc5b3cabfd6b0aa9c9
and the output of the coredump-info is Failed to load core dump: Invalid application image for coredump: coredump SHA256(93ed632490e2a93d) != app SHA256().
. I'm sure that this is the latest coreDump.bin and I did not recompile the firmware
OK. What do you see when you run the below command? It will read the coredump partition to a file and decode it.
idf.py coredump-info -s esp-coredump.txt -b 115200
Then you can compare esp-coredump.txt
and your-coredump.txt
You should be able to decode your file like this.
espcoredump.py info_corefile -c your-coredump.txt -t raw <your_app_elf_file_path>
or
idf.py coredump-info -c your-coredump.txt
Executing action: coredump-info
Path to core dump file is not provided. Core dump can't be read from flash since this option is not enabled in menuconfig
I can't see a menuconfig option like this
I have tried this command
espcoredump.py info_corefile -c your-coredump.txt -t raw <your_app_elf_file_path>
I replaced your-coredump.txt with the path of the coredump and the elf file path with the elf file path
And i got
espcoredump.py : The term 'espcoredump.py' is not recognized as the name of a cmdlet, function, script file, or operable pro
gram. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ espcoredump.py info_corefile -c C:\Users\Pc\Desktop\coreDump\coreDump ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (espcoredump.py:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
If i do it like this
idf.py info_corefile your-coredump.txt raw <your_app_elf_file_path>
( without -t and -c )
ninja: error: unknown target 'info_corefile'
[0/1] Re-running CMake...
ninja failed with exit code 1, output of the command is in the
I must mention that I'm using Arduino as a component of IDF with PlatformIO. I have installed IDF separately, launching the ESP-IDF 5.2 PowerShell on windows, cd into my project dir ( which is in PlatformIO directory ) and executing commands there.
Sorry, I don't have such a setup to test and see what is going on. As a last check on my side, if you can send your latest application elf file (here or by email) along with the latest coredump.txt file, I can have a look. Otherwise, I suggest you to consult PlatformIO community and come back here if something needs to be done on the IDF side.
I see. Thank you for your help. I appreciate it. Will try with the PlatformIO guys.
So the PIO guys said that it isn't their problem. It should be fixed IDF side. What should i do?
idf.py coredump-info
and coredump-debug
both throwing the same error Failed to load core dump: Invalid application image for coredump: coredump SHA256(02fcd8c6a8f0ea07) != app SHA256()
Please verify that my method to retrive and store the coredump data is correct and please make suggestions how to decode it.
Code for this
void Sys::readCoreDumpAndSave(){
size_t size = 0;
size_t address = 0;
// Get the pointer to the image
if (esp_core_dump_image_get(&address, &size) != ESP_OK) {
printf("[System] - Failed to get core dump info\n");
return;
}
// Allocate an array for the image buffer with ps_malloc()
uint8_t* coreDumpBuffer;
if( !alloc(coreDumpBuffer, size) ) {
printf("[System] - Failed to allocate core dump buffer\n");
return;
}
const esp_partition_t* pt = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_COREDUMP, "coredump");
if(!pt){
printf("[System] - Failed to find coredump partition\n");
free(coreDumpBuffer);
return;
}
// Read the whole image at once
esp_err_t er = esp_partition_read(pt, 0, coreDumpBuffer, size);
if (er != ESP_OK) {
printf(
"[System] - Failed to read core dump. Error: %s\n",
esp_err_to_name(er)
);
free(coreDumpBuffer);
return;
}
File coreDumpFile = db.getFileObject(CORE_DUMP_PATH,FILE_WRITE);
size_t written = coreDumpFile.write(coreDumpBuffer, size);
free(coreDumpBuffer);
if (written != size) {
printf("[System] - Failed to write core dump\n");
return;
}
printf("[System] - Successfully wrote core dump\n");
esp_core_dump_image_erase();
}
esp_err_t Sys::esp_core_dump_image_erase() {
/* Find the partition that could potentially contain a (previous) core dump. */
const esp_partition_t* core_part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
ESP_PARTITION_SUBTYPE_DATA_COREDUMP,
"coredump");
if (!core_part) {
logger.write("No core dump partition found!|n");
return ESP_ERR_NOT_FOUND;
}
if (core_part->size < sizeof(uint32_t)) {
logger.write("Too small core dump partition!\n");
return ESP_ERR_INVALID_SIZE;
}
esp_err_t err = ESP_OK;
err = esp_partition_erase_range(core_part, 0, core_part->size);
if (err != ESP_OK) {
Serial.printf("Failed to erase core dump partition (%d)!\n", err);
return err;
}
// on encrypted flash esp_partition_erase_range will leave encrypted
// garbage instead of 0xFFFFFFFF so overwriting again to safely signalize
// deleted coredumps
const uint32_t invalid_size = 0xFFFFFFFF;
err = esp_partition_write(core_part, 0, &invalid_size, sizeof(invalid_size));
if (err != ESP_OK) {
logger.write("Failed to write core dump partition size (%d)!\n", err);
}
return err;
}
void readRebootReason() {
esp_reset_reason_t resetReason = esp_reset_reason();
if( resetReason != ESP_RST_SW && resetReason != ESP_RST_POWERON ){
readCoreDumpAndSave();
}
}
void setup(){
readRebootReason();
}
Maybe if we would have an option to save the crash log as a verbose txt I could save that directly to FS and don't have to decode at all. I have plenty of flash space, this would be no problem.
What I have tried so far
My problem is probably because of the PlatformIO approach of my project. I'm using Arduino as a component of IDF and I can't do idf commands from PIO CLI. I have installed the IDF separately on my system. PIO guys said that if I navigate to the PIO project folder with the IDF PowerShell it should work OK.
Errors I got on various commands
espcoredump.py : The term 'espcoredump.py' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ espcoredump.py
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (espcoredump.py:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Executing action: coredump-debug
Failed to load core dump: Invalid application image for coredump: coredump SHA256(02fcd8c6a8f0ea07) != app SHA256()
Executing action: coredump-info
Failed to load core dump: Invalid application image for coredump: coredump SHA256(02fcd8c6a8f0ea07) != app SHA256()
Maybe it can not find my firmware.elf
file thus app SHA256()
is empty.
My elf and bin files are in ./projectDir/.pio/build/esp-wrover-kit/firmware.elf
Now I have Windows environment to test. What I have done so far, 1 - Run ESP-IDF 5.2 Powershell 2 - pip list to see installed packages.
pip list
Package Version
--------------------- ---------
bitarray 2.8.2
bitstring 4.1.2
CacheControl 0.13.1
certifi 2023.7.22
cffi 1.16.0
charset-normalizer 3.3.1
click 8.1.7
colorama 0.4.6
construct 2.10.69
contextlib2 21.6.0
cryptography 41.0.7
ecdsa 0.18.0
esp-coredump 1.10.0
3 - I can see esp-coredump is installed. (If not run .\install.ps1 and .\export.ps1) 4 - Run espcoredump.py
esp-coredump.exe info_corefile -c coredump.txt -t raw dummy.elf
5 - Got error. It is OK since I don't have original elf file.
espcoredump.py v1.10.0
Failed to load core dump: Invalid application image for coredump: coredump SHA256(b7fbaab6626d2226) != app SHA256(8bdd9f3ae7de7911)
Please try the steps.
Thank you for the suggestion. If i try with an incompatible elf file it produces the same output as yours. But if I crash the ESP like this:
printf("Crashing...\n");
while(true){
int i = 0;
int crash = 1/i;
printf("Crash: %d\n", crash);
}
It errors out:
espcoredump.py v1.11.0
Failed to load core dump: Core dump version "0x3030" is not supported!
Maybe it is because of the header in the coreDump file?
I can't upload the elf file because github wont allow me.
esp-coredump 1.11.0
Here is a link to the core dump files ( I could not upload it to github )
https://drive.google.com/drive/folders/1oWlqmrAvXPMyer-4162RN21DQHfX8lVf?usp=sharing
I can decode it.
Your header looks fine. Header version 0x100 meaning CRC - 20 byte header.
64 6F 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
I added the gdb-timeout parameter since the app elf file is too big and gdb requires more time to parse.
esp-coredump.exe --gdb-timeout-sec 10 info_corefile -c .\coreDump.bin -t raw .\firmware.elf
===============================================================
==================== ESP32 CORE DUMP START ====================
Crashed task handle: 0x3ffd9bb0, name: 'httpd', GDB name: 'process 1073585072'
================== CURRENT THREAD REGISTERS ===================
exccause 0x41 (DebugException)
excvaddr 0x0
epc1 0x401da6d8
epc2 0x0
epc3 0x0
epc4 0x0
epc5 0x0
epc6 0x401754fc
eps2 0x0
eps3 0x0
eps4 0x0
eps5 0x0
eps6 0x60b20
pc 0x401754fc 0x401754fc <std::_Function_handler<int(PsychicRequest*), HsHServer::begin()::<lambda(PsychicRequest*)> >::_M_invoke(const std::_Any_data &, PsychicRequest *&&)+12>
lbeg 0x400014fd 1073747197
lend 0x4000150d 1073747213
lcount 0xfffffffd 4294967293
sar 0x1a 26
ps 0x60b26 396070
threadptr <unavailable>
br <unavailable>
scompare1 <unavailable>
acclo <unavailable>
acchi <unavailable>
m0 <unavailable>
m1 <unavailable>
m2 <unavailable>
m3 <unavailable>
expstate <unavailable>
f64r_lo <unavailable>
f64r_hi <unavailable>
f64s <unavailable>
fcr <unavailable>
fsr <unavailable>
a0 0x801ac5b6 -2145729098
a1 0x3ffd98c0 1073584320
a2 0x3f80abfc 1065397244
a3 0x3ffd98e0 1073584352
a4 0x3ffe2888 1073621128
a5 0x0 0
a6 0x3ffd9940 1073584448
a7 0x3ffd98b0 1073584304
a8 0x801754fc -2145954564
a9 0x3ffd98a0 1073584288
a10 0xa 10
a11 0x3ffd98a0 1073584288
a12 0x89 137
a13 0x3ffd9958 1073584472
a14 0xe 14
a15 0xff000000 -16777216
==================== CURRENT THREAD STACK =====================
#0 std::_Function_handler<int(PsychicRequest*), HsHServer::begin()::<lambda(PsychicRequest*)> >::_M_invoke(const std::_Any_data &, PsychicRequest *&&) (__functor=..., __args#0=@0x3ffd98e0: 0x3ffd9940) at src/Server/Server.cpp:82
#1 0x401ac5b6 in std::function<int (PsychicRequest*)>::operator()(PsychicRequest*) const (__args#0=<optimized out>, this=0x3f80abfc) at c:\\users\\pc\\.platformio\\packages\ oolchain-xtensa-esp32@8.4.0+2021r2-patch5\\xtensa-esp32-elf\\include\\c++\\8.4.0\\bits/std_function.h:687
#2 PsychicWebHandler::handleRequest (this=0x3f80ab94, request=<optimized out>) at lib/PsychicHttp/src/PsychicWebHandler.cpp:46
#3 0x401acd69 in PsychicEndpoint::requestCallback (req=<optimized out>) at lib/PsychicHttp/src/PsychicEndpoint.cpp:72
#4 0x401d4cf0 in httpd_uri (hd=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_uri.c:329
#5 0x401d3c0b in httpd_parse_req (hd=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_parse.c:659
#6 httpd_req_new (hd=0x3f808480, sd=<optimized out>) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_parse.c:787
#7 0x401d4379 in httpd_sess_process (hd=0x3f808480, session=0x3f809d18) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_sess.c:419
#8 0x401d32ef in httpd_process_session (context=0x3ffd9b08, session=0x3f809d18) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:178
#9 httpd_process_session (session=0x3f809d18, context=0x3ffd9b08) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:163
#10 0x40279835 in httpd_sess_enum (hd=<optimized out>, enum_function=0x401d32ac <httpd_process_session>, context=0x3ffd9b08) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_sess.c:50
#11 0x401d33e0 in httpd_server (hd=<optimized out>) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:228
#12 httpd_thread (arg=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:250
======================== THREADS INFO =========================
Id Target Id Frame
* 1 process 1073585072 std::_Function_handler<int(PsychicRequest*), HsHServer::begin()::<lambda(PsychicRequest*)> >::_M_invoke(const std::_Any_data &, PsychicRequest *&&) (__functor=..., __args#0=@0x3ffd98e0: 0x3ffd9940) at src/Server/Server.cpp:82
2 process 1073504376 ws_poll_read (t=<error reading variable: Cannot access memory at address 0xfffffff4>, timeout_ms=1073503368) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\ cp_transport\ ransport_ws.c:527
3 process 1073504016 0x400826a0 in esp_crosscore_int_send_yield (core_id=1) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
4 process 1073531308 0x400826a0 in esp_crosscore_int_send_yield (core_id=1) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
5 process 1073479060 0x40279aba in esp_pm_impl_waiti () at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_pm\\pm_impl.c:849
6 process 1073477160 0x40279aba in esp_pm_impl_waiti () at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_pm\\pm_impl.c:849
7 process 1073599404 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
8 process 1073606768 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
9 process 1073548268 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
10 process 1073549916 0x400826a0 in esp_crosscore_int_send_yield (core_id=1) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
11 process 1073481472 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
12 process 1073412692 0x400826a0 in esp_crosscore_int_send_yield (core_id=1) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
13 process 1073412044 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
14 process 1073607500 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
15 process 1073563796 0x4000bff0 in ?? ()
16 process 1073609972 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
17 process 1073470876 0x4000bff0 in ?? ()
18 process 1073550276 0x400826a0 in esp_crosscore_int_send_yield (core_id=0) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
19 process 1073561384 0x400826a0 in esp_crosscore_int_send_yield (core_id=1) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_system\\crosscore_int.c:145
TCB NAME PRIO C/B STACK USED/FREE
---------- ---------------- -------- ----------------
0x3ffd9bb0 httpd 5/5 912/19076
0x3ffc6078 websocket_task 5/5 384/5612
0x3ffc5f10 ComponentsTask 4/4 384/19604
0x3ffcc9ac loopTask 1/1 416/14936
0x3ffbfd94 IDLE 0/0 384/1136
0x3ffbf628 IDLE 0/0 384/1148
0x3ffdd3ac OTATask 15/15 384/3656
0x3ffdf070 HardwareConfigT 15/15 512/6476
0x3ffd0bec SystemTask 10/10 384/15992
0x3ffd125c tiT 18/18 480/2580
0x3ffc0700 Tmr Svc 1/1 368/1668
0x3ffafa54 ipc1 24/24 416/1104
0x3ffaf7cc ipc0 24/24 416/1112
0x3ffdf34c mdns 1/1 464/3616
0x3ffd4894 emac_rx 15/15 416/1616
0x3ffdfcf4 uart_event_task 24/24 480/1552
0x3ffbdd9c esp_timer 22/22 416/3160
0x3ffd13c4 sys_evt 20/20 496/1792
0x3ffd3f28 arduino_events 19/19 432/3660
==================== THREAD 1 (TCB: 0x3ffd9bb0, name: 'httpd') =====================
#0 std::_Function_handler<int(PsychicRequest*), HsHServer::begin()::<lambda(PsychicRequest*)> >::_M_invoke(const std::_Any_data &, PsychicRequest *&&) (__functor=..., __args#0=@0x3ffd98e0: 0x3ffd9940) at src/Server/Server.cpp:82
#1 0x401ac5b6 in std::function<int (PsychicRequest*)>::operator()(PsychicRequest*) const (__args#0=<optimized out>, this=0x3f80abfc) at c:\\users\\pc\\.platformio\\packages\ oolchain-xtensa-esp32@8.4.0+2021r2-patch5\\xtensa-esp32-elf\\include\\c++\\8.4.0\\bits/std_function.h:687
#2 PsychicWebHandler::handleRequest (this=0x3f80ab94, request=<optimized out>) at lib/PsychicHttp/src/PsychicWebHandler.cpp:46
#3 0x401acd69 in PsychicEndpoint::requestCallback (req=<optimized out>) at lib/PsychicHttp/src/PsychicEndpoint.cpp:72
#4 0x401d4cf0 in httpd_uri (hd=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_uri.c:329
#5 0x401d3c0b in httpd_parse_req (hd=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_parse.c:659
#6 httpd_req_new (hd=0x3f808480, sd=<optimized out>) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_parse.c:787
#7 0x401d4379 in httpd_sess_process (hd=0x3f808480, session=0x3f809d18) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_sess.c:419
#8 0x401d32ef in httpd_process_session (context=0x3ffd9b08, session=0x3f809d18) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:178
#9 httpd_process_session (session=0x3f809d18, context=0x3ffd9b08) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:163
#10 0x40279835 in httpd_sess_enum (hd=<optimized out>, enum_function=0x401d32ac <httpd_process_session>, context=0x3ffd9b08) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_sess.c:50
#11 0x401d33e0 in httpd_server (hd=<optimized out>) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:228
#12 httpd_thread (arg=0x3f808480) at C:\\Users\\Pc\\.platformio\\packages\\framework-espidf@3.40406.240122\\components\\esp_http_server\\src\\httpd_main.c:250
....
I did nothing special. maybe gdb timeout will help you.
Well, I did it with exactly this command. What did you get as a result?
What did i do wrong? I'm using ESP-IDF 5.2 PowerShell, navigated to the project root dir
Oh okay, I copyed the files to my project dir and run the test again with gdb timeout 10 and i got a result finally!!
In the end i got this for some reason
===================== ESP32 CORE DUMP END =====================
===============================================================
Exception in thread Thread-1 (_readerthread):
Traceback (most recent call last):
File "threading.py", line 1038, in _bootstrap_inner
Exception in thread Thread-2 (_readerthread):
Traceback (most recent call last):
File "threading.py", line 1038, in _bootstrap_inner
File "threading.py", line 975, in run
File "threading.py", line 975, in run
File "subprocess.py", line 1552, in _readerthread
File "subprocess.py", line 1552, in _readerthread
OSError: [Errno 22] Invalid argument
OSError: [Errno 22] Invalid argument
Done!
Anyway, this gave me a lot of usefull info! Thank you very much!
We will look at that errors but you have finally decoded coredump. So I can close this issue.
Thank you very much.
Answers checklist.
Environment
General issue report
I have a function which saves the
coredump
partition data to a file so i can download it.Where db.append is just a wrapper for LittleFs append. I got the folllowing downloadable file:
I have tried to decode it with the following command:
idf.py coredump-info -c C:\Users\Pc\Desktop\coreDump\coreDump.bin
But i got the following error:
Is there a way to decode this to a meaningfull output?