Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /main /. /docs /vscode_python.md
blob: 47c973bf8f6e82b52f80964ac8e0021a0c73d9f7 [file] [log] [blame] [view]
Ryan Heise9a711432020-10-14 23:55:39[diff] [blame]1# Debugging Chromium Python With The VSCode Debugger
2
3## Before You Begin
4
51.Patchin[this CL](https://chromium-review.googlesource.com/c/chromium/src/+/2466896).
62.Run gclient sync.
7
8## Via SSH
9
10SSHis usefulif youre modifyingand debugging code on another device, suchas
11the desktop sitting at your office desk.Todo so:
12
131.Set upVSCode to workwith normal developmentby following the instructions
14in theRemoteVisualStudioCode section
15[here](https://docs.google.com/document/d/1ZlG8VQxudxvDs-EtpQvaPVcAPfSMdYlXr42s_487wLo/edit#bookmark=id.j10hyv6nlkws).
162.Open theConnectionDialog ofChromes SSH plugin:![open
17 dialog](images/vscode_python_connection_dialog.png)
183.Create anew connectionandset the username, hostname, port,and SSH relay
19 server optionsas you normally would.Then,set SSH arguments to"-2 -L
20 50371:localhost:50371"
21
22 a.You can replace50371with a different value, solongas it's consistent
23 with step 7b.
24
254. Open a connection, and set this window aside.
265. In VSCode, open the code you want to set a breakpoint in, and add the
27 following:
28
29```
30import debugpy
31
32# Your code here!
33debugpy.listen(50371)
34print("Wait for attach...")
35debugpy.wait_for_attach()
36debugpy.brerakpoint()
37```
38
39Note: The port passed to debugpy.listen() should match the port configured in (3).
40
416. Click on the Debug tab
427. Click Run. A dialog will appear asking you to set up a debug configuration.
43 Do so, and select “Remote Debug”.
44
45 a. Leave the hostname as-is
46
47 b. Set the port to 50371
48
498. Run your program on the remote machine. It should stop executing at “Wait for
50 attach”.
519. Start the debugger in VSCode. It should attach!
52
53## Locally
54
Ryan Heise7e36b152020-10-16 16:55:33[diff] [blame]55Follow the same steps as above, but start from step 5.

[8]ページ先頭

©2009-2025 Movatter.jp