Debugging in C++ with Visual Studio Code
1h 55mIntermediate2025-04-07
Authors

Eduardo Corpeño
Electrical Engineer, Computer Programmer, and Teacher for 15+ years
Course details
In this course, learn practical techniques to identify and fix errors in your C++ programs. Instructor Eduardo Corpeño introduces a variety of debugging tools and methods, from basic print statement debugging to more structured approaches using breakpoints, watches, and variable views in Visual Studio Code. Explore how to interpret compiler messages, understand common programming mistakes, and apply defensive programming strategies to minimize errors. By the end of this course, you'll be better equipped to handle different debugging scenarios and improve the reliability of your C++ code. Whether you're brushing up on your debugging skills or looking to learn new techniques, this course offers practical guidance to help you debug more effectively.
Learning objectives
Identify and use debugging tools in VSCode, including breakpoints, watches, variable views, memory views, call stacks, and disassembly views, to effectively analyze and debug C++ code.
Apply systematic debugging techniques to diagnose and resolve common C++ programming errors, such as segmentation faults, null pointer dereferences, type mismatches, and race conditions, enhancing code reliability.
Interpret compiler error messages and warnings in VSCode to understand underlying issues and respond by refactoring code to address these issues and improve overall code quality.
Implement defensive programming techniques to prevent and reduce the likelihood of bugs and errors in your C++ code, contributing to a more robust and maintainable codebase.
Learning objectives
Identify and use debugging tools in VSCode, including breakpoints, watches, variable views, memory views, call stacks, and disassembly views, to effectively analyze and debug C++ code.
Apply systematic debugging techniques to diagnose and resolve common C++ programming errors, such as segmentation faults, null pointer dereferences, type mismatches, and race conditions, enhancing code reliability.
Interpret compiler error messages and warnings in VSCode to understand underlying issues and respond by refactoring code to address these issues and improve overall code quality.
Implement defensive programming techniques to prevent and reduce the likelihood of bugs and errors in your C++ code, contributing to a more robust and maintainable codebase.
Skills covered
Visual Studio CodeProgramming FoundationsProgramming LanguagesMicrosoftSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Debug with Visual Studio Code
- 02 - What you should know
- 03 - Using the exercise files in GitHub Codespaces
- 04 - Solving challenges in CoderPad
1. What You're Up Against
- 05 - About debugging
- 06 - Compile-time errors
- 07 - Runtime errors
- 08 - Logical errors
2. Debugging without a Debugger
- 09 - Print statements
- 10 - Printing variable values
- 11 - Reporting code coverage
- 12 - Switching debug and verbose modes
- 13 - Solution - Debug with a knife in the woods
3. Common Debugger Tools
- 14 - The VS Code debugger
- 15 - Linting
- 16 - Breakpoints
- 17 - Variables view
- 18 - Watch view
- 19 - Call stack view
- 20 - Tracing and step execution
- 21 - Solution - Find and fix the bug
4. Debugging Compile-Time Errors
- 22 - Syntax errors
- 23 - Semantic errors
- 24 - Linker errors
- 25 - Solution - Get it to compile
5. Debugging Runtime Errors
- 26 - Segmentation faults
- 27 - Null pointer assignments
- 28 - Memory leaks
- 29 - Solution - Don't let it crash and burn
6. Low-Level Debugger Features
- 30 - Registers view
- 31 - Memory view
- 32 - Disassembly view
7. Writing Robust Code
- 33 - Defensive programming
- 34 - Erroring out
- 35 - Using assertions
- 36 - Handling exceptions gracefully
Conclusion
- 37 - Next steps