关于vscode调试的配置问题

  • nebula 版本:v3.3.0
  • 部署方式:单机
  • 安装方式:源码编译

launch.json配置如下:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach nebula-graphd",
            "request": "attach",
            "type": "cppdbg",
            "processId": "${command:pickProcess}",
            "program": "/usr/local/nebula/bin/nebula-graphd",
            "linux": {
                "MIMode": "gdb",
                "miDebuggerPath": "/usr/bin/gdb",
                "setupCommands": [{
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }]
            }
        }
    ]
}

编译命令如下:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DCMAKE_BUILD_TYPE=Debug …
make -j{N} # E.g., make -j2
sudo make install

在使用vscode调试的时候一直有如下错误,不知道是为什么:

我看官方给的教程只有gdb的,但是我想更方便的调试。参考了nebula gdb调试 - #2,来自 wey 这个问题中的回答,但是会报出上述的错误

报错说 binary 格式不对,是不是得 Debug 去build的才行

是按照Debug编译的,提问的时候忘记改过来了

file /usr/local/nebula/bin/nebula-graphd"
ll /usr/local/nebula/bin/nebula-graphd"

file /usr/local/nebula/bin/nebula-graphd
/usr/local/nebula/bin/nebula-graphd: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4a741287e5b0dc9f3515523ba65f592ef79a2864, for GNU/Linux 3.10.0, with debug_info, not stripped
从返回信息来看确实是包含了debug信息的

改成不自动 pick process id 试试呢?我看起来都对了已经,再就是手动用 gdb attach 能复现报错么?

刚才试了下,手动gdb attach似乎没有问题:

啊,能不能 debug 一下插件,看看 vscode gbd 这里的 attach command line 是啥?

另外,我感觉其实用 gbd-dashboard 在 cli 里也挺不错的,参考 https://www.siwei.io/nebulagraph-hacking-guide/#调试-nebulagraph 的安装配置

感谢,解决了,gdb的路径设置错了"miDebuggerPath": “/opt/rh/gcc-toolset-11/root/usr/bin/gdb”

1 个赞

顺便问一下我想调试学习一下nebulagraph解析执行一个query的整个流程,在哪些函数打断点比较好?

@Milittle 总结的不错 读 NebulaGraph源码 | 查询语句 LOOKUP 的一生

我之前是看着源码解读找入口往下看 && 加断点追的

系列文章在:NebulaGraph 源码解读系列 | Vol.00 序言

好的感谢

此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。