Smarter Debugging in the IDE

Smarter Debugging in the IDE

DevoxxUK, London

363cf27411356afc37199a73bb58bcfe?s=128

Rabea Gransberger

May 11, 2018
Tweet

Transcript

  1. #Debugging @rgransberger Smarter debugging in the IDE Rabea Gransberger @rgransberger

    https://rgra.github.io
  2. Rabea Gransberger • Computer Science Diploma 2008 • Java Developer,

    Project Lead at MEKOS, Germany • Java Champion • Organization Team JUG Bremen, JCrete, JAlba 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger) By Karte: NordNordWest, Lizenz: Creative Commons by-sa-3.0 de, CC BY-SA 3.0 de, https://commons.wikimedia.org/w/index.php?curid=35392837
  3. Definition • Debugging is the process of finding and resolving

    defects or problems within a computer program that prevent correct operation of computer software or a system. • Debugging tactics can involve interactive debugging, control flow analysis, unit testing, integration testing, log file analysis, monitoring at the application or system level, memory dumps, and profiling. https://en.wikipedia.org/wiki/Debugging 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  4. History 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)

  5. 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger) https://upload.wikimedia.org/wikipedia/commons/8/8a/H96566k.jpg By Courtesy

    of the Naval Surface Warfare Center, Dahlgren, VA., 1988. [Public domain], via Wikimedia Commons
  6. Thomas Edison, letter to an associate, Nov 1878: It has

    been just so in all of my inventions. The first step is an intuition, and comes with a burst, then difficulties arise—this thing gives out and [it is] then that "Bugs"—as such little faults and difficulties are called—show themselves and months of intense watching, study and labor are requisite before commercial success or failure is certainly reached. Edison to Puskas, 13 November 1878, Edison papers, Edison National Laboratory, U.S. National Park Service, West Orange, N.J., cited in Hughes, Thomas Parke (1989). American Genesis: A Century of Invention and Technological Enthusiasm, 1870- 1970. Penguin Books. p. 75. ISBN 978-0-14-009741-2. 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  7. Demo 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)

  8. Steps • Reproduce Problem • Reduce Problem Size • Debug

    • Unit Test to prevent reappearance 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  9. Techniques • Interactive debugging • Print debugging (or tracing) •

    Remote debugging • Post-mortem debugging • using dumps etc. 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  10. Preventing Bugs • Code Reviews • Static Analysis • Flow

    analysis 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  11. Breakpoint Targets • Field (access/modification) • Class • Constructor •

    Method • Line • Exceptions (caught/uncaught) • On libraries without source, use the outline view context menu to set breakpoints 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  12. Breakpoint Types/Properties • Enable/Disable • Conditional breakpoint • Filter •

    Tracing/Logging • Auto Disable • Hit/Pass Count • Trigger points/disable until • Suspend when value changes • Suspend VM/Thread • Create own Expressions 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  13. Debug Controls • Pause/Continue • Stop in main • Step

    into • Step over • Step return • Run to Line • Drop to Frame 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  14. IDE Debug Extras • Change value • Hover to show

    value • Inspect • Display in Debug Shell • Show variable values when debugging 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  15. Debug View Options • Show Monitors • Show Threads/Thread Groups

    • Own formatter • Show references • Show Instance ID • Show Actual/Declared Type 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  16. Step filters 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger) •

    Filter simple getters • Filter simple setters • Filter constructors • Filter static initializers • Filter synthetic methods • Filter ClassLoader • Filter certain packages
  17. Stream Tracing 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)

  18. Links 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)

  19. IDE Tutorials • IntelliJ Java Debugging Deep Dive • Eclipse

    Tips & Tricks Debugging 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  20. Eclipse Code Mining • https://github.com/angelozerr/jdt-codemining 11.05.2018 DevoxxUK / Debugging (Rabea

    Gransberger @rgransberger)
  21. Remote Debugging • A Practical Guide to Java Remote Debugging

    • Java Remote Debugging in the Real World 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  22. Console • jdb - The Java Debugger 11.05.2018 DevoxxUK /

    Debugging (Rabea Gransberger @rgransberger)
  23. API • Writing your own debugger • Java™ Debug Interface

    11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  24. Tools • https://dzone.com/articles/the-state-of-debugging-in-java • https://www.infoq.com/articles/Advanced-Java-Debugging- Techniques • https://blog.takipi.com/java-debugger-the-definitive-list-of-tools/ • https://www.hascode.com/2018/04/analyzing-java-problems-tools-

    snippets-and-workflows/ 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  25. The best debugger ever made is a good night's sleep.

    @SashaLaundy 19:19 - 1. Dec. 2017 https://twitter.com/sashalaundy/status/936661004137635840 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)
  26. Q & A Slides: https://speakerdeck.com/rgra/smarter-debugging-in-the-ide Code: https://github.com/rgra/io.github.rgra.debug Twitter: @rgransberger (DMs

    open) Feedback Welcome! 11.05.2018 DevoxxUK / Debugging (Rabea Gransberger @rgransberger)