Reputation: 3727
Is there any way to copy-paste breakpoints in Xcode?
The reason I am asking is, I have a breakpoint set to "automatically continue after evaluating", with some actions associated. I want to have the same breakpoint behavior/action in multiple places in the code. Instead of re-doing it (Setting breakpoint, customizing it) 10 times (or even more which can be cumbersome), just copy-paste it!?
Upvotes: 17
Views: 1416
Reputation: 31
In the scope of one file, you can easily duplicate breakpoints from Breakpoints Navigator (⌘+8). Just select a particular breakpoint and then copy and paste (⌘+c, ⌘+v).
It's going to be duplicated on the same line, so you need to move it with mouse to any other line.
Unfortunately, it's not currently possible to move breakpoints between files (Xcode 13.1).
Upvotes: 1
Reputation: 736
I ran into this issue as well as I wanted to share some of my more elaborate breakpoints with people in my team.
You will find the xcdebugger directory in
PROJECT_NAME.xcworkspace/xcshareddata/xcdebugger
Second, you will need to make the breakpoint a shared breakpoint by right clicking the breakpoint and clicking Share Breakpoint
You should then find the Breakpoints_vX.xcbkptlist file with your shared breakpoints in the xcdebugger
You should find the xcdebugger directory for the shared breakpoints here
PROJECT_NAME.xcodeproj/xcshareddata/xcdebugger
In there you will find the same breakpoints file you seek. There is also a xcdebugger directory in the xcuserdata/USERNAME.xcuserdatad but they might have some coded file paths that would be problematic when sharing other devices.
Upvotes: 0
Reputation: 509
I've found a solution, though it might not be easier. All of the breakpoints are saved in an XML file inside your Xcode project. To find the file, select your project file and choose "Show Package Contents", then go to:
xcuserdata/(YourNameHere).xcuserdatad/xcdebugger/
You can open the breakpoints file and copy /paste their XML. You can then change the file and line numbers of the breakpoints.
Upvotes: 7