00:00hey there in this video i'm going to give you a very very quick overview
00:04of a program called ddd which you can use to debug your programs
00:14disclaimer you should see my gdb video first before you watch this one because it's much more
00:19useful and in my personal opinion gdb is a much better debugger than ddd ddd is actually i think
00:27a wrapper over gdb so it doesn't really add any more functionality it's sort of for people who
00:32like to use guis but the gui is not it's not very good but it's there if you're still struggling with
00:38the command line anyway uh so yeah see my other video if you want to learn about make files uh if
00:44you want to learn about c plus plus c assembly gdb debugging all that stuff are in other videos
00:51but assuming that you know how to use gdb we can start on ddd now ddd anyway if you don't have
00:58ddd on your system you can go sudo apt install ddd i'm on ubuntu you could use whatever package
01:04manage you have on your system like dnf or whatever so sudo apt install ddd i don't have to do that
01:10because uh i already have it on my system unfortunately anyway so uh the first thing
01:16that you can do is you can sort of uh launch it with ddd up here it's called the data display
01:21debugger you can launch it and then you can attach it to your program for me i like to just launch it
01:28uh from the command line i'll type ddd and then the name of my executable i'll build my executable real
01:34fast again this all this stuff is in another video how to build and you know what so forth so i'm going
01:40to build my executable and there it is main so i'm going to go ddd main and this is the uh
01:49i can't remember the name of this already it's the data display debugger yeah i don't really like to use
01:54this anyway you can see that right away there is a source code window visible which sort of looks at
02:01your program's source code if that's not visible you can click on the view menu item up here and start
02:07you know enabling and disabling windows there's a data window to let you look at data there's a
02:12machine code window i'm just going to basically make sure that the gdb console is up and that the
02:18source window is up when i closed both windows hoping that i could show you that i opened both of
02:26them it just shut down the whole program okay anyway so yeah click view and make sure that the source
02:31windows open so we can see our source code and then also make sure that the gdb console window is
02:37open so we can type gdb commands and then um well you know probably if you know gdb you'll you'll
02:45want to start typing commands here you know enter a breakpoint main.cpp line you know whatever but
02:50once you start doing that a lot you'll realize maybe you don't need to be inside of ddd with ddd you
02:56can right click on a line and add a breakpoint manually so that's a little convenient i think we can
03:00do can we do control mouse no there's a lot of obscure areas here well you can go to the preferences
03:08and change the font size i think i'm not going to deal with that in this video but so suppose for the
03:13sake of argument i wanted to break at this line right here i could just right click on it and i have
03:19to hold down the right mouse and say set breakpoint and then i could do the same thing for this set
03:26breakpoint and then for this set breakpoint so it's a little more convenient a little bit faster
03:32if you like looking at the text in this way to set breakpoints and then you can disable breakpoints
03:38and you can delete breakpoints and you can reset the execution position if you're absolutely sure you
03:44know what you're doing you can have your program skip an area and jump somewhere and then once i've kind
03:49of set up my breakpoints i can go up here at the top this is the uh i forgot what window this is called
03:56but i can basically hit run which i accidentally already clicked when i was trying to resize the
04:00window there we go oh i can't resize it okay so we'll go run and uh well now we've already hit a
04:09breakpoint right away notice how at the bottom in the gdb uh console area it says breakpoint 2
04:15at line 36 and then there's a green arrow here letting us know that we hit one of our breakpoints
04:19already so then we can do normal gdb stuff we can go info breakpoints just to kind of see what's in
04:26there and um you can resize with this handle on the very right side i don't think it works in the
04:32middle here i've tried it many times but so you can kind of resize with this handle on the right
04:37side to get more real estate for the gdb panel and so it's telling me all right uh i did info breakpoints
04:44just to see the breakpoints i can go info locals to see my local variables i could print a variable
04:49you know all the all the normal gdb commands i'm gonna hit continue and five to skip the next five times
04:55this breakpoints get hit this breakpoint gets hit uh now the next breakpoint that gets hit is uh
05:01this other one over here i can do the same thing info locals i can see the state of all my variables
05:07you know what is b you know what is i what is a what is whatever and when i'm finished i can say
05:13continue and i can also modify my breakpoints by just sort of like deleting them enabling them
05:18disabling them but that's me trying to type everything in the terminal of course
05:24with ddd you can right click on a breakpoint and disable it or delete it and so forth
05:30when you're eventually done let's see i think you can do kill to kill the process and then uh
05:39you can just kind of exit ddd at this point or you can exit the gdb console with q
05:44and that's it that's the basics for ddd however again i strongly encourage you to learn gdb first and
05:51by the time you do that you will probably not want to use ddd but i have to put up this video
05:56uh regardless let me know if you're interested in very advanced stuff covering ddd i don't know
06:02maybe in the next 10 or 20 years i might upload another ddd video you never know okay thanks for
06:10watching this video um i hope you learned a little bit and i hope you go directly to the gdb video
06:16after this see you in the next one hey everybody thanks for watching this video again from the
06:24bottom of my heart i really appreciate it i do hope you did learn something and have some fun
06:29if you could do me a please a small little favor could you please subscribe and follow this channel
06:35or these videos or whatever it is you do on the current social media website that you're looking
06:40at right now it would really mean the world to me and it'll help make more videos and grow this
06:45community so we'll be able to do more videos longer videos better videos or just i'll be able to keep
06:50making videos in general so please do do me a kindness and uh and subscribe you know sometimes
06:56i'm sleeping in the middle of the night and i just wake up because i know somebody subscribed or
07:00followed it just wakes me up and i get filled with joy that's exactly what happens every single
07:04time so you could do it as a nice favor to me or you could you control me if you want to just wake
07:09me up in the middle of the night just subscribe and then i'll i'll just wake up i promise that's what
07:13will happen also uh if you look at the middle of the screen right now you should see a qr code which you
07:19can scan in order to go to the website which i think is also named somewhere at the bottom of this video
07:24and it'll take you to my main website where you can just kind of like see all the videos i published
07:29and the services and tutorials and things that i offer and all that good stuff and uh
07:36if you have a suggestion for uh uh clarifications or errata or just future videos that you want to see
07:42please leave a comment or if you just want to say hey what's up what's going on you know just send me
07:47a comment whatever i also wake up for those in the middle of the night i get i wake up in a cold sweat
07:51and i'm like it would really it would really mean the world to me i would really appreciate it
07:56so again thank you so much for watching this video and um enjoy the cool music as as i fade
08:04into the darkness which is coming for us all
08:17so
08:30so