Breakpoint Skip Time

0 views
Skip to first unread message

Lynne Pruskowski

unread,
Aug 5, 2024, 2:43:21 AM8/5/24
to parwegentleb
Iam trying to find an error in my code. The problem is the error occurs in a loop. But the loop iterates about 500 times. Instead of clicking through the loop. Is it possible to skip over a certain amount of the loop ??

You can assign new values to variables during debug session. Step through the loop statements as many times as you like, then set your loop counter (or whatever other vars maintain loop condition) to terminate the loop.


By pressing F5 it'll continue running till it gets to the next breakpoint (the next pass through the code). Sure you'll have to hit it 500 times, but that beats some thousands of times. Combine this with @Troubador code above.


continue [ignore-count]

c [ignore-count]

fg [ignore-count]

Resume program execution, at the address where your program last stopped; any breakpoints set at that address are bypassed. The optional argument ignore-count allows you to specify a further number of times to ignore a breakpoint at this location; its effect is like that of ignore (see section Break conditions). The argument ignore-count is meaningful only when your program stopped due to a breakpoint. At other times, the argument to continue is ignored.


Breakpoints are a way of telling gdb that you want it to stopyour program at certain lines of code. You can also have it stop whenyour program makes specific function calls. Once the program is stopped,you can poke around in memory and see what the values of all yourvariables are, examine the stack, and step through your program's execution.


set a breakpoint on a line? set a breakpoint on a C function? set a breakpoint on a C++ function? set a temporary breakpoint? get a list of breakpoints? disable breakpoints? skip breakpoints?


Setting a breakpoint on a C++ function is similar to setting a breakpointon a C function. However C++ is polymorphic, so you must tell break whichversion of the function you want to break on (even if there is only one).To do this, you tell it the list of argument types.


Use the disable command. Pass the number of the breakpoint you wish todisable as an argument to this command. You can find the breakpoint numberin the list of breakpoints, as shown above. In the example below we cansee that breakpoint number 2 has been disabled (there is an 'n' underthe Enb column).


I've been debugging my custom boards no problem, for years, including setting at stopping at breakpoints. All of a sudden this morning, the debugger no longer stops at breakpoints. I am not aware of anything changing. I power cycled the target board, the ST-LINK/V2, and my host computer, but the problem remains. I recompiled the whole program (Rebuild), but the problem remains.


Please see the image below. Notice how the icons to the right of the checkboxes appear to have a slash through them. THIS IS NEW! I've never seen it before and I don't know what it means. The same slash appears through the breakpoint icon whenever I set (toggle on) a breakpoint from the source code, whether I'm currently debugging or not. If I knew what this slash meant, it might help me figure out what has gone wrong. I haven't been able to find any doc on it. Of course, I figure the sudden appearance of the slash through the breakpoint icons is correlated with the sudden fact that the debugger no longer stops at breakpoints.


OMGMF! I've never seen that in a debug GUI. So this GUI has *both* "disable" breakpoints and "skip" breakpoints. Weird. I figured it was something stupid. I found the "skip all breakpoints" icon and unclicked it. It must have gotten hit by mistake.


You're working on your app and you want to see if your changes look good. You run your app on the Simulator and you're presented with a login screen. You type in your testing credentials and navigate to the screen you want to see. It doesn't look quite good. Repeat the process.


I'm using a sample login screen with two TextFields presented as a full screen modal. When the app launches with an initiateLogin() it dismisses the modal screen if text fields contain correct credentials.


In the first action, add expr _username.wrappedValue = "[USERNAME]". In the second one, add expr _password.wrappedValue = "[PASSWORD]". Change the username and password strings to match your login credentials.


It's likely you'll use the same credentials when working on something in your app, so this saves you a lot of typing time. If you need to use different credentials and you know you'll have to type them in multiple times, just change their values in the breakpoint.


You want the login to trigger when the view appears so you don't have to tap any buttons. The login will complete and you'll be automatically logged in. Create a breakpoint in the viewWillAppear() for UIKit app or .onAppear() for SwiftUI app of your login view.


The module pdb defines an interactive source code debugger for Pythonprograms. It supports setting (conditional) breakpoints and single stepping atthe source line level, inspection of stack frames, source code listing, andevaluation of arbitrary Python code in the context of any stack frame. It alsosupports post-mortem debugging and can be called under program control.


at the location you want to break into the debugger, and then run the program.You can then step through the code following this statement, and continuerunning without the debugger using the continue command.


Execute the statement (given as a string or a code object) under debuggercontrol. The debugger prompt appears before any code is executed; you canset breakpoints and type continue, or you can step through thestatement using step or next (all these commands areexplained below). The optional globals and locals arguments specify theenvironment in which the code is executed; by default the dictionary of themodule __main__ is used. (See the explanation of the built-inexec() or eval() functions.)


Call the function (a function or method object, not a string) with thegiven arguments. When runcall() returns, it returns whatever thefunction call returned. The debugger prompt appears as soon as the functionis entered.


Enter the debugger at the calling stack frame. This is useful to hard-codea breakpoint at a given point in a program, even if the code is nototherwise being debugged (e.g. when an assertion fails). If given,header is printed to the console just before debugging begins.


Enter post-mortem debugging of the given traceback object. If notraceback is given, it uses the one of the exception that is currentlybeing handled (an exception must be being handled if the default is to beused).


By default, Pdb sets a handler for the SIGINT signal (which is sent when theuser presses Ctrl-C on the console) when you give a continue command.This allows you to break into the debugger again by pressing Ctrl-C. If youwant Pdb not to touch the SIGINT handler, set nosigint to true.


The commands recognized by the debugger are listed below. Most commands can beabbreviated to one or two letters as indicated; e.g. h(elp) means thateither h or help can be used to enter the help command (but not heor hel, nor H or Help or HELP). Arguments to commands must beseparated by whitespace (spaces or tabs). Optional arguments are enclosed insquare brackets ([]) in the command syntax; the square brackets must not betyped. Alternatives in the command syntax are separated by a vertical bar().


Multiple commands may be entered on a single line, separated by ;;. (Asingle ; is not used as it is the separator for multiple commands in a linethat is passed to the Python parser.) No intelligence is applied to separatingthe commands; the input is split at the first ;; pair, even if it is in themiddle of a quoted string. A workaround for strings with double semicolonsis to use implicit string concatenation ';'';' or ";"";".


Without argument, print the list of available commands. With a command asargument, print help about that command. help pdb displays the fulldocumentation (the docstring of the pdb module). Since the commandargument must be an identifier, help exec must be entered to get help onthe ! command.


With a filename:lineno argument, clear all the breakpoints at this line.With a space separated list of breakpoint numbers, clear those breakpoints.Without argument, clear all breaks (but first ask confirmation).


Disable the breakpoints given as a space separated list of breakpointnumbers. Disabling a breakpoint means it cannot cause the program to stopexecution, but unlike clearing a breakpoint, it remains in the list ofbreakpoints and can be (re-)enabled.


Set the ignore count for the given breakpoint number. If count is omitted,the ignore count is set to 0. A breakpoint becomes active when the ignorecount is zero. When non-zero, the count is decremented each time thebreakpoint is reached and the breakpoint is not disabled and any associatedcondition evaluates to true.


Set a new condition for the breakpoint, an expression which must evaluateto true before the breakpoint is honored. If condition is absent, anyexisting condition is removed; i.e., the breakpoint is made unconditional.


If you use the silent command in the command list, the usual message aboutstopping at a breakpoint is not printed. This may be desirable for breakpointsthat are to print a specific message and then continue. If none of the othercommands print anything, you see no sign that the breakpoint was reached.


Continue execution until the next line in the current function is reached orit returns. (The difference between next and step isthat step stops inside a called function, while nextexecutes called functions at (nearly) full speed, only stopping at the nextline in the current function.)


List source code for the current file. Without arguments, list 11 linesaround the current line or continue the previous listing. With . asargument, list 11 lines around the current line. With one argument,list 11 lines around at that line. With two arguments, list the given range;if the second argument is less than the first, it is interpreted as a count.

3a8082e126
Reply all
Reply to author
Forward
0 new messages