SlideShare a Scribd company logo
Debugging like a pro
vicente.bolea@gmail.com
Motivation
- Debugging might be the
worst part of coding.
- Late night stress.
- Arm you with tools to
fight your run-times
bugs!
Scope
1. GDB basics.
2. GDB visual mode.
3. GDB frames.
4. GDB watchpoints.
5. GDB reverse walking.
6. GDB plugins & dotfiles.
7. Valgrind and clang sanitizer.
8. Your code.
GDB: Before invoking
GDB
Always use compiling flag for gdb:
$ g++ -g main.cpp
Invoke gdb in the following manner:
$ gdb [-tui] ./a.out
GDB: Basic commands
- gdb> r[un] : execute your code.
- gdb> b[reak] line|file:line|function : set a breakpoint.
- gdb> p[rint] variable : Display the variable name.
- gdb> n[ext] : Goes to next line.
- gdb> s[tep] : Goes inside the function currently in the PC.
- gdb> fin[ish] : Stop when we are returning.
GDB: Visual mode
- Always invoke GDB like : $ gdb -tui ./a.out
- Or in your standard GDB session press: C-x C-a
- Commands:
- gdb> focus src|cmd or C-x o
- Switch to single key mode C-x s
GDB: Visual
mode
GDB: Frames
- Whenever you enter a function you save the
context (frame) of the function.
- GDB allows you to go through all the frames
you have stacked:
- gdb> up
- gdb> down
- gdb> frame
- gdb> backtrace
GDB: Watchpoints
- Hardware vs. software watchpoints.
- Read, write, and read-write watchpoints (watch, rwatch, awatch)
- Easy to invoke:
- gdb> watch variable
- Also watch for conditions to happen.
- You need to be in the the same frame.
- Not a good feature for interframe code.
GDB: Reverse walking
- GDB let you go back in the time.
- It will record your code so it can go
backwards.
- Slow and resources expensive.
GDB: Reverse walking
- gdb> record [stop]
- gdb> reverse-continue [rc]
- gdb> reverse-step [rs]
- gdb> reverse-next [rn]
- gdb> set exec-direction forward|reverse
GDB: Plugins &
dotfiles
- You can customize and extend your gdb.
- Create your own perl or python functions.
to debug your data structures.
- Have a look to my dotfiles :)
Beyond GDB:
valgrind & clang
sanitizer
- Memory leaks are not
detectable with GDB.
- Valgrind will you out
with that, also you can
connect it to it.
- Even modern clang
versions performs
memory sanitization.
Your code the first debugger
When coding in C|C++ you have to great tools to prevent run-time bugs.
1. -DDEBUG macro. // Compile a debug version of your project.
2. assert(/* condition */) // Keep your pre-condition & variants.
Also, considering using logs, specially if your project is a Linux service (syslog).
Q&A

More Related Content

What's hot (8)

Bridging Ousterhout's Dichotomy
Bridging Ousterhout's DichotomyBridging Ousterhout's Dichotomy
Bridging Ousterhout's Dichotomy
guest2838a0
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
RameshNair6
 
Django Toolbox
Django ToolboxDjango Toolbox
Django Toolbox
pythonsd
 
ORTC SVC SimulCast
ORTC SVC SimulCastORTC SVC SimulCast
ORTC SVC SimulCast
Jxck Jxck
 
PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)
Aleksander Alekseev
 
JavaScript code academy - introduction
JavaScript code academy - introductionJavaScript code academy - introduction
JavaScript code academy - introduction
Jaroslav Kubíček
 
Unix is my IDE
Unix is my IDEUnix is my IDE
Unix is my IDE
tkramar
 
GulpJs - An Introduction
GulpJs - An IntroductionGulpJs - An Introduction
GulpJs - An Introduction
Knoldus Inc.
 
Bridging Ousterhout's Dichotomy
Bridging Ousterhout's DichotomyBridging Ousterhout's Dichotomy
Bridging Ousterhout's Dichotomy
guest2838a0
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
RameshNair6
 
Django Toolbox
Django ToolboxDjango Toolbox
Django Toolbox
pythonsd
 
ORTC SVC SimulCast
ORTC SVC SimulCastORTC SVC SimulCast
ORTC SVC SimulCast
Jxck Jxck
 
PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)PostgreSQL and Compressed Documents (pgconf.ru 2018)
PostgreSQL and Compressed Documents (pgconf.ru 2018)
Aleksander Alekseev
 
JavaScript code academy - introduction
JavaScript code academy - introductionJavaScript code academy - introduction
JavaScript code academy - introduction
Jaroslav Kubíček
 
Unix is my IDE
Unix is my IDEUnix is my IDE
Unix is my IDE
tkramar
 
GulpJs - An Introduction
GulpJs - An IntroductionGulpJs - An Introduction
GulpJs - An Introduction
Knoldus Inc.
 

Similar to Debuging like a pro (20)

Advanced Debugging with GDB
Advanced Debugging with GDBAdvanced Debugging with GDB
Advanced Debugging with GDB
David Khosid
 
Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with Gdb
SenthilKumar Selvaraj
 
Debug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUIDebug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUI
Tom Chen
 
gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdf
ligi14
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handout
Suraj Kumar
 
MSL2009. Gdb
MSL2009. GdbMSL2009. Gdb
MSL2009. Gdb
Juan A. Suárez Romero
 
Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDB
Chris Simmonds
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
yamanekko
 
ELC-E Linux Awareness
ELC-E Linux AwarenessELC-E Linux Awareness
ELC-E Linux Awareness
Peter Griffin
 
Gnu debugger
Gnu debuggerGnu debugger
Gnu debugger
Gizem Çetin
 
GNU Debugger
GNU DebuggerGNU Debugger
GNU Debugger
Gizem Çetin
 
Gdb remote debugger
Gdb remote debuggerGdb remote debugger
Gdb remote debugger
shanghai jiaotong university
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
Priyank Kapadia
 
lab1-ppt.pdf
lab1-ppt.pdflab1-ppt.pdf
lab1-ppt.pdf
AbdelrahmanElewah1
 
Extending GDB with Python
Extending GDB with PythonExtending GDB with Python
Extending GDB with Python
Lisa Roach
 
Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022
ssuser866937
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
Valerii Kravchuk
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
Hafez Kamal
 
Wavedigitech gdb
Wavedigitech gdbWavedigitech gdb
Wavedigitech gdb
Wave Digitech
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
libfetion
 
Advanced Debugging with GDB
Advanced Debugging with GDBAdvanced Debugging with GDB
Advanced Debugging with GDB
David Khosid
 
Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with Gdb
SenthilKumar Selvaraj
 
Debug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUIDebug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUI
Tom Chen
 
gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdf
ligi14
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handout
Suraj Kumar
 
Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDB
Chris Simmonds
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
yamanekko
 
ELC-E Linux Awareness
ELC-E Linux AwarenessELC-E Linux Awareness
ELC-E Linux Awareness
Peter Griffin
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU Debugger
Priyank Kapadia
 
Extending GDB with Python
Extending GDB with PythonExtending GDB with Python
Extending GDB with Python
Lisa Roach
 
Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022
ssuser866937
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
Valerii Kravchuk
 
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
NanoSec Conference 2019: Code Execution Analysis in Mobile Apps - Abdullah Jo...
Hafez Kamal
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
libfetion
 

More from Vicente Bolea (8)

Basic Git Tutorial
Basic Git TutorialBasic Git Tutorial
Basic Git Tutorial
Vicente Bolea
 
BOOST ASIO overview
BOOST ASIO overviewBOOST ASIO overview
BOOST ASIO overview
Vicente Bolea
 
Linux Developing Stack
Linux Developing StackLinux Developing Stack
Linux Developing Stack
Vicente Bolea
 
Github developing stack
Github developing stackGithub developing stack
Github developing stack
Vicente Bolea
 
Autotools, Design Patterns and more
Autotools, Design Patterns and moreAutotools, Design Patterns and more
Autotools, Design Patterns and more
Vicente Bolea
 
Project management frameworks for software developing
Project management frameworks for software developingProject management frameworks for software developing
Project management frameworks for software developing
Vicente Bolea
 
Sample Project using design patterns and agile
Sample Project using design patterns and agileSample Project using design patterns and agile
Sample Project using design patterns and agile
Vicente Bolea
 
VeloxDFS
VeloxDFSVeloxDFS
VeloxDFS
Vicente Bolea
 
Linux Developing Stack
Linux Developing StackLinux Developing Stack
Linux Developing Stack
Vicente Bolea
 
Github developing stack
Github developing stackGithub developing stack
Github developing stack
Vicente Bolea
 
Autotools, Design Patterns and more
Autotools, Design Patterns and moreAutotools, Design Patterns and more
Autotools, Design Patterns and more
Vicente Bolea
 
Project management frameworks for software developing
Project management frameworks for software developingProject management frameworks for software developing
Project management frameworks for software developing
Vicente Bolea
 
Sample Project using design patterns and agile
Sample Project using design patterns and agileSample Project using design patterns and agile
Sample Project using design patterns and agile
Vicente Bolea
 

Recently uploaded (20)

Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Process Parameter Optimization for Minimizing Springback in Cold Drawing Proc...
Journal of Soft Computing in Civil Engineering
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 
Metal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistryMetal alkyne complexes.pptx in chemistry
Metal alkyne complexes.pptx in chemistry
mee23nu
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.Fort night presentation new0903 pdf.pdf.
Fort night presentation new0903 pdf.pdf.
anuragmk56
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Introduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptxIntroduction to Zoomlion Earthmoving.pptx
Introduction to Zoomlion Earthmoving.pptx
AS1920
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
Reagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptxReagent dosing (Bredel) presentation.pptx
Reagent dosing (Bredel) presentation.pptx
AlejandroOdio
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...15th International Conference on Computer Science, Engineering and Applicatio...
15th International Conference on Computer Science, Engineering and Applicatio...
IJCSES Journal
 
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
211421893-M-Tech-CIVIL-Structural-Engineering-pdf.pdf
inmishra17121973
 
Machine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptxMachine learning project on employee attrition detection using (2).pptx
Machine learning project on employee attrition detection using (2).pptx
rajeswari89780
 

Debuging like a pro

  • 2. Motivation - Debugging might be the worst part of coding. - Late night stress. - Arm you with tools to fight your run-times bugs!
  • 3. Scope 1. GDB basics. 2. GDB visual mode. 3. GDB frames. 4. GDB watchpoints. 5. GDB reverse walking. 6. GDB plugins & dotfiles. 7. Valgrind and clang sanitizer. 8. Your code.
  • 4. GDB: Before invoking GDB Always use compiling flag for gdb: $ g++ -g main.cpp Invoke gdb in the following manner: $ gdb [-tui] ./a.out
  • 5. GDB: Basic commands - gdb> r[un] : execute your code. - gdb> b[reak] line|file:line|function : set a breakpoint. - gdb> p[rint] variable : Display the variable name. - gdb> n[ext] : Goes to next line. - gdb> s[tep] : Goes inside the function currently in the PC. - gdb> fin[ish] : Stop when we are returning.
  • 6. GDB: Visual mode - Always invoke GDB like : $ gdb -tui ./a.out - Or in your standard GDB session press: C-x C-a - Commands: - gdb> focus src|cmd or C-x o - Switch to single key mode C-x s
  • 8. GDB: Frames - Whenever you enter a function you save the context (frame) of the function. - GDB allows you to go through all the frames you have stacked: - gdb> up - gdb> down - gdb> frame - gdb> backtrace
  • 9. GDB: Watchpoints - Hardware vs. software watchpoints. - Read, write, and read-write watchpoints (watch, rwatch, awatch) - Easy to invoke: - gdb> watch variable - Also watch for conditions to happen. - You need to be in the the same frame. - Not a good feature for interframe code.
  • 10. GDB: Reverse walking - GDB let you go back in the time. - It will record your code so it can go backwards. - Slow and resources expensive.
  • 11. GDB: Reverse walking - gdb> record [stop] - gdb> reverse-continue [rc] - gdb> reverse-step [rs] - gdb> reverse-next [rn] - gdb> set exec-direction forward|reverse
  • 12. GDB: Plugins & dotfiles - You can customize and extend your gdb. - Create your own perl or python functions. to debug your data structures. - Have a look to my dotfiles :)
  • 13. Beyond GDB: valgrind & clang sanitizer - Memory leaks are not detectable with GDB. - Valgrind will you out with that, also you can connect it to it. - Even modern clang versions performs memory sanitization.
  • 14. Your code the first debugger When coding in C|C++ you have to great tools to prevent run-time bugs. 1. -DDEBUG macro. // Compile a debug version of your project. 2. assert(/* condition */) // Keep your pre-condition & variants. Also, considering using logs, specially if your project is a Linux service (syslog).
  • 15. Q&A