Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run code whenever a breakpoint is hit in VSCode/Python

Is it possible to execute some code whenever a breakpoint is hit in VS Code (PyDev)?

(specifically, I'd like to print some state whenever I hit a break point, rather than have to type that command manually all the time)

like image 519
Cyberwiz Avatar asked Oct 16 '25 11:10

Cyberwiz


1 Answers

In the debug bar is a Watch View. Here you can define expressions that are evaluated when the debugger returns control to the user (breakpoint or step).

From your comments I learned that you can enter expressions with side effects like print statements. This is similar to log statements only that they print the stuff when the debugger stops.

like image 96
rioV8 Avatar answered Oct 19 '25 01:10

rioV8



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!