Dispelling the Dark Magic: Inside a Ruby Debugger

Dispelling the Dark Magic: Inside a Ruby Debugger

Presentation by Daniel Azuma at RubyConf 2017. Covers how to implement a basic debugger for Ruby programs, and discusses some techniques behind the Stackdriver Debugger for Ruby. See also the live coding artifact at https://github.com/dazuma/google-snippets/blob/master/mini-debug

E06aa8f63d2a1753a2b352bc1cabbde2?s=128

Daniel Azuma

November 16, 2017
Tweet

Transcript

  1. 8.
  2. 9.

    Lawyercat says: Code samples are: Copyright 2017 Google Inc. Licensed

    under the Apache License, Version 2.0 (the "License"); you may not use this code except in compliance with the License. You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  3. 14.

    line class end call return c_call c_return raise b_call b_return

    thread_begin thread_end fiber_switch TracePoint event types
  4. 15.

    line class end call return c_call c_return raise b_call b_return

    thread_begin thread_end fiber_switch TracePoint event types
  5. 21.
  6. 24.

    file_events = [:call, :b_call, :return, :b_return, :fiber_switch] TracePoint.trace *file_events do

    |tp| if @breakpoint_files.include? tp.path @line_trace.enable else @line_trace.disable end end
  7. 25.
  8. 31.
  9. 35.
  10. 38.

    Try out a debugger! Byebug: interactive debugger shell https://github.com/deivid-rodriguez/byebug Stackdriver

    debugger: for live web applications https://cloud.google.com/debugger https://github.com/GoogleCloudPlatform/google-cloud-ruby/tree/ master/google-cloud-debugger