TUTORIAL: How to connect CLion with Dronecode probe

There are two steps to this, first making a CLion Debug configuration:


Second step is to find a .gdbinit file that gets loaded by the GDB instance that your debug configuration defines.
Mine is at /home/silver/.gdbinit

define target remote
	shell ln -fs /dev/serial/by-id/usb-*Black_Magic_Probe*-if00 .gdb_port.tmp
	tar ext .gdb_port.tmp
	mon swdp_scan
	attach 1
	set mem inaccessible-by-default off
end

This is intrusive in the operation of GDB in other cases where you need to use target remote but in this case it is a workaround for a missing feature in CLion. Having redefined the built-in command remote you will need to comment out this new part of the .gdbinit file if you need to use the actual target remote command.

1 Like

You can avoid this by moving your .gdbinit into the project root instead of ~.