Sometimes when attaching with GDB one will try to back trace and get something like:
#0 0x1fff0d4e in ?? () (system memory, 3406 bytes in)
#1 0x1fff099e in ?? () (system memory, 2462 bytes in)
Where is your program?!?!
What's going on here is that the built-in bootloader is running. At least for the STM32F401, the memory region starting at
0x1FFF0000 is for "system memory", which is a read-only region containing the bootloader. GDB doesn't have the "source" for these memory locations, so it can't print a backtrace. The chip ends up in this bootloader based on the
BOOT1 pin states during power on; see the relevant datasheet for details.