d e b u g g in g j a v a w ith e clip seleveraging the eclipse ecosystem | © 2005 bill dudney |...

Post on 24-Feb-2020

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging Java With Eclipse

Killing Bugs in your Java Code with the Eclipse Debugger

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Agenda

Debugging

Debugging Perspective

Debugging Java Applications

Debugging Remotely

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging

Jargon - shotgun debugging n. the making of relatively undirected changes to software in the hope that a bug will be perturbed out of existence. This almost never works, and usually introduces more bugs.

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging

Reference.com - debugging: To search for and eliminate malfunctioning elements or errors in: debug a spacecraft before launch; debug a computer program.

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging

Wikipedia - Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another.

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Good Old Days

GDB - C/C++/Objective-C

other GNU languages as well

Command line - but very powerful

Cool theme song :-)

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Bad Old Days

JDB

painful to use, slow, not very feature rich

Logging was easier

Thus everyone went to logging

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Agenda

Debugging

Debugging Perspective

Debugging Java Applications

Debugging Remotely

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging Perspective

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Debugging View

View threads

Start/Stop/Pause the program

Step through your program

Controlling the VM

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Variables View

View any value in your application

See the state of your app

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Breakpoints View

Edit Breakpoints

Manipulate Breakpoints

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Breakpoint Properties

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Expressions View

View Variables

Examine Program State

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Display View

Manipulate Variables

Manipulate Program State

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Agenda

Debugging

Debugging Perspective

Debugging Java Applications

Debugging Remotely

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Methodical

Test Driven Development

Unit Testing

Developer Testing

Good Requirements Definition

Use Cases lead to Test Cases

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Setting Breakpoints

Line

Method

Class load

Exception

Watch Point

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Setting Line Breakpoints

Double Click in the margin

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Setting Method Breakpoints

Double Click in the margin

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Method Breakpoint Properties

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Class Loading Breakpoints

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Exception Breakpoints

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Watch Point Breakpoints

Double Click in the margin on a field

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Watch Point Properties

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Enough Presentation Lets Debug

JUnit Test

Drives code

helps find bugs

control over execution

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Agenda

Debugging

Debugging Perspective

Debugging Java Applications

Debugging Remotely

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Remote Debugging

Get VM listening for connections

-Xdebug - start and listen

-Xrunjdwp:args

Example-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8111,suspend=n

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Enough Presentation Lets Debug

Cactus Test

Drives code

helps find bugs

control over execution

Leveraging the Eclipse Ecosystem | © 2005 Bill Dudney | Made available under the EPL 1.0

Conclusion

IDE Debuggers are powerful and full featured

Stop Logging

Remote Debugging

Works like a champ and prevents costly redeploys to add logging statements

top related