Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subsequent "list" commands in ipdb

I just noticed an odd behavior when using l (i.e. the list command) in ipdb. I think I have seen something similar with the Perl debugger in the past, but it still puzzles me.

The first time I inoke it shows corerectly ~10 lines of code around the current step (breakpoint). However, if I press it repeatedly, it does not show code around the current location anymore, but instead it shows code that comes below it.

Eventually list shows the final lines of the script, and if I press l again it doesn't show anything anymore.

Why is this, and how can I have it behave consistently as the first time I invoke it?

like image 233
Amelio Vazquez-Reina Avatar asked Jun 17 '13 00:06

Amelio Vazquez-Reina


People also ask

What is the difference between IPDB and pdb?

ipdb is an enhanced version of pdb (built-in). It supports all pdb commands and is simply easier to use like tab for auto-complete. ipdb command cheatsheet.

How do you get out of a loop in pdb?

Once you get you pdb prompt . Just hit n (next) 10 times to exit the loop.

How do you set a breakpoint in pdb?

Optionally, you can also tell pdb to break only when a certain condition is true. Use the command b (break) to set a breakpoint. You can specify a line number or a function name where execution is stopped. If filename: is not specified before the line number lineno , then the current source file is used.


1 Answers

Many command line debuggers behave that way. (pdb, gdb, ipdb ...).

If you want display current line again, specify the line number.

l 42

If you don't know the current line number, issue where command.

like image 92
falsetru Avatar answered Sep 27 '22 22:09

falsetru