I'm cross-compiling a C application for an ARM aarch64 target. I want to debug it on the target which has gdb 9.1 installed and I would like to avoid both remote debugging and having to copy the source code tree onto the target for gdb to find it.
The idea is to have my cross GCC 9.3.0 add all my source code to the debug info of the ELF executable so gdb can use it (no need for library source code). I've found gcc options -g3 -ggdb3 on https://gcc.gnu.org/onlinedocs/gcc-9.3.0/gcc/Debugging-Options.html but that does not seem enough.
What magic can I use to integrate source code into debug info for gdb?
executable_changedevent, and then use objcopy to extract the section, unpack it, and then add the source tree to thedirectorysource search path in GDB.tar?rsync? It would help to know the target environment (e.g. bare metal, linux, FreeRTOS, etc.). And, target system (e.g. RPi et. al., nvidia Jetson, etc.). Creating a debuginfo file and sending that along seems like the most compact. I'm guessing you're using linux. For situations like this, I've copied files usingrsync, so it can happen quickly as, likely, the only copies are executable and 1-2 source files. Is debug console UART?