0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Symbol サーバをデバッガ上で実行

Posted at

Symbol サーバをデバッガ上で実行

gdb インストール

gdb が入っていないと思うので、インストールします。

sudo apt install -y gdb

タスクの追加

デバッグ前にビルドと server.lock ファイルを削除するタスクを .vscode/tasks.json に追加します。

.vscode/tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "Symbol 構成",
            "command": "ninja publish",
            "options": {
                "cwd": "${workspaceFolder}/build"
            },
            "dependsOn": [
                "CMake: 構成"
            ],
            "problemMatcher": [],
            "detail": "ビルド前の `ninja publish` コマンド"
        },
        {
            "type": "shell",
            "label": "CMake: デバッグ前ビルド",
            "command": "rm -rf server.lock",
            "options": {
                "cwd": "${workspaceFolder}/build/data"
            },
            "dependsOn": [
                "CMake: ビルド"
            ],
            "problemMatcher": [],
            "detail": "デバッグ前の server.lock 削除"
        },
    ]
}

デバッグ構成の作成

.vscode/launch.json を作成します。

.vscode/launch.json
{
    // IntelliSense を使用して利用可能な属性を学べます。
    // 既存の属性の説明をホバーして表示します。
    // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Symbol サーバー デバッグ",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/build/bin/catapult.server",
            "args": [],
            "environment": [],
            "cwd": ".",
            "stopAtEntry": false,
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb",
            "preLaunchTask": "CMake: デバッグ前ビルド",
        }
    ]
}

デバッグ

実行とデバッグから作成した構成を選択して、実行ボタンを押すとデバッグ実行出来ます。

image-8.png

ブレークポイントも機能します。

image-9.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?