8-BITs of The Visual Studio Debugger You Should Use!

preview_player
Показать описание
The Visual Studio debugger is an incredibly powerful tool, but does have a steep learning curve. In this video I show you the basics of how to use the debugger to analyse how your program works, or not! I show variable analysis, function stepping and navigation, memory viewing, breakpoints, memory leaks and data visualization.
Рекомендации по теме
Комментарии
Автор

#1 is generally called a buffer overflow. A memory leak is when you do something like:
char* a = new char[5];
char* b = new char[5];
b = a; // What happened to the old a? Its just left floating around taking up memory that is no longer accessible! Its "leaking" memory.

Edit: To be clear, buffer overflows are worse. They will actually break your program (or allow attackers to break it) while memory leaks just waste resources but are otherwise harmless. (Of course, you'll eventually run out, but it would have to be a hell of a leak to exhaust resources on a modern PC.. much more critical on embedded systems where you don't have a lot of resources to spare.)

altrag
Автор

This takes me back to my first live encounter with Smalltalk-80, when my uni had a Sun workstation in the basement for experimenting. One of the experimenters knew that I had an interest in Smalltalk from conversation in the common room and invited me to take a butchers to see why her "simple diary program" wasn't loading and saving files properly.

It turned out that the Smalltalk System Library had a bug which wrote the length of a string out as a variable-length integer but always assumed a short integer on reading it back (well, it was slightly more complicated than that but that's the TL;DR version ;-) and adding a simple conversion call (IIRC almost literally adding the word "toInteger" into the codebase and nothing more) fixed the problem.

Live-debugging system calls and fixing them on the fly is a heady experience and never to be forgotten ^_^ take that Windows and Linux :-P

PhilBoswell
Автор

This was super useful and awesome, thank you for posting!

mr_noodler
Автор

I didn't know about the memory window, that seems super interesting. But what has really blown my mind is the fact that you can edit the values on runtime through the local (and I suppose auto too). Thanks a lot for this knowledge!

sarahraynore
Автор

Thanks sir, you are really kind for share knowledge :)

durumbasa
Автор

Here i was using Visual Studio for years only knowing about the locals page and nothing else.

I can't believe I didn't realize how good this debugger was before

iandrsaurri
Автор

fantastic video, I think most programmers could do with improving debugging skills and this is a nice reference on how to start.

sandspatel
Автор

The commonest and most difficult problem I've had to deal with is performance: how to find and eliminate unnecessary steps. I've used profiling tools but I'll look for ways to use the VS debugger to see where a program is spending most of its time.

mortkebab
Автор

You can even drag that little yellow arrow around to the line you want to run next, pretty useful!

rutalorp
Автор

My 9th bit would probably be Trace Points, these day a whole bunch of explicit write-tracing-code and re-compile loops.

tomkirbygreen
Автор

This makes the complex monster called "Visual Studio" a bit easier to use, thank you : ) (pun, hehe)

GilFavor
Автор

I am using basically a fresh install of Visual Studio 2019 and when I go to Debug > Windows I only have Breakpoints, Exception Settings, Output, and Immediate. So confused because I don't have nearly the same amount of options you do at 1:21, did they move these or restrict users access to these features for the free version?

(Edit) you have to actually be live debugging with a breakpoint to see all contents. I just figured you could configure it before debugging.

SpooningTreesap
Автор

Thanks for your wonderful video.
I have a simple question. How/where can I find how much memory my code used to be run?

mohammad-rezarokhforouz
Автор

Wait you can do that with breakpoints ? Why the hell do i see this now

baynaraoa
Автор

Thanks! Could you also do one about helpful keyboard shortcuts?? These are incredible for productivity.

johngiskhan
Автор

Is that vertical scroll bar with the code in it an extension of some sort, or a feature I've never discovered in VS?

danmoos
Автор

If there's one thing from Windows that I kind of miss on Linux, it's Visual Studio's debugger! :)
GDB is nice too and it can do the same things... however, it's just not the same and far less intuitive... :/

srccde
Автор

16:15 I'm assuming that you not only meant that the buffer was too small here, but that you are also missing delete[] buffer2; statement at the end. Because that's two bugs in one. (I haven't seen you releasing dynamically allocated memory in some of your videos either.)

sentdc
Автор

2:33 A string is a linked list? isn't it a vector?

Kid
Автор

Hey, how do you make your Locals, Call Stack, Locals, Memory 1, Output to automatically run when you start debugg?

uswd