“This is the 8th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021”


While learning some rust Lib recently, you need to look at internal data conversion and API usage, and the best way to do that is to look at the source code. While learning the source code, you can run in-process debug to see the flow.

Rust-analyzer is currently better supported in vscode, so this configuration is done in vscode.

In order to save time for future thinking, this article also records the configuration steps

Lead to

Now vscode needs to install the following plugin:

  1. Install the rust – analyzer plugin
  2. Install C/C++ plugin(Windows) → DEBUGER

Now that the plugins on Debug +lang are ready, we need to configure the debug startup properties

debug config

Click “Debug” → “Add Configuration”

On Windows, select C++ (Windows) → use GDB for debugging

A new launch.json is created. Need developers to modify the program(executable)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: <https://go.microsoft.com/fwlink/?linkid=830387>
    "version": "0.2.0"."configurations": [{"name": "(Windows) start"."type": "cppvsdbg"."request": "launch".// You need to configure the path of your execution file
            "program": "${workspaceRoot}/examples-play/target/debug/examples/exam_gjson.exe"."args": []."stopAtEntry": false."cwd": "${workspaceRoot}"."environment": []."console": "integratedTerminal",}}]Copy the code

Of course, if you need to debug multiple files, you will need to configure multiple files in launch.json.

Then we need to verify whether to start break:

All that is left is to add breakpoints → press F5 to start execution.