vscode python调试指定进程_使用 VSCode 进行主进程调试

本文指导如何在VSCode中调试Electron应用的主进程。首先克隆Electron快速启动项目,然后创建并配置launch.json文件,指定运行参数。通过设置断点并启动调试,可以在VSCode中捕获主进程的调试信息。
摘要由CSDN通过智能技术生成

1.在 VSCode 中打开一个 Electron 项目。

$ git clone git@github.com:electron/electron-quick-start.git

$ code electron-quick-start

1. Open an Electron project in VSCode.

$ git clone git@github.com:electron/electron-quick-start.git

$ code electron-quick-start

2.添加一个 .vscode/launch.json 文件并使用以下配置:

{

"version": "0.2.0",

"configurations": [

{"name": "Debug Main Process","type": "node","request": "launch","cwd": "${workspaceRoot}","runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron","windows": { "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"},"args" : ["."],"outputCapture": "std"

}

]

}

2. Add a file .vscode/launch.json with the following configuration:

{

"version": "0.2.0",

"configurations": [

{"name": "Debug Main Process","type": "node","request": "launch","cwd": "${workspaceRoot}","runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron","windows": { "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd"},"args" : ["."],"outputCapture": "std"

}

]

}

3. 调试

在 main.js中设置一些断点,并在 Debug 视图 中开始调试。你应该能够捕获断点信息。

这是一个预先配置的项目,你可以下载并直接在 VSCode中调试: https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start

3. Debugging

Set some breakpoints in main.js, and start debugging in the Debug View. You should be able to hit the breakpoints.

Here is a pre-configured project that you can download and directly debug in VSCode: https://github.com/octref/vscode-electron-debug/tree/master/electron-quick-start

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值