• Ros+vscode debug


     1.在我们的ROS工作空间目录打开vscode:

    code .

    2.输出编译命令文件:

    catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes

    3.生成c_cpp_properties.json

    {
        "configurations": [
            {
                "name": "Linux",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [],
                "compilerPath": "/usr/bin/gcc",
                "cStandard": "c11",
                "cppStandard": "c++17",
                "intelliSenseMode": "clang-x64",
                "compileCommands": "${workspaceFolder}/build/compile_commands.json"//上面的编译文件
            }
        ],
    
        "version": 4
    }

    4.生成task.json文件,设置catkin_make

    {
        "version": "2.0.0",
        "tasks": [
            {
                "label": "catkin_make", //代表提示的描述性信息
                "type": "shell",  //可以选择shell或者process,如果是shell代码是在shell里面运行一个命令,如果是process代表作为一个进程来运行
                "command": "catkin_make",//这个是我们需要运行的命令
                "args": [],//如果需要在命令后面加一些后缀,可以写在这里,比如-DCATKIN_WHITELIST_PACKAGES=“pac1;pac2”
                "group": {"kind":"build","isDefault":true},
                "presentation": {
                    "reveal": "always"//可选always或者silence,代表是否输出信息
                },
                "problemMatcher": "$msCompile"
            },
        ]
    }

    5.GDB debug的配置,配置launch.json文件

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(gdb) Launch", // 配置名称,将会在调试配置下拉列表中显示
                "type": "cppdbg",  // 调试器类型 该值自动生成
                "request": "launch",  // 调试方式,还可以选择attach
                "program": "${workspaceRoot}/devel/lib/waypoint_follower/pure_persuit", //要调试的程序(完整路径,支持相对路径)
                "args": [],  // 传递给上面程序的参数,没有参数留空即可
                "stopAtEntry": false,  // 是否停在程序入口点(停在main函数开始)
                "cwd": "${workspaceRoot}",  // 调试程序时的工作目录
                "environment": [], //针对调试的程序,要添加到环境中的环境变量. 例如: [ { "name": "squid", "value": "clam" } ]
                "externalConsole": false,   //如果设置为true,则为应用程序启动外部控制台。 如果为false,则不会启动控制台,并使用VS Code的内置调试控制台。
                "MIMode": "gdb",  // VSCode要使用的调试工具
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ]
            }
        ]
    }

    6.问题

    6.1 poll failed with error Interrupted system call

     

    GDB 多线程 (non-stop)

    1. 背景

        这几天在扩展 ngx_lua 模块,但 gdb 定位时,提示:Thread debugging using libthread_db enabled。poll failed with error Interrupted system call。

    2. GDB non-stop 配置

        把以下3行添加到 ~/.gdbinit 来打开 non-stop 模式

    set target-async 1
    set pagination off
    set non-stop on

        PS:无 ~/.gdbinit 文件,可以创建此文件,或修改 /etc/gdb 下对应文件

    3. 文件更新立即生效

    source ~/.gdbinit


    https://www.w3cschool.cn/notebook/notebook-ky9l2mtk.html



  • 相关阅读:
    ObjectC----NSObject常用方法和OC反射机制
    自定义 URL Scheme 完全指南
    一文让你彻底了解iOS字体相关知识
    Objective-C Category 的实现原理[转]
    Objective-C Autorelease Pool 的实现原理[转]
    eclipse无法连接到makertplace
    logstash日志分析的配置和使用
    在CentOS或RHEL防火墙上开启端口
    redhat7下配置tomcat7,更改端口8080后无法访问页面
    Uiautomatorviewer报错:Unexpected error while obtaining UI hierarchy java.lang.reflect.InvocationTargetException
  • 原文地址:https://www.cnblogs.com/yrm1160029237/p/12568621.html
Copyright © 2020-2023  润新知