I'm back in Xcode again and we're paused at the handleSingleTap method for
the BreakpointBugViewController.
And I'll go ahead and run our first command that we saw.
So, breakpoint set --file, we'll use BugFactory.swift.
And a line, line 26, and hit Enter.
And when I hit Enter, you'll notice that it assigns the breakpoint a number.
This is going to be Breakpoint 2, but it doesn't change anything in Xcode UI.
If we actually go to Debug Factory, we don't see a breakpoint here on line 26.
And that's okay, the breakpoint actually does exist.
It just exists in the console session and the UI does not update.
Maybe that's something they'll add later.
But, for now, just know that your breakpoint does exist, and
if we hit continue, and continue the application,
we can see that we've dropped in, and that we've hit Breakpoint 2.
Now, for the next command, we'll do our, here, let me clear out again.
We'll use breakpoint set, and
this time we'll pass the selector option, and viewDidLoad.
So this is a little strange.
It says that our Breakpoint 3 is 23 locations.
And that's a lot of breakpoints.
But that's kind of the point.
Setting breakpoints on selectors manually would be very tedious.
So, you can imagine if we had, say, 23 view controllers, we would have
to click through each file, so print, see the PrintBugViewController,
and go to viewDidLoad and set it here, but I'm not going to do that right now.
We'd have to do it for this one, and so on, and so forth.
So this saves us a lot of time.
And this is another good reason to know how to use the command line.
So let's continue the app and see if we reach one of the 23 breakpoints.
We're still stuck in createBug.
Oh that's right, that's because we're creating way too many bugs.
So before we can continue, we need to disable this or
else I'm going to have to hit play a bunch of times.
So since there's no UI element to actually disable this,
we're going to have to do it through the command line.
So I'll type breakpoint.
And there's a subcommand disable.
And then we pass in the number of the breakpoint.
So breakpoint 2.
And this should disable our breakpoint.
And now we'll hit play.
And should be back, there we go.
So we're back at the running state.
And, so to trigger any of the viewDidLoad breakpoints that we set,
we're going to have to load a new view.
So let's go back to the main view, and
then go to the Breakpoint Bugging to view again.
And it's stopped us on Breakpoint 3.
And if we pull back a little bit we can see that stack frame one is that
viewDidLoad.
It indeed did drop us in into a viewDidLoad breakpoint.
So let's demonstrate the last two from this exercise.
We'll go back to the breakpoint BugViewController and
let's add a breakpoint to the addBugToView method.
We'll hit play.
There we go.
Let's clear this out.
So now we'll do breakpoint list.
Breakpoint list.
Let's drag this up, see everything we're looking at.
So our first breakpoint.
Set and BreakpointBugViewController on handleSingleTap.
Then we have the line breakpoint that we set from line 26.
And then here's the viewDidLoad selector so we can see that it's set a bunch.
We have a bunch of different viewDidLoads for
all these different UI kit classes.
So that's pretty cool.
And oops. There's one other thing I want to show.
This is actually another really neat thing you can see, hit count.
So it actually shows us how many times we've reached a certain breakpoint.
So this could be really useful information,
you can imagine that in certain cases you might want to know this.
And for the last command we'll do thread backtrace all.
And this is the command-line equivalent of all the stack trace information that
we have available to us over here in the navigator.
So we can see for thread 1, we have, there should be frame 0, 1, 2, and
then 17.
Oh wow, it shows us even more information.
Okay. Maybe that's because I don't have all
our options here.
Nope, wrong option.
So I believe there's an option to show, there we go.
This will show only stack frames with debug symbols and between libraries.
So, we don't have symbols for these particular frames, but we can see way
more information with this particular icon unclicked.
And then for thread 2, open him up.
We have frames 0, 1, and 2.
And the next thread, thread 8, we have 0, 1, and 2 as well.
I think that's going to be the same, yep, for thread 9.