Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction of Tools for providing rich user e...

Avatar for Naoto Ono Naoto Ono
September 08, 2022
3

Introduction of Tools for providing rich user experience in debugger

Avatar for Naoto Ono

Naoto Ono

September 08, 2022
Tweet

Transcript

  1. Naoto ONO • Developer Productivity Group at CyberAgent, Inc. •

    ruby/debug (debug.gem) contributor ◦ Chrome Integration ◦ Test framework • GitHub: @ono-max
  2. debug.gem • Ruby standard library for debugger from 3.1 •

    High performance compared to existing debuggers. • You can debug Ruby program with the following tools: ◦ rdbg (CLI) ◦ VS Code ◦ Chrome DevTools ◦ Neovim ◦ …
  3. Let’s know what part of this talk you should focus

    • This talk consists of two sessions • From now, you’ll answer some yes/no questions, then you’ll know which part to concentrate on the session 1, or session 2
  4. ??? ??? ??? Do you use debug.gem? Do you use

    VS Code when debugging a program? YES NO YES NO
  5. Session 2 Do you use debug.gem? Do you use VS

    Code when debugging a program? YES NO YES NO Session 1 Session 1
  6. Session 2 Do you use debug.gem? Do you use VS

    Code when debugging a program? YES NO YES NO Session 1 Session 1 I’ll talk debugging Ruby program in Chrome DevTools for these people! I’ll talk debugging Ruby program in Chrome DevTools for these people!
  7. Session 2 Do you use debug.gem? Do you use VS

    Code when debugging a program? YES NO YES NO Session 1 Session 1 I’ll talk tools for supporting VS Code debugging!
  8. Agenda • Session 1: About Chrome DevTools debugging ◦ This

    session includes basic functions in a debugger, too. • Session 2: About tools for supporting debugging in VS Code ◦ This session is about tools related to debugging, not about the debugger itself.
  9. Agenda • Session 1: About Chrome DevTools debugging ◦ This

    session includes basic functions in a debugger, too. • Session 2: About tools for supporting debugging in VS Code ◦ This session is about tools related to debugging, not about the debugger itself. Goal: Everyone wants to use tools in this talk! I’m very glad if I can get your feedbacks, too 😁
  10. What is Chrome DevTools? Pause the program at line 4!

    Set the breakpoint at line 4 View and Change the DOM Debug JavaScript View HTTP request and response
  11. What is Chrome DevTools? Pause the program at line 4!

    Set the breakpoint at line 4 View and Change the DOM Debug JavaScript View HTTP request and response
  12. You can debug Ruby program here!! Do you know how

    to debug JavaScript in Chrome DevTools?
  13. I’d like to debug Ruby program in rich UI such

    as VS Code, but… • I’m non-user of VS Code
  14. I’d like to debug Ruby program in rich UI such

    as VS Code, but… • I’m non-user of VS Code • it’s hard to install VS Code for any reason
  15. We installed Google Chrome on your laptop, don’t we? •

    By supporting Chrome DevTools debugging, we can provide rich user experience to non-users of VS Code!
  16. We installed Google Chrome on your laptop, don’t we? •

    By supporting Chrome DevTools debugging, we can provide rich user experience to non-users of VS Code! • Project Goal: Implement functions in Chrome DevTools are comparable to those in VS Code
  17. class SampleClass def initialize arg1, arg2 @arg1 = arg1 @arg2

    = arg2 end end def sample_method a = 1 b = 2 c = 3 a + b + c end s = SampleClass.new 1, 2 sample_method() sample_method() sample_method() sample_method() sample_method() Sample Script to debug in the demonstration
  18. What we can’t do in Chrome DevTools debugging • Code

    completion in Chrome Console • Supporting thread interface • Coloring code
  19. Summary for session 1 • You can debug Ruby program

    in Chrome’s rich UI easily. ◦ You don’t have to install any tools except for Chrome. • Chrome DevTools Protocol (CDP) is used between debug.gem and Chrome DevTools.
  20. Session 2 Do you use debug.gem? Do you use VS

    Code when debugging a program? YES NO YES NO Session 1 Session 1 Thank you for waiting VS Code users!
  21. rdbg-inspector • Tools for supporting debugging in VS Code •

    rdbg-inspector is WIP project which means it’s not released yet
  22. • What was the value of variable “a” when program

    was paused at line 6…? We want to go back to some points when debugging it, don’t we?
  23. • What was the value of variable “a” when program

    was paused at line 6…? • I’d like to see the procedure here again… We want to go back to some points when debugging it, don’t we?
  24. class SampleClass def initialize arg1, arg2 @arg1 = arg1 @arg2

    = arg2 end end def sample_method a = 1 b = 2 c = 3 a + b + c end s = SampleClass.new 1, 2 sample_method() sample_method() sample_method() sample_method() sample_method() Sample Script to debug in the demonstration
  25. • You can go back and forth between the program

    by clicking recorded execution logs • History Inspector is realized by Step Into and Step Back feature in debug.gem. History Inspector
  26. class ComputersController < ApplicationController before_action :set_computer, only: %i[ show edit

    update destroy ] # GET /computers or /computers.json def index binding.break @computers = Computer.limit(100) end # GET /computers/1 or /computers/1.json def show end ... Sample rails app to debug in the demonstration
  27. Summary for session 2 • Features of rdbg inspector are

    as follows: ◦ History Inspector ◦ Object Inspector • I’m looking forward to getting feedback from everyone!
  28. We want to use these tools, don’t we? • Debugging

    in Chrome DevTools • Tools for supporting debugging in VS Code
  29. Next… • Create the issue and write a blog to

    give us feedback! • If you want to learn how these tools work, ◦ https://chromedevtools.github.io/devtools-protocol/ ◦ https://microsoft.github.io/debug-adapter-protocol/ ◦ https://github.com/ruby/debug
  30. • Koichi Sasada (@ko1) ◦ He gave me the idea

    of Chrome Integration and rdbg inspector ◦ If it had not been for his help, I wouldn’t have been here! • Thank you for helping me to implement Chrome Integration ◦ Andrea Cardaci (@cyrus-and) ▪ Author of chrome remote-interface ◦ Geoffrey Litt (@geoffreylitt) ▪ Author of ladybug • Thanks to the following organization, I can continue developing debugging tools ◦ Ruby Association ◦ Google Summer of Code Acknowledgement
  31. • Thank you for reviewing my presentation ◦ Yusuke Endo

    (@mame) ◦ Yuta Saito (@kateinoigakukun) ◦ Daichi Furiya (@wasabeef) ◦ Yoshiki Fujikane (@fujiwo) ◦ Yuki Shigemasa (@gegeson) Acknowledgement2