Page 1 of 1

Function call backtracing with esp-idf

Posted: Wed May 02, 2018 12:05 pm
by MickPF
Hello,

I have written a (correct/well formed) program that triggers error messages in the depths of esp-idf. These parts of esp-idf are located in "esp-idf/components" and can therefore be changed in the source code before compiling. Since the called functions are called via callbacks, debugging is not possible or very difficult. A pure examination of the source code is too tedious.
Is there a call in esp-idf that works like the calls "backtrace_symbols" and/or "backtrace_symbols_fd" under linux?

Thanks in advance,
Michael

Re: Function call backtracing with esp-idf

Posted: Wed May 02, 2018 1:59 pm
by kolban
This may be an excellent opportunity to get to grips with JTAG debugging. If I had your puzzle, I'd engage JTAG and set a breakpoint where I wanted to gather information. When the breakpoint is reached deep in the bowels, the JTAG debugger can show my call path.

Re: Function call backtracing with esp-idf

Posted: Thu May 03, 2018 1:16 am
by markwj
What you want is not trivial. But, here are some notes which may help:

1. There are no symbols in the .bin file in flash. But, if your running App outputs something that looks like an address, the 'make monitor' part of esp idf will convert it to a symbol and show it.

2. As an alternative to [1], the xtensa tools have a utility to convert an address to a symbol. It is not very accurate on the line number, but close enough:

Code: Select all

xtensa-esp32-elf-addr2line -pfiaC -e build/<MYAPP>.elf 0x<ADDRESS>
3. See panic.c doBacktrace() for how to do a backtrace.

4. If you can trigger the issue yourself, then gdb is your friend. Make menuconfig and set the gdbstub option. Use abort() in your code, and you'll be in gdb with a full backtrace and examination capability.

There is also jtag...

Re: Function call backtracing with esp-idf

Posted: Thu May 03, 2018 9:54 am
by MickPF
As I see, using an JTAG would be the best way. According to the esp-idf docs it's possible to connect an JTAG adapter to the Feather.
My handycap is, I don't have anyone and I don't know which one and where to buy it!

Can you give me some advices?