Skip to content

Debug for AuboCaps Guide

Duringaubo_capsdevelopment, debugging the plugin under development in theaubo_scopetutorial is a very important and frequent task. This tutorial is based onqtcreator and gdbcommand line debugging solution, developers can choose the debugging solution that suits their own usage habits.

Oscillator plug-in development and debugging program based on qtcreator

Plug-in output path settings:

For aubo_capsto run, it must be loaded into the working directory of aubo_scope. After installing the arcspackage, a folder arcs_wsis generated in the root (or home)directory, and that file is the working section of aubo_scope, build a runnable plugin, set the output path of the target attribute to be under arcs_ws when building a runnable plugin.

The specific realization is as follows: (in the plug-in project CMakeLists.txt set, to the example plug-in project myplugin as an example)

cmake
#Setting the output path of the plug-in
set(PLUGIN_OUTPUT_PATH $ENV{HOME}/arcs_ws/extension)

#Building 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
)
  • In this example, when generating the myplugin dynamic library file, the ${_srcs}, ${install_src}, ${program_src}files used can be set according to your own plug-in needs.

  • When setting the generated myplugin attributes, in this tutorial, pay attention to the LIBRARY_OUTPUT_DIRECTORYtarget path settings, and other attributes can be set according to the needs of your own plugin.

Compilation configuration for plugin projects in qtcreator:

  1. Main idea: change the runtime configuration of the plugin project, so that when compiling the plugin project, directly update the content of the plugin under arcs_ws and run aubo_scopefor debugging.

  2. Specific configuration: (Taking mypluginas an example here)

    • Openqtcreatorand open our plugin project.

    • SelectProhectsin the left menu bar and click run. The following options need to be configured in this screen:

      Active Project: Select the plug-in project.

      Running Configuration: To add a new running configuration, click add on the right.

      EXecutable:Set this path to the location of the aubo_scopeexecutable. Installarcs under /opt/arcsby default.

      debug-01

  3. It is recommended that the path toBuildis also customized: (usually set to the builddirectory)

    • SelectProject->Build->Set Build Directory

    debug-02

The general process of debugging a plugin in qtcreator:

  • After completing the above configuration, select the newly configured option and directly compile the plugin project to debug the plugin.

    • If multiple running schemes are configured for the plugin, it is necessary to select the newly configured configuration for runningaubo_scope(here the author's configuration is renamed asdebug_myplugin), as shown in the figure:

      debug-03
    • The result of compiling the plugin run is as follows:

      debug-04

  • It should be noted that when loading the plugin into the aubo_scopedemonstrator for the first time, a zip format compressed package of the plugin needs to be provided arcs_ws

Development and debugging scheme of teaching pendant plugin based on gdb

Setting of plugin output path:

The operation of aubo_capsmust be loaded into the working directory of aubo_scope. After installing the arcs package, a folder named arcs_ws will be generated in the root (or home) directory, which is the working range ofaubo_scope.Therefore, when building a runnable plugin, set the output path of the target property to arcs_ws.

The implementation is as follows: (set in CMakeLists.txtof the plugin project, take the example plugin project mypluginas an example)

cmake
#Setting the output path of the plug-in
set(PLUGIN_OUTPUT_PATH $ENV{HOME}/arcs_ws/extension)

#Building 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
)
  • In this example, the ${_srcs}, ${install_src}, ${program_src} files used in generating the myplugindynamic library file can be set according to the needs of your own plugin.

  • When setting the generated myplugin attributes, in this tutorial you only need to focus on setting the LIBRARY_OUTPUT_DIRECTORY target path, and other attributes can be set according to your own plugin needs.

  • The purpose of this is to automatically update the plugin's dynamic library files in the arcs_ws working directory after updating the plugin's source code, rather than having to manually add the plugin's zip package to the arcs_ws directory as the first time the plugin was loaded in aubo_scope.

gdbbased plugin debugging process:

Similarly, the first time a plugin is loaded into aubo_scope, the plugin must be packaged in zip format and copied to the arcs_ws directory.

  1. Compile the plugin source code:

    Go to the root directory of the plugin project, and then execute the following commands: here the compilation must be careful to keep the debug message, or else starting aubo_scope and hitting a breakpoint in the plugin won't go into the plugin dynamic library code. That is: cmake -DCMAKE_BUILD_TYPE=Debug ..

    bash
    mkdir -p build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Debug..
    make -j`nproc`
  2. Startaubo_scope under gdb

    The default installation path of aubo_scope is under /opt/arcs, if you have more than one version of aubo-scope , you need to choose the appropriate version, and then go to the bin directory to find the aubo_scopeexecutable file. (The author has chosen version 0.18.0.)

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

    If the startup is successful it will prompt:

    gdb
    Reading symbols from ./aubo_scope...done.
  3. Set breakpoints, debugging plug-in source code: (here breakpoints need to be set to the plug-in source code)

Debug directly by setting breakpoints with the break command.

The mypluginplugin is used as an example to show a debugging process and its simplicity:

  • Compile the myplugin source code:

    debug-05


  • start gdb

debug-06


Setting breakpoints: (the location of the breakpoints here is shown below)

debug-07


  • View source code at breakpoints: (use thelist command to view source code information for the current stack area, default display is 10 lines).

debug-08


  • To see the value of a variable: (use the single-step call command b to let the program run to the position int a = 100and use the p command to see the value of a).

debug-09