vscode 调试srs 源码

@[TOC](vscode 调试srs 源码),调试其它项目也差不多

源码下载

https://github.com/ossrs/srs/tree/develop

进入struct 目录中编译debug 调试

./configure --static=on --extra-flags="-c -g" 
make -j4

vscode 配置

vscode c++环境配置不介绍,添加struct 添加 ./vscode,包含如下文件:
1、c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64"
        }
    ],
    "version": 4
}

2、launch.json
{

    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/objs/srs",      //可执行文件的完整路径,文件名与 build.json 中生成的可执行文件名保持一致
            "args": ["-c", "conf/srs.conf"],
            "stopAtEntry": false,           //是否在 main 函数处暂定执行
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,        //在打开外部终端执行程序,而不是在 VSCode 的控制台中运行
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

3、launch.json

{
    "files.associations": {
        "facexsdk.h": "c",
        "mutex": "cpp",
        "image_tools.h": "c",
        "hi_facev2_detector.h": "c",
        "hi_face_detector.h": "c",
        "hi_face_tracker.h": "c",
        "hi_face_comm.h": "c",
        "bitset": "cpp",
        "chrono": "cpp",
        "algorithm": "cpp",
        "hi_livecl_detector.h": "c",
        "hisvp_def.h": "c",
        "hi_quality_detector.h": "c",
        "hi_livewb_detector.h": "c",
        "array": "c",
        "initializer_list": "c",
        "utility": "c",
        "hi_livecldt_com.h": "c",
        "hi_math.h": "c",
        "fxcommon.h": "c",
        "fximgtool.h": "c",
        "pack_tools.h": "c",
        "hi_facedt_com.h": "c",
        "hi_yolov3_obj_detector.h": "c",
        "hi_face_ext_com.h": "c",
        "hi_face_extractor.h": "c",
        "datamanagerinterface.h": "c",
        "app_main.h": "c",
        "app_atask_def.h": "c",
        "pthread.h": "c",
        "random": "c",
        "hi_property_detector.h": "c",
        "cctype": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "atomic": "cpp",
        "strstream": "cpp",
        "*.tcc": "cpp",
        "complex": "cpp",
        "cstdint": "cpp",
        "deque": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "fstream": "cpp",
        "functional": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "numeric": "cpp",
        "ratio": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "system_error": "cpp",
        "thread": "cpp",
        "cfenv": "cpp",
        "cinttypes": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "memory": "cpp",
        "signal.h": "c",
        "string": "cpp",
        "fxerrorno.h": "c",
        "fxtypes.h": "c",
        "fxmacros.h": "c",
        "csignal": "cpp",
        "hash_map": "cpp",
        "hash_set": "cpp",
        "forward_list": "cpp",
        "*.ipp": "cpp",
        "hi35xx.h": "c",
        "mpi_nnie.h": "c",
        "hi_nnie.h": "c",
        "hi_mask_detector.h": "c",
        "recordsaveinterface.h": "c",
        "pixelchiplicinterface.h": "c",
        "grghumansdk.h": "c",
        "hi_objpose_detector.h": "c",
        "*.inc": "cpp",
        "condition_variable": "cpp",
        "future": "cpp",
        "valarray": "cpp",
        "semaphore.h": "c",
        "hi_objdt_com.h": "c",
        "hi_type.h": "c",
        "mpi_vb.h": "c",
        "hi_mipi.h": "c",
        "mpi_sys.h": "c",
        "regex": "cpp",
        "types.h": "c",
        "msgqueue.h": "c",
        "fx-queue-msg-def.h": "c",
        "pxgoactionsinterface.hpp": "c",
        "csetjmp": "cpp",
        "unordered_set": "cpp",
        "optional": "cpp",
        "string_view": "cpp",
        "slist": "cpp",
        "scoped_allocator": "cpp",
        "shared_mutex": "cpp",
        "codecvt": "cpp",
        "any": "cpp",
        "filesystem": "cpp",
        "mbedtls.h": "c",
        "ioctl.h": "c",
        "if.h": "c",
        "cerrno": "cpp",
        "app_mq_common.h": "c",
        "app_msgqueue.h": "c",
        "errno.h": "c",
        "app_ntp.hpp": "c",
        "app_common.h": "c",
        "fx-mvspaa.h": "c",
        "shm.h": "c",
        "app_media.h": "c",
        "hi_buffer.h": "c",
        "pxgoactionsinterface.h": "c",
        "fxconfig.h": "c",
        "hi_common.h": "c",
        "dir.h": "c",
        "dirent.h": "c",
        "features.h": "c",
        "app_ntp_def.hpp": "c",
        "app_deviceinfo_def.hpp": "c",
        "app_dhcp_def.hpp": "c",
        "sample_common.h": "c",
        "stdint.h": "c",
        "rtsp_msg.h": "c",
        "md5.h": "c",
        "rtsplib.h": "c",
        "rtsp_main_service.h": "c",
        "fxmediacommon.h": "c",
        "elog.h": "c",
        "comm.h": "c"
    }
}

4、launch.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello"
        }
    ]
}

修改配置关闭台运行

strunk/conf/srs.conf 设置
daemon off; # 是否后台运行, on后台运行

调试

使用vscode 打开strunk 工作文件夹
在需要打断点的地方F9
F5运行
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值