java debugging tips @oredev

Post on 29-Jan-2018

112 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Martin Skarsaune

Senior Developer and Co-Owner@MSkarsaune

Java

Debugging

Tips

高馬丁

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

Frames + threads Variables Watches ?

Test

Results?

Console Display ?

Code

Frames + threads Test

Results?Variables + watchesConsole

Code

1. Should you always launch in debug mode?

IMHO: Always Launch in

Debug Mode!

• Ability to halt and troubleshoot

• Threads

• Hot code replacement

• Consider launching externally

Excecution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

2. Evaluating Code

Step Out- Code Evaluation

• Both in Java editor and free form

• Nothing is private

• Watches

• In breakpoints

• Nested evaluations / breaks

• Scrapbook

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

3. Controlling your steps

and Breaks

Step OUt- Controlling your

steps and breaks

• Step filters

• Frame filters

• Smart stepping

• Lambda stepping and breakpoints

• Exception breakpoints

– Break after

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

4. Manipulating Code

Flow

Step Out- Manipulating Flow

• Drop to frame

• Modify values – nothing is really final

• Force return

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

5. Tracking Classes

Step Out - Tracking Classes

• Class load breakpoints

• Static initializers

• All instances and count

6. Tracking Objects

SteP Out- Track Objects

• Instance initializers + default constructor

• Unique Id + Labelling objects

• Watch points + instance filter

• Tracking references

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing the debugger

• Debugging concurrent code

7. Customizing the

DEbugger

Quick Recap - Customizing

the debugger

• Detail Formatters / Data Type Renderers

• Logical Structures

Execution Order

• Code evaluation

• Controlling your steps and breaks

• Manipulating code flow

• Tracking classes and objects

• Customizing renderers

• Debugging concurrent code

8. Dealing With

Concurrency

Step Out- concurrency

• Instance and thread filters on breakpoints

• Step resume

• Analyzing deadlocks

References

10. REferences

• IDE documentation

• Debugging in IDEA 2016.1

https://www.youtube.com/watch?v=VdBsUv4lnm4

• jDays 2016: ”JVM Debugging under the hood”:

https://www.youtube.com/watch?v=lNR4bEzYaH4

• The mysterious life of developers:

https://www.youtube.com/watch?v=Ey3Ix7QuKPs

Final

Questio

ns

?

Thank you for

your time!

APPLAUS?

top related