coredump怎么使用?

cxm007
Posts: 15
Joined: Wed Mar 15, 2023 2:44 am

coredump怎么使用?

Postby cxm007 » Mon Jul 03, 2023 3:57 am

环境:window11 vscode
版本库:v5.0-rc1*

我按ESP--FAQ文档来使用coredump
https://docs.espressif.com/projects/esp ... 2-coredump
在执行espcoredump.py info_corefile -t elf -c coredump.bin C:\Users\15119\esp\Code008_ESPS32\build\Code008.elf时.
出现了以下问题:
  1. Traceback (most recent call last):
  2.   File "C:\Users\15119\esp\esp-idf\components\espcoredump\espcoredump.py", line 77, in <module>
  3.     main()
  4.   File "C:\Users\15119\esp\esp-idf\components\espcoredump\espcoredump.py", line 62, in main
  5.     temp_core_files = espcoredump.info_corefile()
  6.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\coredump.py", line 398, in info_corefile
  7.     self.core_elf = ESPCoreDumpElfFile(core_elf_path)
  8.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\corefile\elf.py", line 309, in __init__
  9.     super(ESPCoreDumpElfFile, self).__init__(elf_path, _e_type, _e_machine)
  10.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\corefile\elf.py", line 117, in __init__
  11.     self.read_elf(elf_path)
  12.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\esp_coredump\corefile\elf.py", line 128, in read_elf
  13.     header_tables = ElfHeaderTables.parse(elf_bytes)
  14.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 288, in parse
  15.     return self.parse_stream(io.BytesIO(data), **contextkw)
  16.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 300, in parse_stream
  17.     return self._parsereport(stream, context, "(parsing)")
  18.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  19.     obj = self._parse(stream, context, path)
  20.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2120, in _parse
  21.     subobj = sc._parsereport(stream, context, path)
  22.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  23.     obj = self._parse(stream, context, path)
  24.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2653, in _parse
  25.     return self.subcon._parsereport(stream, context, path)
  26.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  27.     obj = self._parse(stream, context, path)
  28.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2120, in _parse
  29.     subobj = sc._parsereport(stream, context, path)
  30.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  31.     obj = self._parse(stream, context, path)
  32.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2653, in _parse
  33.     return self.subcon._parsereport(stream, context, path)
  34.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  35.     obj = self._parse(stream, context, path)
  36.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2120, in _parse
  37.     subobj = sc._parsereport(stream, context, path)
  38.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  39.     obj = self._parse(stream, context, path)
  40.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2653, in _parse
  41.     return self.subcon._parsereport(stream, context, path)
  42.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 312, in _parsereport
  43.     obj = self._parse(stream, context, path)
  44.   File "C:\Users\15119\.espressif\python_env\idf5.0_py3.8_env\lib\site-packages\construct\core.py", line 2728, in _parse
  45.     raise ConstError(f"parsing expected {repr(self.value)} but parsed {repr(obj)}", path=path)
  46. construct.core.ConstError: Error in path (parsing) -> elf_header -> e_ident -> EI_MAG
  47. parsing expected b'\x7fELF' but parsed b'\xe4\x1c\x00\x00'
查阅了网上的其他案例,有的说是4.3之后就会出现这个问题。
请问这个问题要如果解决?谢谢
打破认知

ESP_Zombie
Posts: 20
Joined: Tue Mar 15, 2022 6:15 am

Re: coredump怎么使用?

Postby ESP_Zombie » Tue Aug 08, 2023 9:11 am

IDF monitor 带有 自动解码地址 的功能,您可以直接参考 https://docs.espressif.com/projects/esp ... r.html#id3。 从而无需自动解码。

此外,观察到您的 IDF 版本不是一个正式的 tag 分支,您是否方便切换到类似于 ESP-IDF 5.0.2 或者 ESP-IDF 5.1 上再做手动解析 coredump 的尝试?可以参考 https://docs.espressif.com/projects/esp ... _dump.html

cxm007
Posts: 15
Joined: Wed Mar 15, 2023 2:44 am

Re: coredump怎么使用?

Postby cxm007 » Mon Aug 21, 2023 7:23 am

您好,我切换到了ESP-IDF 5.1,参考了这里的文档https://docs.espressif.com/projects/esp ... _dump.html
但在执行以下命令后,仍然显示有错误,如下:

Code: Select all


C:\Users\15119\esp\EXA\core_dump_test\5.1_3.11_3>idf.py -p COM6 coredump-info build\\hello_world.elf
Executing action: coredump-info
Failed to load core dump: parttool script execution failed with error 1, failed command was: 'C:\Users\15119\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py --port COM6 --baud 460800 read_partition --partition-type data --partition-subtype coredump --output C:\Users\15119\AppData\Local\Temp\tmph1hw5ws4'

┌────── Additional information about the error: 
│   
│   esptool.py v4.7.dev1
│   Serial port COM6
│   Connecting.........
│   Detecting chip type... ESP32-S3
│   Chip is ESP32-S3 (QFN56) (revision v0.1)
│   Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
│   Crystal is 40MHz
│   MAC: f4:12:fa:e0:72:04
│   Uploading stub...
│   Running stub...
│   Stub running...
│   Changing baud rate to 460800
│   Changed.
│   3072 (100 %)
│   3072 (100 %)
│   Read 3072 bytes at 0x00008000 in 0.1 seconds (312.3 kbit/s)...
│   Hard resetting via RTS pin...
│   Running C:\Users\15119\.espressif\python_env\idf5.1_py3.11_env\Scripts\python.exe C:\Users\15119\esp\esp-idf-release-v5.1\components\esptool_py\esptool\esptool.py --port COM6 --baud 460800 read_flash 32768 3072 C:\Users\15119\AppData\Local\Temp\tmp5_nmvpyy...
│   Traceback (most recent call last):
│     File "C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py", line 358, in <module>
│       main()
│     File "C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py", line 351, in main
│       op(**common_args)
│     File "C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py", line 182, in _read_partition
│       target.read_partition(partition_id, output)
│     File "C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py", line 158, in read_partition
│       partition = self.get_partition_info(partition_id)
│                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│     File "C:\Users\15119\esp\esp-idf-release-v5.1\components\partition_table\parttool.py", line 140, in get_partition_info
│       partition = partition[0]
│                   ~~~~~~~~~^^^
│   IndexError: list index out of range
│
└────── end of additional information about the error.
是还有什么环节遗漏了吗?
项目的代码我放附件;
5.1_3.11_3.zip
core dump测试代码
(27.12 KiB) Downloaded 437 times
如果能帮忙看下问题,非常感谢!
打破认知

ESP_Zombie
Posts: 20
Joined: Tue Mar 15, 2022 6:15 am

Re: coredump怎么使用?

Postby ESP_Zombie » Tue Aug 22, 2023 12:19 pm

您好,您可以直接使用 idf.py coredump-info 来获取对应信息,比如:
Attachments
Selection_025.png
Selection_025.png (169.71 KiB) Viewed 3125 times

Who is online

Users browsing this forum: No registered users and 28 guests