drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

how to debug drogon web in vscode? Or, can you share other debugging methods #499

Closed varichs closed 3 years ago

an-tao commented 4 years ago

You could run your web application in vscode debugging mode, set breakpoints and run it step by step as debugging any other c++ program. To make an HTTP request, you can use a browser or command-line tool (such as curl). And you could also set LogLevel to "Trace" to get more Drogon debug logs.

Cygon commented 4 years ago

I'm using Visual Studio Code to debug my Drogon application on Linux.

Not sure what you're having trouble with, but here's how my application is set up:

{
  // 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": "(gdb) Launch",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/bin/linux-gcc9.3-amd64-debug/NuclexAlexandriaNative",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ]
    }
  ]
}

And of course, GDB, the GNU Debugger, must be installed.

Lipe1994 commented 7 months ago

mac with apple silicon chip(m1) have not suport to GDB... I Think it work lldb

{
    // 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": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/YourProjectName",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}