Skip to content

Instantly share code, notes, and snippets.

@stefanct
Created March 6, 2024 17:56
Show Gist options
  • Save stefanct/c4fb49a7b835c3eaf74aed6547455c87 to your computer and use it in GitHub Desktop.
Save stefanct/c4fb49a7b835c3eaf74aed6547455c87 to your computer and use it in GitHub Desktop.
cmake: create a debug target that launches gdb and a respective gdbserver
add_custom_target (
${PROJECT_NAME}_debug
DEPENDS .${PROJECT_NAME}_gdbserver
COMMAND gdb-multiarch
-ex "target extended-remote :3333"
-ex "load"
-ex "monitor reset"
--args $<TARGET_FILE:${PROJECT_NAME}>
)
add_custom_target (
.${PROJECT_NAME}_gdbserver
COMMAND sh -c "gdbserver-path and arguments &"
VERBATIM
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment