espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.85k stars 7.32k forks source link

Can't generate SEGGER SystemView heap log (IDFGH-13391) #14299

Open Massimiliano-solutiontech opened 3 months ago

Massimiliano-solutiontech commented 3 months ago

Answers checklist.

General issue report

I’m using esp-idf v5.3 with an ESP32-C6 WROOM devkit, and I would like to track the heap using SEGGER SystemView. However, when I launch the gdbinit script, it never stops (even though my code includes heap_trace_stop()), and the generated svdat file is empty except for the header. On the other hand, if I don’t track the heap and generate the binary log via esp sysview start, the file is correctly generated. However, if the log becomes too large, SystemView hangs during analysis

gdbinit


set pagination off
target remote :3333

mon reset halt
maintenance flush register-cache

tb heap_trace_start
commands
mon esp sysview start file://heap_log.svdat
c
end

tb heap_trace_stop
commands
mon esp sysview stop
end

c

heap_log.svdat

;
; Version     SEGGER SystemViewer V2.42
; Author      Espressif Inc
;
erhankur commented 3 months ago

@Massimiliano-solutiontech Thanks for reporting the issue. I will test it and get back to you.

erhankur commented 3 months ago

@Massimiliano-solutiontech It worked for me with the IDF 5.3 release, OpenOCD Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:28) and GNU gdb (esp-gdb) 14.2_20240403

Can you enable OpenOCD verbose log and attach the tog.txt ?

set pagination off
target remote :3333

mon debug_level 3
mon log_output log.txt

mon reset halt
maintenance flush register-cache

tb heap_trace_start
commands
mon esp sysview start file:///tmp/heap_log.svdat
c
end

tb heap_trace_stop
commands
mon esp sysview stop
end

c

And I need to warn you that we have an OpenOCD issue regarding flash size, which is fixed in the latest OpenOCD release. Make sure you set the flash size to at least 4MB in the menuconfig.