Rate This Document
Findability
Accuracy
Completeness
Readability

General Application Running and Debugging

General application debugging provides remote debugging in a graphical user interface (GUI), improving debugging efficiency. During debugging, you can open only one project folder in VS Code.

Prerequisites

  • You have logged in to the Kunpeng DevKit.
  • The program has been compiled before debugging.
  • GDB has been installed on the remote server.
  • The C/C++ plugin has been installed. If it is not installed, download the C/C++ plugin installation package (version: 1.6.0 or later) as prompted or from the plugin marketplace.
  • In the Resource Manager of VS Code, the folder of the local source program has been opened.
  • To debug a general application, make sure that the configured remote server is added by manually generating a password-free public-private key pair.
  • Click Run or Debug. Configuration items of the two functions are the same. After setting the configuration items, click Run to start the running operation or Debug to start the debugging operation.
  • There is no requirement on the sequence of the Run and Debug operations.

Procedure

  1. Click in the navigation pane on the left, or click Development and then click Debug under Compiler and Debugger to display the debugging page.
  2. Select General application and set the other parameters, as shown in Figure 1. After the configuration is complete, click Start.
    Figure 1 General application debugging
    Table 1 General application debugging parameters

    Parameter

    Description

    Type

    The options are:

    • General application
    • Parallel HPC application
    • CUDA application
    • Security application

    Configured Remote Server

    Remote server for completing the debugging.

    Use an existing server or add a target server. Click Add Target Server to go to the target server management page. .

    Program

    Enter the full path of the program to be debugged on the remote server.

    (Optional) Program Arguments

    Arguments passed to the program for running.

    (Optional) Working Directory

    Enter the working directory of the program to be debugged.

  3. The RUN AND DEBUG window is displayed on the left. The VARIABLES, WATCH, BREAKPOINTS, and CALL STACK areas are displayed below RUN AND DEBUG. The source code and debugging buttons are displayed on the right. See Figure 2. You can move the mouse pointer to the left part in the debugging button area and click to drag debugging buttons to another place.
    Figure 2 Debugging page

    If general application debugging fails to be started, rectify the fault by following instructions in Failed to Start a General Application Debugging Task.

    Table 2 Description of debugging buttons

    Icon

    Button

    Description

    Resume

    Runs the code until the next breakpoint.

    Suspend

    Suspends the program that is being executed.

    Skip a single step

    Executes the next line of code.

    Step in

    Steps in to the function.

    Step out

    Steps out of the function.

    Restart

    Restarts debugging.

    Stop

    Stops debugging.

  4. Click the red point in front of a line number to add a breakpoint. You can click to execute to the current breakpoint or to the next line based on your debugging requirements.
    Figure 3 Executing to the breakpoint
    Figure 4 Executing to the next line
  5. Click in the navigation pane on the left to run the current debugging task. Figure 5 shows the results.
    Figure 5 Debugging and running results of a general application