Library containing the Guru mediation error

RatTrap85
Posts: 8
Joined: Mon Oct 17, 2022 10:37 pm

Library containing the Guru mediation error

Postby RatTrap85 » Tue Oct 01, 2024 1:56 am

I have a device on the other side of the world that I have to debug remotely, and can OTA it no problem. One of the things I want to do is to datalog any Guru Mediation Errors that may be thrown out. I have found where it is for esp-idf but the who system and code was build around arduino IDE so I am trying to find where the code for the Core panic handler from printing out to serial to data logging so I can recover it and maybe find a piece of the puzzle and solve their problem.

So that was a very verbose way of asking does anyone know which library handles the print Guru mediation Error: like this


// this is just an example I don't have one of these for the device in question. this is just to show the kind of data I am hoping to // recover.
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.

Core 1 register dump:
PC : 0x84aeb2bc PS : 0x00060230 A0 : 0x82017455 A1 : 0x3fcf6b00
A2 : 0x00000000 A3 : 0x3fcc5b80 A4 : 0x3fcf6c08 A5 : 0x3fcf4328
A6 : 0x3fcf4318 A7 : 0x00000000 A8 : 0x82017424 A9 : 0x3fcf6ae0
A10 : 0x3fcf6c08 A11 : 0x3fcc5b80 A12 : 0x00000002 A13 : 0x3fcbc720
A14 : 0x4037ada8 A15 : 0x00000001 SAR : 0x00000017 EXCCAUSE: 0x00000014
EXCVADDR: 0x84aeb2bc LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0xffffffff


Backtrace: 0x44aeb2b9:0x3fcf6b00 0x42017452:0x3fcf6b20 0x420174a9:0x3fcf6b40 0x42017769:0x3fcf6cd0




ELF file SHA256: 079c2e295ee1bc27


thank you in advance. The information I get from doing this may or may not be helpful but more data is better than less

lbernstone
Posts: 817
Joined: Mon Jul 22, 2019 3:20 pm

Re: Library containing the Guru mediation error

Postby lbernstone » Tue Oct 01, 2024 5:51 am

It's unclear what you are looking for. The panic behavior is compiled into the framework, and not designed to be easy to modify.
In arduino-esp32 v3.0, a coredump partition was added to the default partitions. It would not be too difficult to write some code to allow you to retrieve the coredump partition from a remote device so that you could analyze it.

RatTrap85
Posts: 8
Joined: Mon Oct 17, 2022 10:37 pm

Re: Library containing the Guru mediation error

Postby RatTrap85 » Tue Oct 01, 2024 6:06 am

Thank you for the quick reply and the link to the Panic code. I agree getting to the dump partition and reading it was easy, what I am trying to do is figure out what the data is. Right now all I have is size and a bunch of bytes with no context. I figure if I can find where it prints the output I will find the structure of the data and can then write a different piece of code that data logs that. When the device goes online it can send me those data logs and I can debug it from that. Ofcourse I have no guarantee that it will crash or produce a core dump or provide any information whatsoever. Right now I am just trying to increase the information I have on the issue, which at this point is basically zero. So any information I can get increases the odds that I solve the problem they are facing, Unfortunately it is several thousand miles away and me going to it isn't an option and no one in the region to act as my hands.

Maybe with the link you included I can find the function and use it as a template to create the data logger. If that makes any sense at all.

Thank you again.

Charlie

RatTrap85
Posts: 8
Joined: Mon Oct 17, 2022 10:37 pm

Re: Library containing the Guru mediation error

Postby RatTrap85 » Tue Oct 01, 2024 6:25 am

when I try to access the coredump file it is just gibberish. In a nut shell I want to access where the backtrace information is stored in the crash report that way I can data log it. here is the code that I threw together to just get a handle on the idea. Not logging anything yet. but if I can print it then I can definitely log it. so far no dice. Also tried just printing the dump data but that was just gibberish.

Code: Select all

void log_core_dump(){
  
  size_t DumpAddress = 0;
  size_t DumpSize = 0;
  esp_core_dump_image_get(&DumpAddress, &DumpSize);
  Serial.println("\r\n\r\n\r\n\r\ndump information!!!!");
  Serial.print("core dump address: ");Serial.println(DumpAddress);
  Serial.print("core dump size: ");Serial.println(DumpSize);


  esp_core_dump_summary_t summary;
  if (DumpSize!=0) {
    if (esp_core_dump_get_summary(&summary) == ESP_OK) {
      uint32_t backtrace_entries = 0;
      bool backtrace_corructed = false;
      
      Serial.print("exc_tcb: ");
      Serial.println(summary.exc_tcb);
      Serial.print("exc_task: ");
      for(uint8_t i=0;i<16;i++){
        Serial.print(summary.exc_task[i]);
      }
      backtrace_entries = summary.exc_bt_info.depth;
      Serial.print("\r\nBacktrace entries: ");
      Serial.println(backtrace_entries);
      Serial.print("Entries: ");
      for(uint32_t i=0;i<16;i++){
        if(i>=16)break;
        Serial.print("0x");
        Serial.print(summary.exc_bt_info.bt[i],HEX);
        Serial.print(' ');
      }
      Serial.print("\r\nBacktrace Corrupted: ");
      if(summary.exc_bt_info.corrupted){
        Serial.println("TRUE");
      }
      else{
        Serial.println("FALSE");
      }
    }
  }
  esp_core_dump_image_erase();
}
hope that explains what I am trying to do.

lbernstone
Posts: 817
Joined: Mon Jul 22, 2019 3:20 pm

Re: Library containing the Guru mediation error

Postby lbernstone » Tue Oct 01, 2024 5:26 pm

Use esp-coredump to decode your dump and get the backtrace. You should be able to find the gdb executable in your file system. You will need the elf file from compiling your code. Those end up in /tmp or %USERDATA% .
Take a look at Insights. It has been ported to arduino-esp32. It has code that you should be able to use if you really want to go down this rabbit hole.

RatTrap85
Posts: 8
Joined: Mon Oct 17, 2022 10:37 pm

Re: Library containing the Guru mediation error

Postby RatTrap85 » Thu Oct 03, 2024 5:39 am

Thank you for the help. Unfortunately I can't avoid the rabbit hole, like Alice i already fell in and apparently something wicked this way comes. Oh my

Who is online

Users browsing this forum: Google [Bot] and 37 guests