SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
1/20
Outline Introduction Debugging Common Acronymes
Debugging
Debugging with NetBeans IDE
Andreas Ruppen
andreas.ruppen@unifr.ch
University of Fribourg
Department of Informatics
Software Engineering Group
April 18, 2014
2/20
Outline Introduction Debugging Common Acronymes
1 Introduction
2 Debugging
3 Common Acronymes
3/20
Outline Introduction Debugging Common Acronymes
Generalities I
Definition (Debugging)
Debugging is the process of identifying and eliminating bugs in
a software system. Debugging can be a quite complex process
especially when systems are distributed, deployed or tightly
coupled.
Generalities
In general debugging is done with the aid of some software.
This is what we call interactive debugging. This software can
control the program flow, watch log files or memory dumps and
much more.
4/20
Outline Introduction Debugging Common Acronymes
Generalities II
Origin (Wikipedia)
The terms "bug" and "debugging" are both popularly attributed
to Admiral Grace Hopper in the 1940s. While she was working
on a Mark II Computer at Harvard University, her associates
discovered a moth stuck in a relay and thereby impeding
operation, whereupon she remarked that they were "debugging"
the system. However the term "bug" in the meaning of technical
error dates back at least to 1878 and Thomas Edison.
5/20
Outline Introduction Debugging Common Acronymes
Generalities III
Figure : First Bug (from wikipedia.org)
6/20
Outline Introduction Debugging Common Acronymes
Difficulties I
The debugging skills of the programmer are a major factor
when it comes to eliminating bugs.
Software tends to become more and more complex which
makes debugging harder.
Mobile devices also introduces new challenges for
debugging. The code is run and developed on different
machines.
High-level languages such as Java are easier to debug
than low level languages like C.
Bugs may occur through memory corruption which is
difficult to track. This comes from the fact that the thrown
error is not necessary the origin of the problem.
7/20
Outline Introduction Debugging Common Acronymes
Types of Debugging
Interactive Debugging Software
Debugging software monitors the flow of the program. It can
also modify this flow, inspect and change attribute values,
pausing the execution at predefined locations, influence the
outcome of branches and switch statements etc. . .
Static Debugging Software
Instead of running the software and closely observe its
execution, some tools look statically at the code to identify
potential problems. These static code analysis tools come
handy to identify problems which are hard to reproduce like
memory leaks. It is most useful to pinpoint erroneous pointers,
infinite recursive structures.
8/20
Outline Introduction Debugging Common Acronymes
Debugging techniques I
for interactive debugging
A first step in debugging is to reproduce the problem. This
sounds trivial but can become quite complex in the case of
memory leaks, distributed systems, multithreaded systems
etc. . . A good bug report always includes the precise steps
to reproduce the problem.
Once the problem reproduced, to make debugging easier,
the input is simplified (the bug could come from a too large
input file for example, if the smaller file passes the problem
is found). These simplifications are the most time made
manually (divide-and-conquer). Smaller input also allows
faster debugging (think of a large for-loop iterating over
each line of a file).
9/20
Outline Introduction Debugging Common Acronymes
Debugging techniques II
for interactive debugging
From this point on, a developer has several choices to
precisely identify the problem:
He can use a debugging tool (like gdb or one integrated in
the IDE) to examine the memory and the local variables at
some interesting points of the program.
Another method is to use tracing (think about last weeks
logging).
Post-mortem debugging, which consists of memory dump
analysis
Remote debugging for deployed applications.
10/20
Outline Introduction Debugging Common Acronymes
Debugging in NetBeans IDE
Use Case
What is debugging?
Run through the code with the interpreter.
Allows to see whether the execution path is as expected.
Using the Debugger
We can use the debugger:
to verify if a programm behaves as we except.
to identify the nature of a runtime-error.
to force the programm entering a given state.
11/20
Outline Introduction Debugging Common Acronymes
Debugging in NetBeans IDE
Howto
Fist steps
Open a project in NetBeans IDE.
Define the Breakpoints at some interesting points.
Start the Debugger
Debugging mode
Runs the code with the Java virtual machine.
Everything that is possible in normal mode, should also be
possible in debugging mode.
Execution stops for user action at the defined breakpoints.
12/20
Outline Introduction Debugging Common Acronymes
Breakpoints I
Defining Breakpoints
Definition (Breakpoint)
A Breakpoint is an indication for the Java Debugger. They are
ignored by the Java virtual machine when running in normal
mode. However when running in debug mode, the execution
stops at every breakpoint and waits for a user action before it
continues to the next break points.
13/20
Outline Introduction Debugging Common Acronymes
Breakpoints II
Defining Breakpoints
Actions
When the execution of the programm stops at a breakpoint
following actions are possible:
Inspection or modification of dynamic variables.
Step-by-step execution.
Go to the next breakpoint (or to the end of the application if
there are no more breakpoints).
14/20
Outline Introduction Debugging Common Acronymes
Breakpoints in NetBeans IDE
Defining breakpoints
Example (Usage)
Define a Breakpoint by
clicking on the
corresponding line.
The line number is
replaced by a red
square.
It’s not possible to define
breakpoints on non
executable lines (i.e.
commentary lines)
15/20
Outline Introduction Debugging Common Acronymes
Running the Debugger
The ANT way
Debug Target
The ANT file which comes with the exercises provides a
debug target.
This target can be launched manually (by right clicking on
the build.xml file in NetBeans IDE).
It is possible to launch the debugger from command line
with the following arguments
1 −Xrunjdwp : transport =dt_socket , server=y , suspend=n , address=5432
which makes it listening on port 5432 for a debugging tool
like the one integrated in NetBeans IDE.
16/20
Outline Introduction Debugging Common Acronymes
Running the Debugger
The NetBeans IDE way
Debugging with and IDE
It is possible (and even recommended) to do the
debugging tasks directly from the IDE.
NetBeans IDE offers a great debugging support.
To launch the debugger, either click the debug icon in the
launch bar (the 6th one), or select the debug target from
the ANT script or select debug from the right click on the
project.
Once started the program starts as normal but the
execution stops at the first breakpoint.
17/20
Outline Introduction Debugging Common Acronymes
The debugging console
NetBeans IDE layout
When the debugger is
started in NetBeans IDE
a new tab becomes
visible.
This tab is updated on
each step of the
debugger.
It shows the value of all fields of the current class.
Besides inspecting the value of each field, it is also
possible to change them.
18/20
Outline Introduction Debugging Common Acronymes
Using the NetBeans IDE Debugger
Associated GUI Elements
When the debugger stops
on a line, this line is
highlighted green.
All other debugging GUI elements relate to this line or the
class containing this line.
19/20
Outline Introduction Debugging Common Acronymes
Using the NetBeans IDE Debugger
Associated GUI Elements
When everyhting seems ok to continue, NetBeans IDE offers
several buttons for going on:
Stop (the debugger)
Pause
Continue (to next
Breakpoint)
Step Over
Step over Expression
Step into
Step out
Run to cursor
Apply Code Change
Take GUI Snapshot
20/20
Outline Introduction Debugging Common Acronymes
Used acronyms
IDE Integrated Development Environment
gdb GNU Debugger
GNU GNU is not Unix

Contenu connexe

Tendances

Software Quality Assurance in software engineering
Software Quality Assurance in software engineeringSoftware Quality Assurance in software engineering
Software Quality Assurance in software engineeringMuhammadTalha436
 
Software Configuration Management
Software Configuration ManagementSoftware Configuration Management
Software Configuration ManagementPratik Tandel
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing FundamentalsChankey Pathak
 
Software testing
Software testingSoftware testing
Software testingAshu Bansal
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | EdurekaEdureka!
 
Test link jira soap integration
Test link jira soap integrationTest link jira soap integration
Test link jira soap integrationErol Selitektay
 
Bug tracking system(synopsis)
Bug tracking system(synopsis)Bug tracking system(synopsis)
Bug tracking system(synopsis)happiness09
 
Bug reporting and tracking
Bug reporting and trackingBug reporting and tracking
Bug reporting and trackingVadym Muliavka
 
Software testing life cycle
Software testing life cycleSoftware testing life cycle
Software testing life cycleGaruda Trainings
 
Regression testing
Regression testingRegression testing
Regression testingMohua Amin
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assuranceRizky Munggaran
 
Software Testing Process
Software Testing ProcessSoftware Testing Process
Software Testing Processguest1f2740
 
What is Web Testing?
What is Web Testing?   What is Web Testing?
What is Web Testing? QA InfoTech
 
Types of software testing
Types of software testingTypes of software testing
Types of software testingPrachi Sasankar
 

Tendances (20)

Severity and Priority
Severity and PrioritySeverity and Priority
Severity and Priority
 
Software Quality Assurance in software engineering
Software Quality Assurance in software engineeringSoftware Quality Assurance in software engineering
Software Quality Assurance in software engineering
 
Software Configuration Management
Software Configuration ManagementSoftware Configuration Management
Software Configuration Management
 
Software Testing Fundamentals
Software Testing FundamentalsSoftware Testing Fundamentals
Software Testing Fundamentals
 
Software testing
Software testingSoftware testing
Software testing
 
What is Integration Testing? | Edureka
What is Integration Testing? | EdurekaWhat is Integration Testing? | Edureka
What is Integration Testing? | Edureka
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Software Testing
Software TestingSoftware Testing
Software Testing
 
Test link jira soap integration
Test link jira soap integrationTest link jira soap integration
Test link jira soap integration
 
Code review
Code reviewCode review
Code review
 
Bug tracking system(synopsis)
Bug tracking system(synopsis)Bug tracking system(synopsis)
Bug tracking system(synopsis)
 
Bug reporting and tracking
Bug reporting and trackingBug reporting and tracking
Bug reporting and tracking
 
Software testing life cycle
Software testing life cycleSoftware testing life cycle
Software testing life cycle
 
Code Review
Code ReviewCode Review
Code Review
 
Regression testing
Regression testingRegression testing
Regression testing
 
Software quality assurance
Software quality assuranceSoftware quality assurance
Software quality assurance
 
Software Testing Process
Software Testing ProcessSoftware Testing Process
Software Testing Process
 
What is Web Testing?
What is Web Testing?   What is Web Testing?
What is Web Testing?
 
Types of software testing
Types of software testingTypes of software testing
Types of software testing
 
Defect Life Cycle
Defect Life CycleDefect Life Cycle
Defect Life Cycle
 

Similaire à Debugging with NetBeans IDE

debuggingSession.pptx
debuggingSession.pptxdebuggingSession.pptx
debuggingSession.pptxmarawanwael
 
Gui based debuggers
Gui based debuggers Gui based debuggers
Gui based debuggers Mysa Vijay
 
Debuggers in system software
Debuggers in system softwareDebuggers in system software
Debuggers in system softwaregayathri ravi
 
How to debugging
How to debuggingHow to debugging
How to debuggingSiya Lee
 
Reverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsReverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsEran Goldstein
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
The pragmatic programmer
The pragmatic programmerThe pragmatic programmer
The pragmatic programmerLeylimYaln
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5Alok Jain
 
WhitePaperTemplate
WhitePaperTemplateWhitePaperTemplate
WhitePaperTemplateJo Marques
 
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
 
Anti-Debugging - A Developers View
Anti-Debugging - A Developers ViewAnti-Debugging - A Developers View
Anti-Debugging - A Developers ViewTyler Shields
 
UNIT 3.1 INTRODUCTON TO IDA.ppt
UNIT 3.1 INTRODUCTON TO IDA.pptUNIT 3.1 INTRODUCTON TO IDA.ppt
UNIT 3.1 INTRODUCTON TO IDA.pptManjuAppukuttan2
 

Similaire à Debugging with NetBeans IDE (20)

debuggingSession.pptx
debuggingSession.pptxdebuggingSession.pptx
debuggingSession.pptx
 
Gui based debuggers
Gui based debuggers Gui based debuggers
Gui based debuggers
 
Debuggers in system software
Debuggers in system softwareDebuggers in system software
Debuggers in system software
 
Debugging
DebuggingDebugging
Debugging
 
Ss debuggers
Ss debuggersSs debuggers
Ss debuggers
 
How to debugging
How to debuggingHow to debugging
How to debugging
 
Reverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentalsReverse engineering – debugging fundamentals
Reverse engineering – debugging fundamentals
 
Jdj Foss Java Tools
Jdj Foss Java ToolsJdj Foss Java Tools
Jdj Foss Java Tools
 
Debugging in .Net
Debugging in .NetDebugging in .Net
Debugging in .Net
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
The pragmatic programmer
The pragmatic programmerThe pragmatic programmer
The pragmatic programmer
 
PROBLEM SOLVING
PROBLEM SOLVINGPROBLEM SOLVING
PROBLEM SOLVING
 
Stnotes doc 5
Stnotes doc 5Stnotes doc 5
Stnotes doc 5
 
WhitePaperTemplate
WhitePaperTemplateWhitePaperTemplate
WhitePaperTemplate
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
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...
 
Anti-Debugging - A Developers View
Anti-Debugging - A Developers ViewAnti-Debugging - A Developers View
Anti-Debugging - A Developers View
 
Debugging
DebuggingDebugging
Debugging
 
UNIT 3.1 INTRODUCTON TO IDA.ppt
UNIT 3.1 INTRODUCTON TO IDA.pptUNIT 3.1 INTRODUCTON TO IDA.ppt
UNIT 3.1 INTRODUCTON TO IDA.ppt
 

Plus de Andreas Ruppen

A component based architecture for the Web of Things
A component based architecture for the Web of ThingsA component based architecture for the Web of Things
A component based architecture for the Web of ThingsAndreas Ruppen
 
Thesis Defence: A Model Driven Architecture for the Web of Things
Thesis Defence: A Model Driven Architecture for the Web of ThingsThesis Defence: A Model Driven Architecture for the Web of Things
Thesis Defence: A Model Driven Architecture for the Web of ThingsAndreas Ruppen
 
A Model-Driven, Component Generation Approach for the Web of Things
A Model-Driven, Component Generation Approach for the Web of ThingsA Model-Driven, Component Generation Approach for the Web of Things
A Model-Driven, Component Generation Approach for the Web of ThingsAndreas Ruppen
 
A proof of concept implementation of a secure e-commerce authentication scheme
A proof of concept implementation of a secure e-commerce authentication schemeA proof of concept implementation of a secure e-commerce authentication scheme
A proof of concept implementation of a secure e-commerce authentication schemeAndreas Ruppen
 
A model-driven, component generation approach for the xWoT
A model-driven, component generation approach for the xWoTA model-driven, component generation approach for the xWoT
A model-driven, component generation approach for the xWoTAndreas Ruppen
 
An Approach for a Mutual Integration of the WoT with Business Processes
An Approach for a Mutual Integration of the WoT with Business ProcessesAn Approach for a Mutual Integration of the WoT with Business Processes
An Approach for a Mutual Integration of the WoT with Business ProcessesAndreas Ruppen
 
A WoT Approach to eHealth
A WoT Approach to eHealthA WoT Approach to eHealth
A WoT Approach to eHealthAndreas Ruppen
 
A RESTful architecture for integrating decomposable delayed services within t...
A RESTful architecture for integrating decomposable delayed services within t...A RESTful architecture for integrating decomposable delayed services within t...
A RESTful architecture for integrating decomposable delayed services within t...Andreas Ruppen
 

Plus de Andreas Ruppen (10)

A component based architecture for the Web of Things
A component based architecture for the Web of ThingsA component based architecture for the Web of Things
A component based architecture for the Web of Things
 
Thesis Defence: A Model Driven Architecture for the Web of Things
Thesis Defence: A Model Driven Architecture for the Web of ThingsThesis Defence: A Model Driven Architecture for the Web of Things
Thesis Defence: A Model Driven Architecture for the Web of Things
 
Presentation evrythng
Presentation evrythngPresentation evrythng
Presentation evrythng
 
A Model-Driven, Component Generation Approach for the Web of Things
A Model-Driven, Component Generation Approach for the Web of ThingsA Model-Driven, Component Generation Approach for the Web of Things
A Model-Driven, Component Generation Approach for the Web of Things
 
A proof of concept implementation of a secure e-commerce authentication scheme
A proof of concept implementation of a secure e-commerce authentication schemeA proof of concept implementation of a secure e-commerce authentication scheme
A proof of concept implementation of a secure e-commerce authentication scheme
 
A model-driven, component generation approach for the xWoT
A model-driven, component generation approach for the xWoTA model-driven, component generation approach for the xWoT
A model-driven, component generation approach for the xWoT
 
REST and eHealth
REST and eHealthREST and eHealth
REST and eHealth
 
An Approach for a Mutual Integration of the WoT with Business Processes
An Approach for a Mutual Integration of the WoT with Business ProcessesAn Approach for a Mutual Integration of the WoT with Business Processes
An Approach for a Mutual Integration of the WoT with Business Processes
 
A WoT Approach to eHealth
A WoT Approach to eHealthA WoT Approach to eHealth
A WoT Approach to eHealth
 
A RESTful architecture for integrating decomposable delayed services within t...
A RESTful architecture for integrating decomposable delayed services within t...A RESTful architecture for integrating decomposable delayed services within t...
A RESTful architecture for integrating decomposable delayed services within t...
 

Dernier

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 

Dernier (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 

Debugging with NetBeans IDE

  • 1. 1/20 Outline Introduction Debugging Common Acronymes Debugging Debugging with NetBeans IDE Andreas Ruppen andreas.ruppen@unifr.ch University of Fribourg Department of Informatics Software Engineering Group April 18, 2014
  • 2. 2/20 Outline Introduction Debugging Common Acronymes 1 Introduction 2 Debugging 3 Common Acronymes
  • 3. 3/20 Outline Introduction Debugging Common Acronymes Generalities I Definition (Debugging) Debugging is the process of identifying and eliminating bugs in a software system. Debugging can be a quite complex process especially when systems are distributed, deployed or tightly coupled. Generalities In general debugging is done with the aid of some software. This is what we call interactive debugging. This software can control the program flow, watch log files or memory dumps and much more.
  • 4. 4/20 Outline Introduction Debugging Common Acronymes Generalities II Origin (Wikipedia) The terms "bug" and "debugging" are both popularly attributed to Admiral Grace Hopper in the 1940s. While she was working on a Mark II Computer at Harvard University, her associates discovered a moth stuck in a relay and thereby impeding operation, whereupon she remarked that they were "debugging" the system. However the term "bug" in the meaning of technical error dates back at least to 1878 and Thomas Edison.
  • 5. 5/20 Outline Introduction Debugging Common Acronymes Generalities III Figure : First Bug (from wikipedia.org)
  • 6. 6/20 Outline Introduction Debugging Common Acronymes Difficulties I The debugging skills of the programmer are a major factor when it comes to eliminating bugs. Software tends to become more and more complex which makes debugging harder. Mobile devices also introduces new challenges for debugging. The code is run and developed on different machines. High-level languages such as Java are easier to debug than low level languages like C. Bugs may occur through memory corruption which is difficult to track. This comes from the fact that the thrown error is not necessary the origin of the problem.
  • 7. 7/20 Outline Introduction Debugging Common Acronymes Types of Debugging Interactive Debugging Software Debugging software monitors the flow of the program. It can also modify this flow, inspect and change attribute values, pausing the execution at predefined locations, influence the outcome of branches and switch statements etc. . . Static Debugging Software Instead of running the software and closely observe its execution, some tools look statically at the code to identify potential problems. These static code analysis tools come handy to identify problems which are hard to reproduce like memory leaks. It is most useful to pinpoint erroneous pointers, infinite recursive structures.
  • 8. 8/20 Outline Introduction Debugging Common Acronymes Debugging techniques I for interactive debugging A first step in debugging is to reproduce the problem. This sounds trivial but can become quite complex in the case of memory leaks, distributed systems, multithreaded systems etc. . . A good bug report always includes the precise steps to reproduce the problem. Once the problem reproduced, to make debugging easier, the input is simplified (the bug could come from a too large input file for example, if the smaller file passes the problem is found). These simplifications are the most time made manually (divide-and-conquer). Smaller input also allows faster debugging (think of a large for-loop iterating over each line of a file).
  • 9. 9/20 Outline Introduction Debugging Common Acronymes Debugging techniques II for interactive debugging From this point on, a developer has several choices to precisely identify the problem: He can use a debugging tool (like gdb or one integrated in the IDE) to examine the memory and the local variables at some interesting points of the program. Another method is to use tracing (think about last weeks logging). Post-mortem debugging, which consists of memory dump analysis Remote debugging for deployed applications.
  • 10. 10/20 Outline Introduction Debugging Common Acronymes Debugging in NetBeans IDE Use Case What is debugging? Run through the code with the interpreter. Allows to see whether the execution path is as expected. Using the Debugger We can use the debugger: to verify if a programm behaves as we except. to identify the nature of a runtime-error. to force the programm entering a given state.
  • 11. 11/20 Outline Introduction Debugging Common Acronymes Debugging in NetBeans IDE Howto Fist steps Open a project in NetBeans IDE. Define the Breakpoints at some interesting points. Start the Debugger Debugging mode Runs the code with the Java virtual machine. Everything that is possible in normal mode, should also be possible in debugging mode. Execution stops for user action at the defined breakpoints.
  • 12. 12/20 Outline Introduction Debugging Common Acronymes Breakpoints I Defining Breakpoints Definition (Breakpoint) A Breakpoint is an indication for the Java Debugger. They are ignored by the Java virtual machine when running in normal mode. However when running in debug mode, the execution stops at every breakpoint and waits for a user action before it continues to the next break points.
  • 13. 13/20 Outline Introduction Debugging Common Acronymes Breakpoints II Defining Breakpoints Actions When the execution of the programm stops at a breakpoint following actions are possible: Inspection or modification of dynamic variables. Step-by-step execution. Go to the next breakpoint (or to the end of the application if there are no more breakpoints).
  • 14. 14/20 Outline Introduction Debugging Common Acronymes Breakpoints in NetBeans IDE Defining breakpoints Example (Usage) Define a Breakpoint by clicking on the corresponding line. The line number is replaced by a red square. It’s not possible to define breakpoints on non executable lines (i.e. commentary lines)
  • 15. 15/20 Outline Introduction Debugging Common Acronymes Running the Debugger The ANT way Debug Target The ANT file which comes with the exercises provides a debug target. This target can be launched manually (by right clicking on the build.xml file in NetBeans IDE). It is possible to launch the debugger from command line with the following arguments 1 −Xrunjdwp : transport =dt_socket , server=y , suspend=n , address=5432 which makes it listening on port 5432 for a debugging tool like the one integrated in NetBeans IDE.
  • 16. 16/20 Outline Introduction Debugging Common Acronymes Running the Debugger The NetBeans IDE way Debugging with and IDE It is possible (and even recommended) to do the debugging tasks directly from the IDE. NetBeans IDE offers a great debugging support. To launch the debugger, either click the debug icon in the launch bar (the 6th one), or select the debug target from the ANT script or select debug from the right click on the project. Once started the program starts as normal but the execution stops at the first breakpoint.
  • 17. 17/20 Outline Introduction Debugging Common Acronymes The debugging console NetBeans IDE layout When the debugger is started in NetBeans IDE a new tab becomes visible. This tab is updated on each step of the debugger. It shows the value of all fields of the current class. Besides inspecting the value of each field, it is also possible to change them.
  • 18. 18/20 Outline Introduction Debugging Common Acronymes Using the NetBeans IDE Debugger Associated GUI Elements When the debugger stops on a line, this line is highlighted green. All other debugging GUI elements relate to this line or the class containing this line.
  • 19. 19/20 Outline Introduction Debugging Common Acronymes Using the NetBeans IDE Debugger Associated GUI Elements When everyhting seems ok to continue, NetBeans IDE offers several buttons for going on: Stop (the debugger) Pause Continue (to next Breakpoint) Step Over Step over Expression Step into Step out Run to cursor Apply Code Change Take GUI Snapshot
  • 20. 20/20 Outline Introduction Debugging Common Acronymes Used acronyms IDE Integrated Development Environment gdb GNU Debugger GNU GNU is not Unix