Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/protocol.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Protocol

on:
Expand All @@ -26,12 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Run tests
run: |
bundle exec rake clobber
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/ruby-macos.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby(macOS)

on:
Expand All @@ -26,12 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Run tests
run: |
bundle exec rake clobber
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
Expand All @@ -26,12 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Run tests
run: |
bundle exec rake clobber
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/test_test.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: TestTestFramework

on:
Expand All @@ -26,12 +19,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
bundler-cache: true
- name: Run tests
run: |
bundle exec rake clobber
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/truffleruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: TruffleRuby

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
truffleruby:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: truffleruby-head
bundler-cache: true
- name: Test installing the gem on TruffleRuby
run: |
bundle exec rake compile
bundle exec rake build
gem install pkg/debug-*.gem
6 changes: 6 additions & 0 deletions ext/debug/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ iseq_last_line(VALUE iseqw)
}
#endif

#ifdef HAVE_RB_ISEQ
void Init_iseq_collector(void);
#endif

void
Init_debug(void)
{
#ifdef HAVE_RB_ISEQ
VALUE rb_mRubyVM = rb_const_get(rb_cObject, rb_intern("RubyVM"));
VALUE rb_cISeq = rb_const_get(rb_mRubyVM, rb_intern("InstructionSequence"));
#endif
rb_mDebugger = rb_const_get(rb_cObject, rb_intern("DEBUGGER__"));
rb_cFrameInfo = rb_const_get(rb_mDebugger, rb_intern("FrameInfo"));

Expand All @@ -210,5 +214,7 @@ Init_debug(void)
rb_define_method(rb_cISeq, "last_line", iseq_last_line, 0);
#endif

#ifdef HAVE_RB_ISEQ
Init_iseq_collector();
#endif
}
1 change: 1 addition & 0 deletions ext/debug/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$distcleanfiles << "debug_version.h"

if defined? RubyVM
$defs << '-DHAVE_RB_ISEQ'
$defs << '-DHAVE_RB_ISEQ_PARAMETERS'
$defs << '-DHAVE_RB_ISEQ_CODE_LOCATION'

Expand Down
2 changes: 2 additions & 0 deletions ext/debug/iseq_collector.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <ruby/ruby.h>

#ifdef HAVE_RB_ISEQ
VALUE rb_iseqw_new(VALUE v);
void rb_objspace_each_objects(
int (*callback)(void *start, void *end, size_t stride, void *data),
Expand Down Expand Up @@ -89,3 +90,4 @@ Init_iseq_collector(void)
rb_define_singleton_method(rb_mObjSpace, "each_iseq", each_iseq, 0);
rb_define_singleton_method(rb_mObjSpace, "count_iseq", count_iseq, 0);
}
#endif
4 changes: 2 additions & 2 deletions lib/debug/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def last_line
def first_line
self.to_a[4][:code_location][0]
end unless method_defined?(:first_line)
end
end if defined?(RubyVM::InstructionSequence)

module DEBUGGER__
PresetCommands = Struct.new(:commands, :source, :auto_continue)
Expand Down Expand Up @@ -133,7 +133,7 @@ def initialize
@commands = {}
@unsafe_context = false

@has_keep_script_lines = RubyVM.respond_to? :keep_script_lines
@has_keep_script_lines = defined?(RubyVM.keep_script_lines)

@tp_load_script = TracePoint.new(:script_compiled){|tp|
eval_script = tp.eval_script unless @has_keep_script_lines
Expand Down
2 changes: 1 addition & 1 deletion lib/debug/source_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get iseq
end
end

if RubyVM.respond_to? :keep_script_lines
if defined?(RubyVM.keep_script_lines)
# Ruby 3.1 and later
RubyVM.keep_script_lines = true
require 'objspace'
Expand Down