This is a long shot, but has anyone ever tried to automate creating a breakpoint in Xcode? I’d like to be able to use my Stream Deck to create a new logging breakpoint. (I’m not talking about an AppleScript breakpoint in Script Debugger, but an Objective-C or Swift breakpoint in Xcode.) As far as I can see, the Xcode scripting dictionary doesn’t include any support for breakpoints.
I can create a plain breakpoint with a shortcut key, but then I have to right click on it to customize it. I don’t see any way to automate that, but maybe there is something obvious I’m missing?
If you’re not familiar with Xcode, here’s what the process of customizing a breakpoint looks like. First you click in the gutter to create the breakpoint, then you right click:
Then you choose Edit Breakpoint and fill in the dialog.
I would like to automate creating a breakpoint that writes to the log, and automatically continues after evaluating actions. It seems to me that this would be something a lot of developers would want to do, but my google searches turn up nothing.
Yes, the Xcode scripting interface provides no control over breakpoints.
I think this might be possible via UI scripting. You could use the Breakpoints project view, find the breakpoint and summon the Breakpoint Editor via double-click or the Edit Breakpoint contextual menu item. From there you can drive the popover panel.
I had another idea: bypass the Xcode UI. What if you generate the PROJECT.xcworkspace/xcuserdata/mall.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist file and populate the breakpoints there?
That’s very interesting. I’ve never been aware of that file before.
Without checking, I’m guessing that the 9223372036854775807 is NSNotFound.
I think so. I tried manually editing a breakpoint in BBEdit, and Xcode didn’t notice. If I have to close and re-open the project every time, that’s not going to be a very handy automation. It would be very cool if that structure was exposed thru AppleScript in Xcode 14, but I’m not going to hold my breath.
I’m glad I asked though – I may find some use for directly working with that XML file. Thanks again.