Applying winpdb_reborn

Chris Angelico rosuav at gmail.com
Sat May 29 19:25:41 EDT 2021


On Sun, May 30, 2021 at 9:19 AM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 29May2021 09:51, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> >I knew the debugging process with Fortran and C, but haven't learned how to
> >effectively use pdb to find bugs that don't issue a traceback or obvious
> >wrong answer such as my module displaying an empty window with no
> >widgets.
>
> I've only just started with pdb. As of Python 3.7 there's a builtin
> function named breakpoint() which drops you into the debugger. I've
> never been a big debugger person, historicly using print() and
> equivalent.  However, this makes it very easy to insert this call into a
> piece of code instead of having to invoke one's pogramme in a special
> way.
>
> I'd imagine debugging is much like it is in C. Wait for the breakpoint
> to trip, then inspect the programme variables.
>

At its most fundamental level, debugging is the same regardless of the
language: make a bug happen, then see as much as you possibly can
about what caused it. Whether that's dumping print() calls through the
code or using a debug harness, the normal way to figure out what
code's doing is to see what your variables hold at different times.

Using something like gdb, pdb, etc, etc, is just a shorthand for
putting lots and LOTS of print calls into your code. So if you're not
comfortable with those tools, there's no shame in using the more
obvious/simple way of doing things!

(Plus, there's not always an opportunity to use a debug harness.
Sometimes you just have to put your prints into production and let it
run for two weeks in the hope that the bug will show itself.)

ChrisA


More information about the Python-list mailing list