CLion Debugging: Difference between revisions

From dreamcast.wiki
Jump to navigation Jump to search
No edit summary
Line 15: Line 15:
[[File:CLion Edit Configuration.png|frameless]]
[[File:CLion Edit Configuration.png|frameless]]


In the configuration editor window, select the + icon to create a new configuration and select "Remote GDB Debugger":
In the configuration editor window, select the + icon to create a new configuration and select "Embedded GDB Debugger":


[[File:Remote GDB Server.png|frameless]]
[[File:Embedded GDB Server configuration.png|frameless]]


== Remote GDB Server Settings ==
== Remote GDB Server Settings ==


Now that the new configuration has been created, the specific settings can now be populated to enable remote debugging sessions.
Now that the new configuration has been created, the specific settings can now be populated to enable remote debugging sessions.
=== Setup SSH credentials ===
CLion handles setting up and running the remote GDB server instance. Unfortunately, it requires running the executable through SSH which means CLion will have to "remotely" login to the same computer to run the dcload session. Once the host system is configured for SSH access, it's as simple as creating a new set of credentials within the debug configuration setup window to allow CLion to access your computer over SSH.
First, select the settings cog beside Credentials in the debug configuration:
[[File:SSH Credentials.png|frameless]]
Create a new set of credentials using the + button and fill in the information to be able to remotely connect to the host system:
[[File:SSH Credentials Page.png|frameless]]
If dcload will be run from the same system, it should be enough to enter "localhost" as the host and then fill in the user credentials for the user account on the host system. Using the "Test Connection" button should be an indication of whether the host system or credentials have been setup correctly. After saving the new SSH credentials, select them from the "Credentials" dropdown in the debug configuration page.
=== GDB Configuration Settings ===


Use the following settings in the debug configuration page:
Use the following settings in the debug configuration page:
Line 44: Line 28:
* '''Executable:''' Your executable for your project
* '''Executable:''' Your executable for your project
* '''GDB:''' Bundled GDB (This can handle SH-4 executables)
* '''GDB:''' Bundled GDB (This can handle SH-4 executables)
* '''Credentials:''' The credentials created in the previous section
* '''Upload Executable:''' Never
* '''Upload Executable:''' Never
* ''''target remote' args:''' localhost:2159 (default port for dcload's GDB instance)
* ''''target remote' args:''' localhost:2159 (default port for dcload's GDB instance)

Revision as of 16:01, 6 January 2023

This guide will help with setting up CLion for remote debugging through dcload's GDB feature.

Setup

The following criteria must be met before following this guide:

Creating a debug configuration

After opening your project in CLion, click the dropdown for the current debug/run configuration and select "Edit Configurations...":

CLion Edit Configuration.png

In the configuration editor window, select the + icon to create a new configuration and select "Embedded GDB Debugger":

Embedded GDB Server configuration.png

Remote GDB Server Settings

Now that the new configuration has been created, the specific settings can now be populated to enable remote debugging sessions.

Use the following settings in the debug configuration page:

  • Name: Dreamcast Debug IP/Serial (really, it's up to the user)
  • Target: Your project
  • Executable: Your executable for your project
  • GDB: Bundled GDB (This can handle SH-4 executables)
  • Upload Executable: Never
  • 'target remote' args: localhost:2159 (default port for dcload's GDB instance)
  • GDB Server: /path/to/dc-tool-[ip|serial]
  • GDB Server args: -g -x $CMakeCurrentBuildDir$/<your executable name>.elf -c $CMakeProjectDir$ -t <IP address or /dev/tty device>
  • -g: Starts dcload with GDB
  • -x: Uploads and executes your binary
  • -c: Points dcload to your project directory to be able to load files with "/pc/" (requires superuser)
  • -t: The device dcload should target
  • Advanced GDB Server Options
  • Run with root privileges: Checked

Once all settings have been configured, click "Apply" and the configuration should be ready.