写文章的原因

网上很多人写了 esp32 的coredump 分析,好吧,我看了下,都是从网上摘抄的,根本跑不通,我想写一个给大家有用的。

官网文章

https://esp-idf-zh.readthedocs.io/zh_CN/latest/api-guides/core_dump.html

实例分析

1、首先保存 coredump 信息

类似下面的,都是一些字符

sC4AAA4AAABkAQAA
fLr8P1Dx/T8U8/0/
gPH9P7Dy/T+suvw/xD/8P7jl/T98uvw/vD/8PxQAAAAAAAAAOGD8P3y6/D8AAAAA
BQAAABjn/T9wdGhyZWFkAAcAAFEFNFQAfxTz/T8AAAAAIAsGAAUAAAAAAAAA
AAAAAAAAAAAAAAAAAJj8P2iY/D/QmPw/AAAAAAAAAAABAAAAAAAAAAhCQD8AAAAA
SB0AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAA=
hOkRgEoVDkAwBwYAsggOgBDy/T/ku/w/fLr8PwAAAAD/AAAAAAAAAAAAAAAA
8PH9P+S7/D/ku/w/3OUTQAEAAAAhAAYABAAAAAgAAAAcAAAAAAAAAP0UAEANFQBA
........

2、还需要你的 elf 文件

你每次编译都会生成一个 elf 文件,这个文件是什么鬼东西,自行百度。

3、执行命令

$ ./components/espcoredump/espcoredump.py dbg_corefile cat-wc/build/app_main.elf -c cat-wc/build/coredump.bin -t b64
espcoredump.py v0.1-dev
GNU gdb (crosstool-NG crosstool-ng-1.22.0-61-gab8375a) 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=i686-build_pc-cygwin --target=xtensa-esp32-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 cat-wc/build/app_main.elf...done.
[New <main task>]
[New process 1]
[New process 2]
[New process 3]
[New process 4]
[New process 5]
[New process 6]
[New process 7]
[New process 8]
[New process 9]
[New process 10]
[New process 11]
[New process 12]
[New process 13]
[New process 14]
#0  0x4012cbc3 in ledc_channel_config (ledc_conf=<optimized out>)
    at /cygdrive/e/AiThinkerIDE_V0.5/cygwin/home/aithinker/project/esp-idf/components/driver/ledc.c:328
328         return ret;
[Current thread is 1 (<main task>)]
(gdb)