Short answer
Debugging is the work of finding why a program's result is not the result the code was supposed to produce. Python's pdb is an interactive debugger: it pauses at a line and lets you print values. The JavaScript debugger statement asks the browser to pause if a debugger is available. Neither tool is the bug. Each one stops the program so you can compare the value you have with the one you expected.
Last verified against the sources listed below.
Key takeaways
- pdb, in the Python 3.15.2 docs, is an interactive source-level debugger with breakpoints and single stepping.
- breakpoint() has been a stand-in for pdb.set_trace() since Python 3.7, when called with defaults.
- The step command stops inside a called function. next stays in the current function.
- MDN's debugger statement pauses if a debugger exists, and does nothing if none is available.
- The ECMAScript 2027 draft says the same: no observable effect when a debugger is not active.
What is debugging? It is the work of closing the gap between the result a program produced and the result the code was meant to produce.
You do that by stopping the program, reading the values at the stop, and comparing them with what you expected. The bug is the mismatch. The debugger is the tool that holds the program still.
Software development is the wider practice this sits inside. What software development is covers that larger job.
What does a debugger let you see?
A debugger pauses execution and shows the line, the stack, and the values, so you can look at the gap instead of guessing it.
Python’s pdb documentation, titled for Python 3.15.2, says the module is an interactive source code debugger. It supports conditional breakpoints, single stepping at the source line, inspection of stack frames, source listing, and evaluation of arbitrary Python code in any frame. It also supports post-mortem debugging and can be called from the program.
The usual insertion is import pdb; pdb.set_trace(), or breakpoint(). You put that at the line you care about and run the program.
The prompt (Pdb) means you are in the debugger. p prints a value.
continue runs on without stopping until a breakpoint.
Changed in version 3.7: breakpoint(), called with defaults, can replace import pdb; pdb.set_trace(). Changed in version 3.13: set_trace() enters the debugger immediately, rather than on the next line.
The page’s double example is the concrete case. val is 3, breakpoint() sits inside double, p x prints 3, and continue leads to the line 3 * 2 is 6.
What is one pdb step in Python?
The step command runs the current line and stops at the first chance, including inside a function that line calls.
The debugger commands section defines s(tep) as: execute the current line, stop at the first possible occasion, either in a function that is called or on the next line in the current function. n(ext) continues until the next line in the current function, or until that function returns.
The page states the difference directly: step stops inside a called function, while next executes called functions at nearly full speed and only stops at the next line in the current function.
c(ontinue) resumes and stops only at a breakpoint. r(eturn) runs until the current function returns. Those four are enough to move through a small function without adding prints.
A crash is the other entrance. The page’s example defines f as print(1 / x), calls f(0), and gets ZeroDivisionError.
pdb.pm() then stops in f, and p x prints 0. You are on the frame that failed, looking at the value that failed.
The overview calls that post-mortem debugging.
You can also start from the shell with python -m pdb and a script. The page says that, as a module, pdb enters post-mortem debugging if the program exits abnormally, then restarts.
The -p option, added in Python 3.14, attaches to a process id. Attaching waits until the next bytecode instruction if the process is blocked in a system call.
What does the browser pause on?
The debugger statement pauses if a debugger is available, and it does nothing if none is.
MDN says the statement invokes any available debugging functionality, such as setting a breakpoint. If none is available, the statement has no effect.
The page says this has been available across browsers since July 2015. Its example puts debugger; inside a function.
When a debugger is invoked, execution pauses at that statement, like a breakpoint in the script.
The ECMAScript 2027 draft, dated 24 November 2026, specifies the same shape. The syntax is debugger;.
If an implementation-defined debugging facility is available and enabled, the runtime performs an implementation-defined debugging action. The note says this may cause a breakpoint when run under a debugger.
If a debugger is not present or active, there is no observable effect.
Chrome DevTools tells you how to set the pause without editing the file. Open the Sources panel, open the file, and click the line number.
A line-of-code breakpoint pauses before that line runs. The same guide says calling debugger from your code is equivalent, except the pause is written in the source.
A conditional breakpoint is a right-click on the line number, then Add conditional breakpoint, and it pauses only when the condition is true.
| Tool | Where it is documented | What you do | If nothing is listening |
|---|---|---|---|
breakpoint() or pdb.set_trace() |
Python pdb docs, 3.15.2 | Run, then use p, step, next, or continue at (Pdb) |
The program stops in pdb anyway, because you called it |
debugger; |
MDN and ECMAScript 2027 | Open a browser debugger, then run the function | No observable effect |
| Click a line number | Chrome DevTools | Sources panel, click the line | No pause until DevTools is set to pause there |
The Python call always enters pdb, because that is the function you ran. The JavaScript statement only helps when a debugger is attached.
That difference is in the docs. It is not a matter of taste.
How do you use the pause?
Decide what the line should have produced, stop there, and read the value that disagrees.
A short loop, still using only the commands the pdb page names:
- Put
breakpoint()on the line before the suspicious return, which the 3.7 note allows in place ofset_trace(). - Run the program and wait for
(Pdb). pthe variable you think is wrong, as thedoubleexample printsx.stepif you need to enter a call, ornextif that call is not the suspect.continuewhen the value matches what you expected, or when you have seen the bad one.
The same habit works in the browser. Set the debugger statement or click the line, reload, and read the local value in DevTools. If the statement seems to do nothing, MDN’s condition applies: no debugging functionality is available.
Debugging is not a paradigm. What a programming paradigm is is a separate question about how code is organized.
pdb and the debugger statement do not ask you to pick one. They ask you to stop and look.
An image compressor does not do this job. It shrinks a picture in the browser. A wrong pixel size can be a bug in the program that wrote the file, and you would still find that bug by pausing the program, not by compressing the output again.
Frequently asked questions
What is debugging in Python?
In Python, debugging with pdb means pausing so you can inspect the stack and the values at a line. The docs say to insert import pdb and pdb.set_trace(), or breakpoint(), then run. At the (Pdb) prompt, p prints a value and continue resumes. The step command runs the current line and stops at the first chance, inside a called function or on the next line. next does not stop inside the call.
What does the pdb example with double() show?
The Python 3.15.2 pdb page shows a function double that calls breakpoint and returns x times 2. The caller sets val to 3 and prints the result of double(val). At the prompt, p x prints 3. continue then finishes, and the page shows the output 3 * 2 is 6. The pause is the debugging step. The arithmetic is ordinary Python. The example is there to show the prompt and the p command, not to measure how long debugging takes.
How do you inspect a crash after it happens?
pdb.post_mortem, and the pm helper in the page's crash example, enter the debugger on an exception that has already been raised. The page's example calls f(0), which divides 1 by x and raises ZeroDivisionError. After the traceback, pdb.pm() stops in f, and p x prints 0. You are looking at the value that caused the exception, on the frame where it happened. That is post-mortem debugging, which the module overview lists alongside breakpoints and single stepping.
What does the JavaScript debugger statement do if no debugger is open?
MDN says the debugger statement invokes any available debugging functionality, such as setting a breakpoint, and that it has no effect if none is available. The ECMAScript 2027 draft, dated 24 November 2026, says the same: no observable effect when a debugger is not present or active. Chrome's DevTools docs say a debugger statement is like a line-of-code breakpoint, except you write it in the file instead of clicking a line number.
Is debugging the same thing as a programming paradigm?
No. A paradigm is a way of structuring programs. Debugging is what you do when a run does not match the intent, whichever paradigm the program uses. pdb works on ordinary Python functions in the examples on its page. The debugger statement works inside a JavaScript function. Neither page says you must adopt a particular paradigm before you can pause. You need a place to stop, a value to read, and a result you can compare with what you meant.
Sources
- pdb: The Python Debugger · Python, 2026
- debugger statement · MDN, 2026
- Pause your code with breakpoints · Chrome for Developers, 2026
- ECMAScript 2027, the debugger statement · TC39, 2026