Xcode / GDB stops at my auto stop breakpoints when debugging on device

I just discovered (thanks to another very useful post) that I can use GDB commands to create breakpoints that write information to the GDB console, regardless of whether it is being debugged on the device or the simulator. This is similar to NSLog, but much nicer is that you do not have to wait until the console catches up with you, you do not have annoying timestamps, and you can turn them on / off at run time through the Xcode breakpoint view).

Very nice, and I took the time to figure out how best to write messages and variables together. (Use the GDB po [NSString stringWithFormat: @"Your message: %d %@",variable,[[object expression] description]] command) for maximum versatility.

Everything worked perfectly in the simulator. When I finally got to debugging the devices, I was getting messages just fine, but GDB was STOPPING at every breakpoint, even though I set them to continue automatically by checking the box as a breakpoint.

I tried adding a โ€œcontinueโ€ commmand to each breakpoint, and it worked, but GDB also started spewing out information about every hit of the breakpoint and telling me โ€œContinuingโ€ after each line.

My questions:

  • Is this happening for you?
  • Can I change something to automatically continue to work on the device.
  • Can I tell GDB to be less verbose and only give me the output I'm printing?

Please, help!

David

+4
source share
3 answers

I encountered the same behavior. It turned out that Xcode duplicated a breakpoint on the intended line. Perhaps there is an error when a left click sometimes adds a hidden breakpoint instead of disconnecting?

The solution was as follows:

  • Select the Breakpoints Navigator tab in the navigator frame on the left.
  • Find duplicate breakpoints either manually, or enter the class name in the search box at the bottom of the Navigator. (remember that several sections of a list project may contain a breakpoint for the same class)
  • Right-click one at a time and select "Modify" to find out if it is continued or not.
  • Right click on the unnecessary breakpoint and delete
+1
source

David

There are some useful console commands that you might want to familiarize yourself with.

 info b (lists all breakpoints) ena (enables all breakpoints) dis (disables all breakpoints) ena X (enable breakpoint number X) dis X (disable breakpoint number X) 

GDB also supports conditional breakpoints:

 cond X [condition] 

And, commands to automatically start when a breakpoint is reached:

 command X 

Aaron

0
source

Another very useful option is watchpoint - break only when changing expression expressions.

0
source

Source: https://habr.com/ru/post/1337033/


All Articles