Posts with tag debug

python-debug

2024-01-23
debugpythonsoftwares-and-toolsvscode

This method is verified!https://code.visualstudio.com/docs/python/debugginghttps://stackoverflow.com/questions/51244223/visual-studio-code-how-debug-python-script-with-arguments开始vscode cmd: show run and debug.click 'create launch.json'A file is created.If you wanna run shell script for python like this:CUDA_VISIBLE_DEVICES=0 python cloth_funnels/run_sim.py \ name="demo-single" \ load=models/longsleeve_canonicalized_alignment.pth \ eval_tasks=assets/tasks/longsleeve-single.hdf5 \ eval=True \ num_processes=1 \ episode_length=10 \ wandb=disabled \ fold_finish=True \ dump_visualizations=True Add args like, [tested ok]:{ // 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": "Python: 当前文件", "type": "python", "request": "launch", "program": "${file}", // "program": "${workspaceFolder}/script/eval_policy.py", // 这样也行 "console": "integratedTerminal", "args": ["name=\"demo-single\"", "load=models/longsleeve_canonicalized_alignment.pth", "eval_tasks=assets/tasks/longsleeve-single.hdf5", "eval=True", "num_processes=1", "episode_length=10", "wandb=disabled", "fold_finish=True", "dump_visualizations=True"], "env": { "CUDA_VISIBLE_DEVICES": "0", "HYDRA_FULL_ERROR": "1", }, } ] }Switch to the file you want to run (as in launch.json we by default designate "Run current file", so you have to switch to the exact file to run).Add a breakpoint,Click the green delta in "Run python and debug" menu,Everything is well! And watch params in the menu!RemoteUsing vscode-ssh is also ok to run python debug in remote machine

c-cmake-debug

2024-01-15
debugsoftwares-and-toolsvscode

原理是这样的,你编译出来的可执行文件只要是编译的时候开了 Debug 的时候,是可以直接调试的。所以你在 cmakelists.txt 加上:set(CMAKE_BUILD_TYPE "Debug")然后去 cmake + make 一下。现在,用 vscode 命令面板唤出 debug 面板。面板里有一个链接让你创建 launch.json。你点击会让你选择调试环境,你选 LLDB 他生成一个 json,然后这个 json 内容改成这样:{ "version": "0.2.0", "configurations": [ { "type": "lldb", "request": "launch", "name": "Debug", "program": "${workspaceFolder}/build/demo", "args": [], "cwd": "${workspaceFolder}" } ] }这边 "program" 条目你改成要执行的文件。没错直接可执行文件就行了。现在在源文件里面加一个断点,然后捏点击 debug 面板上方的播放按钮。他就会停在断点了。还会出现一个小长条工具栏,用来到下一行、跳转行等。一般你用 F10 逐过程,避免进入每个函数。如果你要输入数据,就在面板的“终端”里面输入。Problem点击创建 launch.json 的时候可能会卡。这可能是因为某些其他语言的 vscode debugger 在试图更新自己的配置。建议手动创建 launch.json 或者等一等就会有

No more posts to load.