SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Debugging
Finding and solving
problems in software
What is debugging?
"Bug" and "debugging" are attributed to the
discovery of a moth found in a Mark II computer at
Harvard University.
Debugging is not troubleshooting
Debugging Rules...
1. Understand the system
2. Make it fail
3. Quit thinking and look
4. Divide and Conquer
5. Change one thing at a time
6. Keep an audit trail
7. Check the plug
8. Get a fresh view
9. If you didn't fix it, it aint fixed
Debugging - A Simple Method
a) Start
|
b) Construct a Hypothesis
|
c) Construct an Experiment
|
d) Hypothesis Proved? - goto b)
|
Need more evidence? - goto c)
|
Stop
1. Understanding the System
Know the fundamentals of the system
Understand the frameworks involved
Read the API's and communication interfaces
Know your tools
Understand what each module of the system does
2. Make it Fail
Start at the beginning
Automate the failure
No detail is insignificant
Intermittent failures?
Isolate the failure
Build debugging tools and test harnesses
3. Quit thinking and look
Gather the low level details and "see" the failure
Understand the context of the bug
Design instrumentation in:
●Runtime statistics
●Status messages
●Debug logging - be descriptive!!!
●Deployment time environment checks
Hypothesise and test
4. Divide and Conquer
Narrow the search down, software AND
hardware. Successive approximation.
Start at the bad end (e.g. the error log) and work
your way up the chain looking at the various
points on the way
Fix the bugs you know about - fixing one could
fix the other
Fix the noise first, but don't go nuts
5. Change one thing at a time
Compare with a good one !
Use a rifle not a shotgun
What's changed recently, it used to work!
Separate environment and product
6. Keep an audit trail
Keep a day book of what you did
During debugging write down...
1.What you did...
2.In what order...
3.And what happened!
Be specific and consistent
Correlate symptoms with others
Version control and change logs are great for
determining an audit trail of what's changed
7. Check the plug
Question your assumptions
8. Get a Fresh View
Get another viewpoint on the solution
Talk to somebody about the problem
Ask an expert:
●Email the author
●Check the forums
●Subscribe to the mailing list
Make sure you report symptoms not theories
9. If you didn't fix it, it aint fixed!
The most important lesson by far...
●Fix the root cause
●Make sure it can't possibly happen again
●Fix the process at fault
"We didn't see an issue until we deployed into the production
environment"
= Deploy early and deploy often
Debugging Methods and Tools
Debugging Methods
Print/Trace Debugging - watching the flow of execution after
adding print statements to the original code
Remote Debugging - connect to a remote system with a
debugger, monitor the execution and state
Post Mortem Debugging - analysis of a memory dump from a
program that has crashed
Profiling - not debugging per se, but a useful technique for
analysing a running program to look for issues
Lesser Known (?) Debugging Methods
Rubber Ducking - explaining your problem to someone
else. Stating the problem aloud in order to work it out.
Failfirst - Write a unit test that exposes the failure, correct the
code and make it pass
Saff Squeeze - Write a system test, inline code, write test, repeat
until fixed
http://www.threeriversinstitute.org/HitEmHighHitEmLow.html
Chaos Monkey - AWS Netflix approach - randomly kill and test
areas. Fail consistently to test fault tolerant software.
http://www.codinghorror.com/blog/2011/04/working-with-the-chaos-monkey.html
Eclipse Debugging 1
Set breakpoints in the code
Step into, over, return
Watches - display a variable value
Hit counts
Setting an exception breakpoint
Setting a method breakpoint
Eclipse Debugging 2
Class load breakpoint
Using display after a breakpoint has been hit
Attaching a remote debugger via a JDB agent
Bug Taxonomies and Bug Types
There are ways to categorise bugs... lots of
taxonomies available from research literature
Some bug types include:
●Bohrbug - bug that manifests itself consistently
under a set of conditions
●Heisenbug - bug that alters its' characteristics
when studied
Preventing Bugs
Debugging is hard and expensive in terms of fixing
the bug, testing it and re-deploying it...
We can try and prevent bugs with:
●Code Review
●Defensive Programming
●Precondition, postcondition and invariant checking
●Assertions
Further Resources
●Debugging - The 9 Indispensable Rules for Finding
Even The Most Elusive Software and Hardware
Problems - David Agans
●Debug It! : Find, Repair and Prevent Bugs in Your
Code (Pragmatic Programmers) - Paul Butcher
●Testing Education -
http://www.testingeducation.org/a/bugtax.pdf
●Lars Vogels Debugging Overview (2011) -
http://www.vogella.de/articles/EclipseDebugging/artic

Weitere ähnliche Inhalte

Was ist angesagt?

Exception Handling in VB.Net
Exception Handling in VB.NetException Handling in VB.Net
Exception Handling in VB.Netrishisingh190
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithmsDr Geetha Mohan
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventionssaranyatdr
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Software Engineering Fundamentals
Software Engineering FundamentalsSoftware Engineering Fundamentals
Software Engineering FundamentalsRahul Sudame
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codeshermiraguilar
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Appletsamitksaha
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentationfazli khaliq
 

Was ist angesagt? (20)

White box ppt
White box pptWhite box ppt
White box ppt
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Exception Handling in VB.Net
Exception Handling in VB.NetException Handling in VB.Net
Exception Handling in VB.Net
 
System calls
System callsSystem calls
System calls
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Algorithm and pseudocode conventions
Algorithm and pseudocode conventionsAlgorithm and pseudocode conventions
Algorithm and pseudocode conventions
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Cyclomatic complexity
Cyclomatic complexityCyclomatic complexity
Cyclomatic complexity
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Software Engineering Fundamentals
Software Engineering FundamentalsSoftware Engineering Fundamentals
Software Engineering Fundamentals
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Windowforms controls c#
Windowforms controls c#Windowforms controls c#
Windowforms controls c#
 
Algorithm and pseudo codes
Algorithm and pseudo codesAlgorithm and pseudo codes
Algorithm and pseudo codes
 
Compilers
CompilersCompilers
Compilers
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Software design
Software designSoftware design
Software design
 
Programming Fundamental Presentation
Programming Fundamental PresentationProgramming Fundamental Presentation
Programming Fundamental Presentation
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 

Andere mochten auch

Andere mochten auch (6)

Notes on Debugging
Notes on DebuggingNotes on Debugging
Notes on Debugging
 
Debugging by induction
Debugging by inductionDebugging by induction
Debugging by induction
 
Debugging
DebuggingDebugging
Debugging
 
Debugging Debugging
Debugging DebuggingDebugging Debugging
Debugging Debugging
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
 
Software testing methods, levels and types
Software testing methods, levels and typesSoftware testing methods, levels and types
Software testing methods, levels and types
 

Ähnlich wie Debugging

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do itMartin Sykora
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-TestingMary Clemons
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsSteven Smith
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best PracticesJames York
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flexmichael.labriola
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debuggingsvilen.ivanov
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).pptjerlinS1
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...jeyasrig
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Dror Helper
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Qualityguest268ee8
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Developmentsatya sudheer
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!Thomas Peham
 
Stop fearing legacy code
Stop fearing legacy codeStop fearing legacy code
Stop fearing legacy codeYaki Koren
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Acquia
 

Ähnlich wie Debugging (20)

Testing & should i do it
Testing & should i do itTesting & should i do it
Testing & should i do it
 
5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing5-Ways-to-Revolutionize-Your-Software-Testing
5-Ways-to-Revolutionize-Your-Software-Testing
 
Cinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patternsCinci ug-january2011-anti-patterns
Cinci ug-january2011-anti-patterns
 
QA Best Practices
QA  Best PracticesQA  Best Practices
QA Best Practices
 
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in FlexassertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
 
Debugging
DebuggingDebugging
Debugging
 
The Art Of Debugging
The Art Of DebuggingThe Art Of Debugging
The Art Of Debugging
 
debugging (1).ppt
debugging (1).pptdebugging (1).ppt
debugging (1).ppt
 
An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...An important characteristic of a test suite that is computed by a dynamic ana...
An important characteristic of a test suite that is computed by a dynamic ana...
 
Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'Debugging with visual studio beyond 'F5'
Debugging with visual studio beyond 'F5'
 
Assessing Unit Test Quality
Assessing Unit Test QualityAssessing Unit Test Quality
Assessing Unit Test Quality
 
Preocupações Desenvolvedor Ágil
Preocupações Desenvolvedor ÁgilPreocupações Desenvolvedor Ágil
Preocupações Desenvolvedor Ágil
 
Test Drive Development
Test Drive DevelopmentTest Drive Development
Test Drive Development
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
PHP - Introduction to PHP Bugs - Debugging
PHP -  Introduction to  PHP Bugs - DebuggingPHP -  Introduction to  PHP Bugs - Debugging
PHP - Introduction to PHP Bugs - Debugging
 
6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!6 easy bug tracking tips & tricks every developer should know!
6 easy bug tracking tips & tricks every developer should know!
 
Stop fearing legacy code
Stop fearing legacy codeStop fearing legacy code
Stop fearing legacy code
 
Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)
 
Why Unit Testingl
Why Unit TestinglWhy Unit Testingl
Why Unit Testingl
 
Why unit testingl
Why unit testinglWhy unit testingl
Why unit testingl
 

Mehr von Jonathan Holloway

Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introductionJonathan Holloway
 
Application design for the cloud using AWS
Application design for the cloud using AWSApplication design for the cloud using AWS
Application design for the cloud using AWSJonathan Holloway
 
Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Jonathan Holloway
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flywayJonathan Holloway
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyJonathan Holloway
 

Mehr von Jonathan Holloway (11)

The Role of the Architect
The Role of the ArchitectThe Role of the Architect
The Role of the Architect
 
Spring boot - an introduction
Spring boot - an introductionSpring boot - an introduction
Spring boot - an introduction
 
Jenkins CI presentation
Jenkins CI presentationJenkins CI presentation
Jenkins CI presentation
 
Mockito intro
Mockito introMockito intro
Mockito intro
 
SOLID principles
SOLID principlesSOLID principles
SOLID principles
 
Application design for the cloud using AWS
Application design for the cloud using AWSApplication design for the cloud using AWS
Application design for the cloud using AWS
 
Building data pipelines
Building data pipelinesBuilding data pipelines
Building data pipelines
 
Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)Introduction to JVM languages and Fantom (very brief)
Introduction to JVM languages and Fantom (very brief)
 
Database migration with flyway
Database migration  with flywayDatabase migration  with flyway
Database migration with flyway
 
Lightweight web frameworks
Lightweight web frameworksLightweight web frameworks
Lightweight web frameworks
 
Introduction to using MongoDB with Ruby
Introduction to using MongoDB with RubyIntroduction to using MongoDB with Ruby
Introduction to using MongoDB with Ruby
 

Kürzlich hochgeladen

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Kürzlich hochgeladen (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

Debugging

  • 2. What is debugging? "Bug" and "debugging" are attributed to the discovery of a moth found in a Mark II computer at Harvard University. Debugging is not troubleshooting
  • 3. Debugging Rules... 1. Understand the system 2. Make it fail 3. Quit thinking and look 4. Divide and Conquer 5. Change one thing at a time 6. Keep an audit trail 7. Check the plug 8. Get a fresh view 9. If you didn't fix it, it aint fixed
  • 4. Debugging - A Simple Method a) Start | b) Construct a Hypothesis | c) Construct an Experiment | d) Hypothesis Proved? - goto b) | Need more evidence? - goto c) | Stop
  • 5. 1. Understanding the System Know the fundamentals of the system Understand the frameworks involved Read the API's and communication interfaces Know your tools Understand what each module of the system does
  • 6. 2. Make it Fail Start at the beginning Automate the failure No detail is insignificant Intermittent failures? Isolate the failure Build debugging tools and test harnesses
  • 7. 3. Quit thinking and look Gather the low level details and "see" the failure Understand the context of the bug Design instrumentation in: ●Runtime statistics ●Status messages ●Debug logging - be descriptive!!! ●Deployment time environment checks Hypothesise and test
  • 8. 4. Divide and Conquer Narrow the search down, software AND hardware. Successive approximation. Start at the bad end (e.g. the error log) and work your way up the chain looking at the various points on the way Fix the bugs you know about - fixing one could fix the other Fix the noise first, but don't go nuts
  • 9. 5. Change one thing at a time Compare with a good one ! Use a rifle not a shotgun What's changed recently, it used to work! Separate environment and product
  • 10. 6. Keep an audit trail Keep a day book of what you did During debugging write down... 1.What you did... 2.In what order... 3.And what happened! Be specific and consistent Correlate symptoms with others Version control and change logs are great for determining an audit trail of what's changed
  • 11. 7. Check the plug Question your assumptions
  • 12. 8. Get a Fresh View Get another viewpoint on the solution Talk to somebody about the problem Ask an expert: ●Email the author ●Check the forums ●Subscribe to the mailing list Make sure you report symptoms not theories
  • 13. 9. If you didn't fix it, it aint fixed! The most important lesson by far... ●Fix the root cause ●Make sure it can't possibly happen again ●Fix the process at fault "We didn't see an issue until we deployed into the production environment" = Deploy early and deploy often
  • 15. Debugging Methods Print/Trace Debugging - watching the flow of execution after adding print statements to the original code Remote Debugging - connect to a remote system with a debugger, monitor the execution and state Post Mortem Debugging - analysis of a memory dump from a program that has crashed Profiling - not debugging per se, but a useful technique for analysing a running program to look for issues
  • 16. Lesser Known (?) Debugging Methods Rubber Ducking - explaining your problem to someone else. Stating the problem aloud in order to work it out. Failfirst - Write a unit test that exposes the failure, correct the code and make it pass Saff Squeeze - Write a system test, inline code, write test, repeat until fixed http://www.threeriversinstitute.org/HitEmHighHitEmLow.html Chaos Monkey - AWS Netflix approach - randomly kill and test areas. Fail consistently to test fault tolerant software. http://www.codinghorror.com/blog/2011/04/working-with-the-chaos-monkey.html
  • 17. Eclipse Debugging 1 Set breakpoints in the code Step into, over, return Watches - display a variable value Hit counts Setting an exception breakpoint Setting a method breakpoint
  • 18. Eclipse Debugging 2 Class load breakpoint Using display after a breakpoint has been hit Attaching a remote debugger via a JDB agent
  • 19. Bug Taxonomies and Bug Types There are ways to categorise bugs... lots of taxonomies available from research literature Some bug types include: ●Bohrbug - bug that manifests itself consistently under a set of conditions ●Heisenbug - bug that alters its' characteristics when studied
  • 20. Preventing Bugs Debugging is hard and expensive in terms of fixing the bug, testing it and re-deploying it... We can try and prevent bugs with: ●Code Review ●Defensive Programming ●Precondition, postcondition and invariant checking ●Assertions
  • 21. Further Resources ●Debugging - The 9 Indispensable Rules for Finding Even The Most Elusive Software and Hardware Problems - David Agans ●Debug It! : Find, Repair and Prevent Bugs in Your Code (Pragmatic Programmers) - Paul Butcher ●Testing Education - http://www.testingeducation.org/a/bugtax.pdf ●Lars Vogels Debugging Overview (2011) - http://www.vogella.de/articles/EclipseDebugging/artic