Rate This Document
Findability
Accuracy
Completeness
Readability

General Application Running and Debugging

General application debugging provides remote debugging capabilities on the Kunpeng and Phytium platforms and a graphical user interface (GUI), improving debugging efficiency. During debugging, you can open only one project folder in VS Code.

Prerequisites

  • The program has been compiled before debugging.
  • GDB has been installed on the remote server.
  • The VS Code version must be 1.58.2 or later.
  • 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 shortcut menu area on the left, or click Development and choose Debug under Compiler and Debugger. On the debug configuration page that is displayed, select General application for Type and set other parameters as required. See Figure 1.
    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
    • DPU debugging

    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.

  2. Click Start. 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.
    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

    Button

    Description

    Runs the code until the next breakpoint.

    Suspends the program that is being executed.

    Executes the next line of code.

    Steps in to the function.

    Steps out of the function.

    Restarts debugging.

    Stops debugging.

    You can move the mouse pointer to the left part in the debugging button area and click to drag debugging buttons to another place.

  3. 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
  4. 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