Debugging C++ Code: A Practical and Interactive Guide - Sebastian Theophil - CppNow 2023
Вставка
- Опубліковано 18 гру 2024
- www.cppnow.org
/ cppnow
---
Nobody Can Program Correctly: A Practical and Interactive Guide to Debugging C++ Code - Sebastian Theophil - CppNow 2023
Slides: github.com/boo...
---
We like to write code but-despite our best efforts-we make mistakes. Our program will contain bugs. Sometimes, we don’t write what we mean to write, sometimes we don’t understand an aspect of our programming language and at other times we lack-or fail to consider-some critical information about our program’s system environment. As a result, our program will not behave correctly. What do we do now?
In this talk, I would like to take you through the entire debugging process, starting with a program that crashes. What do we do next? Which questions do we have to ask? What information do we need? What can we do to find the cause of the crash? Which tools can help us in this quest, and, last but not least, what can we do to make sure this bug never happens again?
Thanks to real-world examples that we have encountered-and debugged-at think-cell over the years, you will learn how to reproduce, locate, understand and fix even the most difficult bugs.
---
Sebastian Theophil
Sebastian has been working at think-cell Software since its founding in 2002. In the last few years, among many other things, he has ported think-cell to run on macOS. He is also the maintainer of the typescripten project which lets programmers call JavaScript libraries from C++ code compiled to WebAssembly in a convenient and type-safe way. He enjoys leaving his desk from time to time to talk at international C++ conferences.
---
Video Sponsors: think-cell and Bloomberg Engineering
Audience Audio Sponsors: Innoplex and Maryland Research Institute
---
Videos Filmed & Edited By Bash Films: bashfilms.com/
UA-cam Channel Managed & Optimized By Digital Medium Ltd: events.digital...
---
CppNow 2024
www.cppnow.org
/ cppnow
---
#boost #cpp #debugging
56:08 if your test with random data fails, then you should definitely print out the seed used to create the random data. A good idea would be to use special cases (0, 1, -1, int_min, int_max, int_min + 1, int_max - 1, and whatever might be special for your case) and an assortment of random inputs.
26:57 You also need to be aware that the same physical shared memory may be mapped at different virtual addresses in different processes (or in the same process if you map it several times), so you can't store any pointer in there.
Write a Python program to read through your files to check and or count for mistakes in your C++ code. In fact many are doing this already including myself.
I use one to simply read and count every open tag as ( and { and [ and count them then count all the closing tags as ) and } and ] then check for even numbers as pairs. If i get an odd number I throw a line number and what type of tag is missing.
I'm pretty senstive to noise. There is a lot of background noise to hear. I think the microphone was not near enough to the mouth and the gain too high.
I hope, presenters are more sensitive to that in future.
Another thing is: I don't see where the presenter is pointing to with his finger. So maybe he should just use the mouse cursor.
The bugs we write are reflections of unresolved emotional issue in the soul.
Those who have (debugged) healed their soul of all unresolved emotional issues, would write all correct code.
It seems that lectures about debugging use 80 percent examples from threading, and the remainder examples from using "star pointers". So if you don't thread, and write modern C++ you will not have bugs?