0x01 vscode for c/c++
1、安装
- vscode官方教程:https://code.visualstudio.com/docs/cpp/introvideos-cpp
1、安装msys2 :https://www.msys2.org/
MSYS2是一组工具和库,提供易于使用的环境,用于构建、安装和运行本机 Windows 软件。 它包括一个名为mintty的命令行终端 、bash、git 和 subversion 等版本控制系统、 tar 和 awk 等工具. MSYS2 的主要重点是为本地 Windows 软件提供构建环境,MSYS2 为 GCC、 mingw-w64、CPython、CMake、Meson、OpenSSL、FFmpeg、Rust、Ruby 等提供最新的本机构建。 为了提供简单的软件包安装和保持更新的方式,它提供了一个名为Pacman的软件包管理系统 ,它 带来了许多强大的功能,例如依赖项解析和简单的完整系统升级,以及直接和可复制的包构建。
- 2、vscode配置
编辑c的include path
添加步骤一中安装的C环境的路径
2、调试
{
// 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": "**填写被调试程序的完整路径**",
"args": ["**填写参数**"],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
],
}
0x02 vscode for python
调试celery
有两种方式
方式一:
编辑launch.json
{
"name": "Debug Celery",
"type": "python",
"request": "launch",
"module": "celery",
"args": [
"-A",
"yourapp",
"worker",
"--loglevel=debug"
],
"console": "integratedTerminal"
}
方式二:
附加到进程中
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: 使用进程 ID 进行附加",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": true
}
]
}
调试带图形界面的程序
{
// 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": "Launch Package",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${fileDirname}",
"args":["--chromium-path","/usr/bin/google-chrome","--no-headless","--custom-headers",
"{\"Authorization\":\"xxxxxx\"}",
"--output-json","test.json","--log-level","debug","http://192.168.5.235:80/#/apiScanTask"],
"env":{
"DISPLAY":"192.168.1.89:0.0"
}
}
]
}
vscode调试模块 python -m
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: 当前文件",
"type": "python",
"request": "launch",
"module": "torch.distributed.launch",
"console": "integratedTerminal",
"args": ["--nproc_per_node","2","--use-env","/home/anban/AI/starcoder/finetune/finetune.py","--model_path","/home/anban/AI/starchat-beta","--dataset_name","/home/anban/AI/stack-exchange-instruction","--split","train","--size_valid_set","10","--streaming","--seq_length","2048","--max_steps", "1000", "--batch_size" ,"1", "--input_column_name","question", "--output_column_name","response", "--gradient_accumulation_steps","2", "--learning_rate", "1e-4","--lr_scheduler_type","cosine" ,"--num_warmup_steps","100", "--weight_decay","0.05","--output_dir","./checkpoints" ]
}
]
}
各种问题解决
- https://blog.csdn.net/Key_HMX/article/details/123473192 插件下载不下来怎么办?
- 需要使用sudo:配置文件+ "sudo": true
- vscode离线下载合适版本 https://zhuanlan.zhihu.com/p/598091218
- vscode 指定工作目录: "cwd": "${workspaceFolder}/alpaca-lora"
- 怎么以十六进制形式展示变量
右键Add To Watch
在左侧WATCH列表中修改成variable,h, 那么variable会以16进制显示,如果variable是数组,那么数组里的每个值都是以16进制显示。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。