Skip to content

Commit bac4d3d

Browse files
meatball133BethanyG
authored andcommitted
Update TRACEBACKS.md
1 parent 4374b84 commit bac4d3d

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

docs/TRACEBACKS.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ Reducing bytecode is one way to make the code run faster.
190190

191191
## Python Debugger
192192

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.
194195
To get started you have to first import pdb and then call pdb.set_trace() where you want to start debugging.
195196

196197
```python
@@ -204,8 +205,13 @@ sum = add(1,5)
204205
print(sum)
205206
```
206207

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.
209215

210216
Here are an example on how to use the debugger based on the code earlier:
211217

@@ -232,7 +238,12 @@ Here are an example on how to use the debugger based on the code earlier:
232238
... (Pdb)
233239
```
234240

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`.
236247

237248
Here are an example on how to use the debugger based on the code earlier:
238249

@@ -288,7 +299,7 @@ print(sum)
288299
```
289300

290301
[assert]: https://realpython.com/python-assert-statement/
291-
[AssertionError]: https://www.geeksforgeeks.org/python-assertion-error/
302+
[assertionerror]: https://www.geeksforgeeks.org/python-assertion-error/
292303
[floor divison operator]: https://www.codingem.com/python-floor-division
293304
[logging]: https://docs.python.org/3/howto/logging.html
294305
[print]: https://www.w3schools.com/python/ref_func_print.asp

0 commit comments

Comments
 (0)