K
K
ks_ks2012-06-25 13:02:26
Python
ks_ks, 2012-06-25 13:02:26

Smart pdb_trace() - how to put a breakpoint on a specific iteration?

The program prints the entire log to stdout during operation.
Now, for debugging I use:
"c" => "ENTER", "c" => "ENTER", "c" => "ENTER", "c" => "ENTER", "c" => "ENTER"
It is required to implement the same thing on the machine, with two of the following options described in the questions:
1. a break point, which will indicate which of these iterations should be installed - then the question is how to set one?
2. how to set a condition to stop the execution of the code, by the occurrence of a certain text (the text of the error is familiar to me and occurs once, exactly at this moment and you need to stop)?
PS> And another small question - how to rewind/forward a few steps (or one step), next'ov and continue'ov?
PPS> 2 options that indicated - are these the only solutions, or are there others that are easier to implement?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MikhailEdoshin, 2012-06-25
@ks_ks

You can just press Enter - it repeats the last command entered. It is also convenient to use n[ext]- it executes commands without entering the called functions, or unt[il]- executes commands until it turns out to be a line below (i.e. if you say in the last line of the cycle until, it will skip the entire cycle and stop at the next command. To put conditional breakpoint, you need to say b[reak] ([file:]lineno | function)[, condition], for example, break 42, a = 5The command to jump to the desired line is j[ump]... I won’t say about catching a typical error - I don’t use it like that. But in general there is such a thing - for example, you can wrap the program call in your own try/except, catch the error, see its text, and if it matches, start the debugger (I don’t remember how to start it from the code here) to see the call stack (w[here]).
By the way, it gives you an error, but traceback does not print, or what?
See also the module manual and internal help ( h[elp]).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question