This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

arm-none-eabi-gdb out of memory

I'm developing on a embedded application running on an STM32F405 processor. I'm using VSCode and arm-none-eabi-gcc/gdb on Windows (10).
As my application grew I experienced that debugging became increasingly slower and unstable. I could step through some code, but eventually this became almost unusable.
I have now resorted to just using the debugger with the command line, windows command prompt.
Sometimes I get a terminal output like this:
/mnt/workspace/workspace/GCC-10-pipeline/jenkins-GCC-10-pipeline-338_20211018_1634516203/src/gdb/gdb/utils.c:671: internal-error: virtual memory exhausted: can't allocate 4064 bytes.
A problem internal to GDB has been detected,
Other times arm-none-eabi-gdb.exe seems to just get killed, probably because it hits the 2GB memory limit for a 32bit process.
Stepping through simple instructions seems to work without problem. But when a function from a new source file is being called (a function from a source file that hasn't been used in the current session yet), memory consumption increases excessively. And memory is never been deallocated.
Here is the way I run an actual debug session:
Terminal 1:
pyocd gdb --target STM32F405VG -O reset_type=hw -O connect_mode=under-reset
Terminal 2:
arm-none-eabi-gdb.exe board.elf
target remote localhost:3333
monitor reset halt
break main
cont
# At first breakpoint
next
next
... and so on.
When stepping though the code, observe the memory consumption of arm-none-eabi.gdb.exe. The Windows task manager - Details view will do.
Memory consumption doesn't change much when executing functions that reside in the same source file, but when a function from a new file is being called, there will be a significant increase in memory consumption of the gdb processs - until it fails.
I've tried a number of versions of arm-none-eabi-gdb.exe, all behave similar:
10 2020-q4-major
10 2021.10
9 2020-q2-update
and
Arm GNU Toolchain 12.2.MPACBTI-Bet1 (Build arm-12-mpacbti.16)) 13.0.50.20220406-git
It turns out I get to crash the debugger even without having a debug session to the target board:
Terminal Session, no pyocd needed:
arm-none-eabi-gdb.exe -nx board.elf
list main # code in main.cpp
list function1 # code in file1.cpp
list function2 # code in file2.cpp
.. and so on. In my system, gdb reaches the 2GB limit after about 8 of these list calls.
Even a commad like "info locals" runs to occupy a very sizeable amount of memory.
The application image that I'm running is about 230KB big at present. Sometimes it looks like the memory consumption of arm-none-eabi-gdb increases by about that amount.
It is a logging application that is being ported to MBed OS. In general, the application works, It is not running out of memory on its own.
Anyone has seen something similar, like arm-none-eabi-gdb.exe running out of memory?