Host-Based Heap Tracing

kaspernyhus
Posts: 22
Joined: Tue Mar 01, 2022 7:38 am

Host-Based Heap Tracing

Postby kaspernyhus » Wed Feb 15, 2023 10:46 am

Hi
I'm trying to trace heap usage on the ESP32s3 devkit with the example sysview_tracing_heap_log

What does this error mean:

Code: Select all

Not enough args! Need 2 trace data destinations!
Failed to init cmd ctx (-4)!
Full output from gdb:

Code: Select all

kaspernyhus@HP-ZBook:~/esp/sysview_tracing_heap_log$ xtensa-esp32s3-elf-gdb -x gdbinit build/sysview_tracing_heap_log.elf 
GNU gdb (esp-gdb) 11.2_20220823
Copyright (C) 2022 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=x86_64-linux-gnu --target=xtensa-esp-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://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 build/sysview_tracing_heap_log.elf...
0x42016392 in esp_pm_impl_waiti () at /home/kaspernyhus/esp/esp-idf/components/esp_pm/pm_impl.c:839
839	}
JTAG tap: esp32s3.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32s3.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
[esp32s3.cpu0] requesting target halt and executing a soft reset
[esp32s3.cpu0] Debug controller was reset.
[esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x500000EF, debug_reason=00000000
[esp32s3.cpu0] Reset cause (3) - (Software core reset)
[esp32s3.cpu1] requesting target halt and executing a soft reset
[esp32s3.cpu0] Core was reset.
[esp32s3.cpu0] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Debug controller was reset.
[esp32s3.cpu1] Core was reset.
[esp32s3.cpu1] Target halted, PC=0x40000400, debug_reason=00000000
[esp32s3.cpu1] Reset cause (3) - (Software core reset)
[esp32s3.cpu0] Reset cause (3) - (Software core reset)
Warning: 'flushregs', an alias for the command 'maintenance flush register-cache', is deprecated.
Use 'maintenance flush register-cache'.

Temporary breakpoint 1 at 0x42005258: file /home/kaspernyhus/esp/esp-idf/components/app_trace/heap_trace_tohost.c, line 36.
Note: automatically using hardware breakpoints for read-only addresses.
Temporary breakpoint 2 at 0x42005270: file /home/kaspernyhus/esp/esp-idf/components/app_trace/heap_trace_tohost.c, line 48.
[esp32s3.cpu0] Target halted, PC=0x42005258, debug_reason=00000001
Set GDB target to 'esp32s3.cpu0'
[esp32s3.cpu1] Target halted, PC=0x40043A40, debug_reason=00000000
[New Thread 1070541728]
[New Thread 1070543616]
[New Thread 1070537156]
[Switching to Thread 1070541728]

Thread 2 "main" hit Temporary breakpoint 1, heap_trace_start (mode_param=HEAP_TRACE_ALL) at /home/kaspernyhus/esp/esp-idf/components/app_trace/heap_trace_tohost.c:36
36	{
Total trace memory: 16384 bytes
Not enough args! Need 2 trace data destinations!
Failed to init cmd ctx (-4)!

thanks!

jamesarm97
Posts: 10
Joined: Tue Dec 27, 2022 4:25 pm

Re: Host-Based Heap Tracing

Postby jamesarm97 » Thu Feb 16, 2023 2:05 pm

I am dealing with exactly the same error message now. Nothing in my code continues that is past the heap trace start command.

jamesarm97
Posts: 10
Joined: Tue Dec 27, 2022 4:25 pm

Re: Host-Based Heap Tracing

Postby jamesarm97 » Thu Feb 16, 2023 2:58 pm

Got it. The gdbinit has to have the line:

mon esp sysview start file://xxxx.svdat changed to:

mon esp sysview start file://heap0.svdat file://heap1.svdat (or something similar).

Since there are two cores, it wants a dump file for each.

kaspernyhus
Posts: 22
Joined: Tue Mar 01, 2022 7:38 am

Re: Host-Based Heap Tracing

Postby kaspernyhus » Thu Feb 16, 2023 3:44 pm

Yes! I also found this out today!

made an example for anyone interested: https://github.com/kaspernyhus/esp32_heap_tracing

Thanks

Who is online

Users browsing this forum: No registered users and 94 guests