ruby-debug / debase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby 2.7.1 compatibility

stanhu opened this issue · comments

$ bundle exec rake
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Users/stanhu/github/debase/debase.gemspec:20.
cd ext
cd -
cd ext/attach
cd -
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Users/stanhu/github/debase/debase.gemspec:20.
checking for vm_core.h... no
checking for vm_core.h... no
**************************************************************************
No source for ruby-2.7.1-p83 (revision a0c7c23c9cec0d0ffcba012279cd652d28ad5bf3) provided with
debase-ruby_core_source gem. Falling back to ruby-2.7.0-preview3.
**************************************************************************
checking for vm_core.h... yes
checking for iseq.h... yes
checking for version.h... yes
creating Makefile
compiling breakpoint.c
compiling context.c
compiling debase_internals.c
debase_internals.c:319:25: warning: initializing 'rb_control_frame_t *' (aka 'struct rb_control_frame_struct *') with an expression of type
      'const rb_control_frame_t *' (aka 'const struct rb_control_frame_struct *') discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
    rb_control_frame_t *start_cfp = RUBY_VM_END_CONTROL_FRAME(TH_INFO(thread));
                        ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
debase_internals.c:768:3: warning: incompatible pointer types passing 'void (VALUE, VALUE)' (aka 'void (unsigned long, unsigned long)') to parameter
      of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-pointer-types]
  rb_define_module_function(mDebase, "set_trace_flag_to_iseq", Debase_set_trace_flag_to_iseq, 1);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:2825:135: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(klass, mid, func, arity) rb_define_module_function_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
                                                                                                                                      ^~~~~~
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:2802:1: note: passing argument to parameter 'func' here
RB_METHOD_DEFINITION_DECL(rb_define_module_function, (2,3), (VALUE klass, const char *name), (klass, name))
^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1074:71: note: expanded from macro 'RB_METHOD_DEFINITION_DECL'
RB_METHOD_DEFINITION_DECL_1(def,nonnull,def##0 ,0 ,decl,vars,(VALUE)) \
                                                                      ^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1069:5: note: expanded from macro '\
RB_METHOD_DEFINITION_DECL_1'
    RB_METHOD_DEFINITION_DECL_C(def,nonnull,defname,decl,vars,funcargs) \
    ^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1042:118: note: expanded from macro 'RB_METHOD_DEFINITION_DECL_C'
    __attribute__((__unused__,__weakref__(#def),__nonnull__ nonnull))static void defname(RB_UNWRAP_MACRO decl,VALUE(*func)funcargs,int arity);
                                                                                                                     ^
debase_internals.c:771:3: warning: incompatible pointer types passing 'void (VALUE, VALUE)' (aka 'void (unsigned long, unsigned long)') to parameter
      of type 'VALUE (*)(VALUE, VALUE)' (aka 'unsigned long (*)(unsigned long, unsigned long)') [-Wincompatible-pointer-types]
  rb_define_module_function(mDebase, "unset_iseq_flags", Debase_unset_trace_flags, 1);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:2825:135: note: expanded from macro 'rb_define_module_function'
#define rb_define_module_function(klass, mid, func, arity) rb_define_module_function_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
                                                                                                                                      ^~~~~~
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/ruby.h:2802:1: note: passing argument to parameter 'func' here
RB_METHOD_DEFINITION_DECL(rb_define_module_function, (2,3), (VALUE klass, const char *name), (klass, name))
^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1074:71: note: expanded from macro 'RB_METHOD_DEFINITION_DECL'
RB_METHOD_DEFINITION_DECL_1(def,nonnull,def##0 ,0 ,decl,vars,(VALUE)) \
                                                                      ^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1069:5: note: expanded from macro '\
RB_METHOD_DEFINITION_DECL_1'
    RB_METHOD_DEFINITION_DECL_C(def,nonnull,defname,decl,vars,funcargs) \
    ^
/Users/stanhu/.rbenv/versions/2.7.1/include/ruby-2.7.0/ruby/intern.h:1042:118: note: expanded from macro 'RB_METHOD_DEFINITION_DECL_C'
    __attribute__((__unused__,__weakref__(#def),__nonnull__ nonnull))static void defname(RB_UNWRAP_MACRO decl,VALUE(*func)funcargs,int arity);
                                                                                                                     ^
3 warnings generated.
compiling locker.c
linking shared-object debase_internals.bundle
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Users/stanhu/github/debase/debase.gemspec:20.
checking for vm_core.h... no
checking for vm_core.h... no
**************************************************************************
No source for ruby-2.7.1-p83 (revision a0c7c23c9cec0d0ffcba012279cd652d28ad5bf3) provided with
debase-ruby_core_source gem. Falling back to ruby-2.7.0-preview3.
**************************************************************************
checking for vm_core.h... yes
checking for iseq.h... yes
checking for version.h... yes
creating Makefile
compiling attach.c
linking shared-object attach.bundle
/Users/stanhu/.rbenv/versions/2.7.1/bin/ruby -w -I"lib:./ext:./lib" -I"/Users/stanhu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib" "/Users/stanhu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb" "test/test_reload_bug.rb" "test/test_load.rb" "test/test_base.rb" "test/test_breakpoints.rb" "test/test_catchpoint.rb"
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Users/stanhu/github/debase/debase.gemspec:20.
/Users/stanhu/github/debase/test/test_load.rb:16: warning: method redefined; discarding old at_line
/Users/stanhu/github/debase/lib/debase/context.rb:34: warning: previous definition of at_line was here
Loaded suite /Users/stanhu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader
Started
./Users/stanhu/github/debase/lib/debase.rb:31: warning: method redefined; discarding old prepend
/Users/stanhu/github/debase/lib/debase.rb:31: warning: previous definition of prepend was here
./Users/stanhu/github/debase/lib/debase.rb:31: warning: method redefined; discarding old prepend
/Users/stanhu/github/debase/lib/debase.rb:31: warning: previous definition of prepend was here
./Users/stanhu/github/debase/lib/debase.rb:31: warning: method redefined; discarding old prepend
/Users/stanhu/github/debase/lib/debase.rb:31: warning: previous definition of prepend was here
.F
=====================================================================================================================================================
     24:
     25:     # Without stopping
     26:     bt = Debugger.debug_load(prog_script, false)
  => 27:     assert_equal(nil, bt)
     28:     assert(Debugger.started?)
     29:     Debugger.stop
     30:
/Users/stanhu/github/debase/test/test_load.rb:27:in `test_debug_load'
<nil> expected but was
<NameError(<undefined local variable or method `this_variable_does_not_exist' for main:Object>)>

diff:
? NameError(<undefined local variable or method `this_variable_does_not_exist' for main:Object>)
Failure: test_debug_load(TestDebugLoad)
=====================================================================================================================================================
hi
...F
=====================================================================================================================================================
     25:     #              File.basename(Debugger.current_context.frame_file))
     26:     # assert_raises(ArgumentError) {Debugger.current_context.frame_file(1, 2)}
     27:     # assert_raises(ArgumentError) {Debugger.current_context.frame_file(15)}
  => 28:     assert_equal(19, Debugger.current_context.stack_size)
     29:     # assert_equal(TestRubyDebug, Debugger.current_context.frame_class)
     30:     assert_equal(false, Debugger.current_context.dead?, 'Not dead yet!')
     31:   ensure
/Users/stanhu/github/debase/test/test_base.rb:28:in `test_current_context'
<19> expected but was
<28>
Failure: test_current_context(TestRubyDebug)
=====================================================================================================================================================
..F
=====================================================================================================================================================
      5:
      6: class TestRubyDebugCatchpoint < Test::Unit::TestCase
      7:   def test_catchpoints
  =>  8:     assert_raise(RuntimeError) {Debugger.catchpoints}
      9:     Debugger.start_
     10:     assert_equal({}, Debugger.catchpoints)
     11:     Debugger.add_catchpoint('ZeroDivisionError')
/Users/stanhu/github/debase/test/test_catchpoint.rb:8:in `test_catchpoints'
Failure: test_catchpoints(TestRubyDebugCatchpoint): <RuntimeError> exception was expected but none was thrown.
=====================================================================================================================================================

Finished in 0.192958 seconds.
-----------------------------------------------------------------------------------------------------------------------------------------------------
12 tests, 29 assertions, 3 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
75% passed
-----------------------------------------------------------------------------------------------------------------------------------------------------
62.19 tests/s, 150.29 assertions/s
rake aborted!
Command failed with status (1): [ruby -w -I"lib:./ext:./lib" -I"/Users/stanhu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib" "/Users/stanhu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/rake_test_loader.rb" "test/test_reload_bug.rb" "test/test_load.rb" "test/test_base.rb" "test/test_breakpoints.rb" "test/test_catchpoint.rb" ]

+1. same problem

commented

Same issue with Ruby 2.5.5 and Mac OS 10.15.6

Edit: Actually running the command sudo gem install debase -- --with-cflags="-Wno-error=implicit-function-declaration" mentioned in #89 worked for me

I tried updating Ruby v2.7.2 sources in ruby-debug/debase-ruby_core_source#1, but I still see the same error in the tests.

Somehow rb_load_protect in

rb_load_protect(file, 0, &state);
is returning state with 6 instead of 0.