Hello and welcome.
In this video, I'm going to show you how you can configure the Lldb debugger for the macOS so that
it works in code light.
Now, the first thing you probably need to do is you need to bring up a terminal and you can bring up
a terminal.
Remember, just go to the finder and you go to utilities and bring up a terminal.
Once you have a terminal window, you can actually type in which lldb and that will show you the path
to the Lldb debugger and you want to use the Lldb debugger.
It works a little bit better than GDB.
If you're on a mac OS you could try using the gdb debug so the debugger is installed in usr bin lldb.
You might need that information later.
At this point you would just want to bring up code light and you can go to your application finder and
go to applications and double click on code light to bring that up.
I already have that up, so I'm going to go ahead and bring up code light.
And at this point I'm going to create a new project.
I'll make sure I select the debugger and then see if the configuration works.
So I have this workspace as an older workspace.
I'm going to right click, I'm going to say new project.
I'm going to make sure that I'm going to call this project debugger test and I'm going to select the
categories console, Simple Executable, GCC compiler, GCC.
But the debugger I'm going to select is Lldb debugger and then keep the build system as default.
And I'm going to go ahead and say, okay, so now I have this new project debugger test and I have a
new template source file main.c and we're going to see if the debugger works.
So what we can do is we can select in the margin here with the line numbers are we can just select in
here right by the five and try to add a breakpoint right in there and you'll see that circle.
Red breakpoint basically stops the execution of the program at that line of code.
And so to see if the configuration of our debugger worked, we set that breakpoint and then we can go
up and we can say debugger and we can say start, continue debugger.
At this point it says, Would you like to build?
You can just say build and debug and the project comes up and it starts to run and you'll notice it
stops right on line five.
You can see that little red or red circle, but also you can see that green arrow.
That means the program has stopped execution.
So that means we're good to go.
We're our debugger is working on the Mac OS and we can step through the code.
We're going to go through all these details in later lectures.
But you'll also see that the debugger window came up.
You know, you can make that bigger again.
We'll walk through that later.
But we just want to confirm that our configuration is working for the debugger.
So at this point we can just hit the red rectangle, we can stop the debugger.
And our program will stop execution.
And you should notice, too, when you select a debugger test, you can check the project settings for
the debugger and so forth, and you should see that you don't actually need to set the debugger path.
If you do have any issues, you might need to go and set it to the path that we just looked at.
USR bin Lldb if you have any issues, but it doesn't need to be set if you're actually selecting when
you create your project and selecting lldb.
But if you do have issues, you may want to look there.
The other thing is up in the settings, you can also see settings for Lldb settings.
Again, usually these are all good by just keeping default, but if you have any issues, you may have
to look at some of this information.
But I don't have any issues.
I it's as simple as basically just selecting lldb as the option and then setting breakpoints and everything
works.
A couple things to notice.
You do want to make sure that when you compile and when you run that your project is set as debug.
It should not be set as release, it should be set as debug.
And then one other thing is you want to make sure when you have your project settings that you're actually
compiling for debugging.
So you want to make sure and we've gone through this already, but you just want to make sure under
the compiler that for the C compiler option that you have the dash o for optimization and the dash G.
And so you can produce debugging information as dash G and you want to make sure that is selected and
then also optimize for debugging.
But if you have all those settings set, you should have no problem running the debugger and code light
on a mac OS.
Thank you.