You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/TRACEBACKS.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -190,7 +190,8 @@ Reducing bytecode is one way to make the code run faster.
190
190
191
191
## Python Debugger
192
192
193
-
Python has a built in debugger, [pdb][pdb]. It can be used to step through code and inspect variables. You can also set breakpoints with it.
193
+
Python has a built in debugger, [pdb][pdb].
194
+
It can be used to step through code and inspect variables. You can also set breakpoints with it.
194
195
To get started you have to first import pdb and then call pdb.set_trace() where you want to start debugging.
195
196
196
197
```python
@@ -204,8 +205,13 @@ sum = add(1,5)
204
205
print(sum)
205
206
```
206
207
207
-
Running this code will give you a prompt where you can type in commands. Write `help` to get a list of commands.
208
-
The most common onces are `step` which steps into a function called at that line. `next` which steps over a function call and move to the next line. `where` which tells you which line you are on. Some other usefull commands are `whatis <variable>` which tells you the type of a variable and `print(<variable>)` which prints the value of a variable. You can also just use `<variable>` to print the value of a variable. Another command is `jump <line number>` which jumps to a specific line number.
208
+
Running this code will give you a prompt where you can type in commands.
209
+
Write `help` to get a list of commands.
210
+
The most common onces are `step` which steps into a function called at that line.
211
+
`next` which steps over a function call and move to the next line. `where` which tells you which line you are on.
212
+
Some other usefull commands are `whatis <variable>` which tells you the type of a variable and `print(<variable>)` which prints the value of a variable.
213
+
You can also just use `<variable>` to print the value of a variable.
214
+
Another command is `jump <line number>` which jumps to a specific line number.
209
215
210
216
Here are an example on how to use the debugger based on the code earlier:
211
217
@@ -232,7 +238,12 @@ Here are an example on how to use the debugger based on the code earlier:
232
238
... (Pdb)
233
239
```
234
240
235
-
Breakpoints is setup by `break <filename>:<line number> <condition>` where condition is an optional condition that has to be true for the breakpoint to be hit. You can simply write `break` to get a list of the breakpoints you have set. To disable a breakpoint you can write `disable <breakpoint number>`. To enable a breakpoint you can write `enable <breakpoint number>`. To delete a breakpoint you can write `clear <breakpoint number>`. To continue execution you can write `continue` or `c`. To exit the debugger you can write `quit` or `q`.
241
+
Breakpoints is setup by `break <filename>:<line number> <condition>` where condition is an optional condition that has to be true for the breakpoint to be hit.
242
+
You can simply write `break` to get a list of the breakpoints you have set.
243
+
To disable a breakpoint you can write `disable <breakpoint number>`.
244
+
To enable a breakpoint you can write `enable <breakpoint number>`.
245
+
To delete a breakpoint you can write `clear <breakpoint number>`.
246
+
To continue execution you can write `continue` or `c`. To exit the debugger you can write `quit` or `q`.
236
247
237
248
Here are an example on how to use the debugger based on the code earlier:
0 commit comments