Skip to content

Debugging Guide

Debugging is a crucial and frequent task during plugin development. Currently, two debugging solutions are provided: Qt Creator-based and GDB command line. Developers can choose the appropriate debugging solution based on their requirements.

Prerequisites for Qt Creator-based plugin debugging:

  1. Qt Creator and AUBO Scope must be installed in the same development environment.
  2. The plugin must be loaded into the AUBO Scope software.

Prerequisites for GDB-based plugin debugging:

  1. The plugin must be loaded into the AUBO Scope software.

Plugin Development and Debugging Strategies Based on Qt Creator

Plugin Output Path Configuration

After installing the AUBO Scope software package, the software will generate an arcs_ws folder in the root (or home) directory. The arcs_ws folder serves as the workspace for AUBO Scope. Plugins must be loaded into AUBO Scope's working directory to run, therefore when building executable plugins, the output path of target properties should be set in the arcs_ws folder.

Taking the plugin myplugin as an example, set the following content in myplugin's CMakeLists.txt:

cmake
# Set plugin output path
set(PLUGIN_OUTPUT_PATH $ENV{HOME}/arcs_ws/extension)

# Build plugin that can be loaded in aubo_scope
add_libary(myplugin SHARED
	${_srcs}
	${install_src}
	${program_src}
	)
set_target_properties(myplugin PROPERTIES
	LABELS aubo_caps
	OUTPUT_NAME myplugin
	PREFIX ""
	DEBUG_POSTFIX ""
	LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_OUTPUT_PATH}/myplugin
	CXX_VISIBILITY_PRESET hidden
)

注意

  1. When generating the myplugin dynamic library file, users need to configure the ${_srcs}, ${install_src}, and ${program_src} files as required.
  2. When setting the properties of the generated myplugin, it is only necessary to focus on configuring the target path for LIBRARY_OUTPUT_DIRECTORY. Other properties can be set as needed.

Plugin Project Compilation Configuration

When Qt Creator and AUBO Scope are installed in the same development environment, modify the plugin project's run configuration to update the plugin content under arcs_ws directly during compilation and run the AUBO Scope software for convenient debugging.

Using the myplugin plugin as an example, here's the detailed configuration method:

  1. Open Qt Creator and open the myplugin plugin project.

  2. Click "Projects" in the left menu bar, click "Projects > Run", and configure the following items:

    1. Active Project: Select the plugin project (myplugin).
    2. Run Configuration: Add a new run configuration by clicking "Add..." on the right side.
    3. Executable: Set this path to the location of the AUBO Scope executable file. By default, AUBO Scope is installed under /opt/arcs.

    debug-01

  3. Main concept: Modify the plugin project's run configuration so that when compiling the plugin project, it directly updates the plugin content under arcs_ws and runs aubo_scope for debugging convenience.

  4. Specific configuration: (using myplugin as an example)

    • Open qtcreator and open our plugin project.

    • Select Projects in the left menu bar, click run. Configure the following options in this interface:

      Active Project: Select the plugin project.

      Run Configuration: Add a new run configuration by clicking add on the right side.

      Executable: Set this path to the location of the aubo_scope executable file. By default, arcs is installed under /opt/arcs.

      debug-01

  5. (Recommended modification) Customize the [Build] path, typically set to the [build] directory.

    debug-02

Qt Creator Debugging Process

  1. Open Qt Creator and open the myplugin project.

  2. Click on "Debug" at the bottom of the left menu bar, select the configured option, then compile the plugin project to begin debugging the plugin.

    • If multiple run configurations have been set up for this plugin, you need to select the aubo_scope configuration that was just set up (renamed here as debug_myplugin).
  3. The compilation and running results of the plugin are shown below:

    debug-04

Plugin Development and Debugging Strategies Based on Qt Creator GDB

Set Plugin Output Path

Similar to the Qt Creator debugging approach, when building runnable plugins, set the output path of the target properties under the arcs_ws folder to automatically update the plugin dynamic library files in the arcs_ws folder after updating the plugin source code.

Taking the plugin myplugin as an example, set the following content in myplugin's [CMakeLists.txt]:

cmake
# Set the plugin output path
set(PLUGIN_OUTPUT_PATH $ENV{HOME}/arcs_ws/extension)

# Build plugins that can be loaded in aubo_scope
add_libary(myplugin SHARED
	${_srcs}
	${install_src}
	${program_src}
	)
set_target_properties(myplugin PROPERTIES
	LABELS aubo_caps
	OUTPUT_NAME myplugin
	PREFIX ""
	DEBUG_POSTFIX ""
	LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_OUTPUT_PATH}/myplugin
	CXX_VISIBILITY_PRESET hidden
)

注意

  1. When generating the myplugin dynamic library file, users need to configure the ${_srcs}, ${install_src}, and ${program_src} files according to their requirements.
  2. When setting the properties of the generated myplugin, here you only need to focus on setting the LIBRARY_OUTPUT_DIRECTORY target path. Other properties can be configured as needed.

GDB Debugging Process

  1. Navigate to the root directory of the plugin project and execute the following commands to compile the plugin source code:

    bash
    mkdir -p build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Debug..
    make -j`nproc`

    注意

    Ensure that the debug information is retained (i.e., cmake -DCMAKE_BUILD_TYPE=Debug ..). Otherwise, after launching AUBO Scope, setting breakpoints in the plugin source code will not allow you to step into the plugin's dynamic library code.

  2. Launch AUBO Scope under GDB:

    bash
    cd /opt/arcs/0.18.0/bin
    gdb ./aubo_scope

    注意

    The default installation path for AUBO Scope is under /opt/arcs. If multiple versions of AUBO Scope are installed, you need to select the appropriate version first, then navigate to its bin directory to locate the aubo_scope executable file (in this case, version 0.18.0 is used).

    If the launch is successful, the following message will appear:

    gdb
    Reading symbols from ./aubo_scope...done.
  3. Set breakpoints in the plugin source code and debug the plugin. You can directly use the break command to set breakpoints for debugging.

Below is a simple debugging process using the plugin myplugin as an example:

  1. Compile the myplugin source code.

    debug-05

  2. Launch GDB.

    debug-06

  3. Set breakpoints. The breakpoint location is shown in the figure below.

    debug-07

  4. View the source code at the breakpoint. You can use the list command to view the source code in the current stack frame. By default, it displays 10 lines.

    debug-08

  5. Inspect variable values. Use the step command b to run the program to the line int a = 100, and then use the p command to check the value of a.

    debug-09