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

Dispelling the Dark Magic: Inside a Ruby Debugger

Daniel Azuma
November 16, 2017

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

Daniel Azuma

November 16, 2017
Tweet

More Decks by Daniel Azuma

Other Decks in Programming

Transcript

  1. 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.
  2. line class end call return c_call c_return raise b_call b_return

    thread_begin thread_end fiber_switch TracePoint event types
  3. line class end call return c_call c_return raise b_call b_return

    thread_begin thread_end fiber_switch TracePoint event types
  4. 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
  5. 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