Граф коммитов

211 Коммитов

Автор SHA1 Сообщение Дата
ko1 fbc1deca89 add a debug function.
* vm_dump.c (rb_vmdebug_stack_dump_all_threads): dump stack dump
  for all living threads.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-20 04:50:53 +00:00
ko1 7519688ed8 introduce imemo_type_p(v, imemo_type)
* internal.h: introduce imemo_type_p() which checks the given value is
  T_IMEMO and imemo_type() == given imemo_type.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-07 06:41:32 +00:00
ko1 8fa99e6458 skip T_IMEMO for VMDEBUG
* vm_dump.c (vm_stack_dump_each): skip T_IMEMO object to display
  for VMDEBUG=3. [Bug #13030]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-26 09:57:41 +00:00
ko1 a4bc6c277a * vm_dump.c: enable to compile with VMDEBUG == 3.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-26 09:40:25 +00:00
nobu 81cb9aa574 error.c: moved
* error.c (preface_dump, postscript_dump): moved from
  rb_vm_bugreport to place the last important message at the very
  last after [NOTE].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13 02:57:45 +00:00
nobu d569c0c546 vm_dump.c: postscript_dump
* vm_dump.c (postscript_dump): mention crash report log twice
  because important.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13 01:46:45 +00:00
nobu 1407e52ba4 constify
* vm_dump.c (rb_vmdebug_debug_print_pre): constify pc argument for
  VMDEBUG.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-14 08:06:55 +00:00
naruse 8a1c7babec fix r56030 [Bug #12711]
check whether it was syscall or not by getting previous instruction.
syscall instruction is 0x0f 0x05.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 04:49:26 +00:00
naruse 1d3665fd0d * vm_dump.c (backtrace): use rip in the saved context for the case
the SIGSEGV is received when the process is in userland.
  Note that ip in the stack should be used if the signal is received
  when it is in kernel (when it is calling syscall) [Bug #12711]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-29 18:43:17 +00:00
ko1 03cad83593 * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()
and VM_FRAME_CFRAME_P().
  Most of case, RUBY_VM_NORMAL_ISEQ_P() is no
  longer needed.

* vm_core.h: introduce rb_obj_is_iseq().

* cont.c, vm.c: VM_FRAME_MAGIC_DUMMY with
  VM_FRAME_FLAG_CFRAME.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03 01:50:50 +00:00
ko1 0cd7f5fe87 * vm_core.h: rename macros and make them inline functions.
* rename VM_FRAME_TYPE_FINISH_P() to VM_FRAME_FINISHED_P().
  * rename VM_FRAME_TYPE_BMETHOD_P() to VM_FRAME_BMETHOD_P().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-03 00:28:12 +00:00
ko1 e06698d257 * vm.c, internal.h: remove RubyVM::Env class and all of env objects
are imemo objects (imemo_env).

* NEWS: describe this change. I believe nobody touch these objects
  because there are no method defined.

* vm_core.h: remove the following definitions.
  * rb_cEnv decl.
  * GetEnvPtr() because Env is no longer T_DATA object.

* vm_core.h (rb_env_t): fix layout for imemo values.

* vm_core.h (vm_assert_env): added.

* vm_core.h (vm_env_new): added.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 19:13:26 +00:00
ko1 9f60791a04 * vm_core.h: revisit the structure of frame, block and env.
[Bug #12628]

  This patch introduce many changes.

  * Introduce concept of "Block Handler (BH)" to represent
    passed blocks.

  * move rb_control_frame_t::flag to ep[0] (as a special local
    variable). This flags represents not only frame type, but also
    env flags such as escaped.

  * rename `rb_block_t` to `struct rb_block`.

  * Make Proc, Binding and RubyVM::Env objects wb-protected.

  Check [Bug #12628] for more details.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-28 11:02:30 +00:00
naruse 17e5dff210 * vm_dump.c (rb_print_backtrace): our addr2line doesn't work on sparc.
http://rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20151027T043311Z.log.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-27 07:13:39 +00:00
nobu 6291c6ad77 vm_args.c: symbol proc
* vm_args.c (vm_caller_setup_arg_block): store symbols instead of
  ifuncs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-16 03:21:10 +00:00
nobu 278ca4dbe8 vm_dump.c: unused variable
* vm_dump.c (vm_stack_dump_each): remove never-used variable and
  dead code for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-15 06:51:17 +00:00
nobu 5c7f36a1b8 configure.in: libunwind.h check
* configure.in: check for libunwind.h, which is not available in
  very old OS X SDK.  [ruby-core:71080] [Bug #11591]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-14 07:56:53 +00:00
ko1 e4198a73d4 * make rb_iseq_t T_IMEMO object (type is imemo_iseq).
All contents of previous rb_iseq_t is in rb_iseq_t::body.
  Remove rb_iseq_t::self because rb_iseq_t is an object.
  RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
  So RubyVM::ISeq.of(something) method returns different wrapper
  objects but they point the same T_IMEMO/iseq object.
  This patch is big, but most of difference is replacement of
  iseq->xxx to iseq->body->xxx.
  (previous) rb_iseq_t::compile_data is also located to
  rb_iseq_t::compile_data.
  It was moved from rb_iseq_body::compile_data.
  Now rb_iseq_t has empty two pointers.
  I will split rb_iseq_body data into static data and dynamic data.
* compile.c: rename some functions/macros.
  Now, we don't need to separate iseq and iseqval (only VALUE).
* eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
* ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
* gc.c: check T_IMEMO/iseq.
* internal.h: add imemo_type::imemo_iseq.
* iseq.c: define RubyVM::InstructionSequnce as T_OBJECT.
  Methods are implemented by functions named iseqw_....
* load.c (rb_load_internal0): rb_iseq_new_top() returns
  rb_iseq_t (T_IMEMO/iesq).
* method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
* vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
* vm_core.h (struct rb_iseq_body): remove padding for
  [Bug #10037][ruby-core:63721].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 22:52:59 +00:00
ko1 331fb4a2b3 * vm_core.h: constify rb_call_info_t::kw_arg,
rb_control_frame_t::iseq and rb_control_frame_t::block_iseq.
* iseq.c (iseq_free): catch up this fix.
* vm.c: ditto.
* vm_dump.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 21:41:04 +00:00
ko1 994460c4db * vm_core.h, vm.c: remove rb_proc_t::envval because we can know it via
rb_proc_t::block::ep.
  rb_vm_proc_envval(const rb_proc_t *proc) returns an Env object which
  the Proc object use.
* proc.c: catch up this fix.
* vm_dump.c (rb_vmdebug_proc_dump_raw): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 17:59:03 +00:00
ko1 e07dad00ee * vm_core.h, vm.c: remvoe rb_env_t::prev_envval because we can know it
via env->ep.
  rb_vm_env_prev_envval(env) returns prev_envval via env->ep.
* vm_core.h (rb_vm_env_local_variables): change parameter type
  from VALUE (T_DATA/env) to `const rb_env_t *' to make same as
  rb_vm_env_prev_envval().
* proc.c: catch up these changes.
* vm_dump.c: ditto.
* vm.c: rename macros.
  * ENV_IN_HEAP_P() to VM_EP_IN_HEAP_P() because it uses ep.
  * ENV_VAL() to VM_ENV_EP_ENVVAL() because it is too short.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 17:36:36 +00:00
ko1 a82ce7c556 * vm.c: refactoring Proc/Env related code.
* vm_core.h: remove blockprocval field from rb_proc_t and rb_binding_t.
  Instead of this field, mark given block in Proc at rb_env_t::env.
* vm.c (vm_make_env_each): make an Env object with this layout.
  And also simplify parameters.
* proc.c: catch up this fix.
* vm_core.h: remove rb_env_t::local_size because it is not used.
* vm_dump.c (rb_vmdebug_env_dump_raw): catch up this fix.
* vm_core.h (rb_vm_make_env_object): remove rb_vm_make_env_object()
  because it is only refered from vm.c.
* vm_eval.c (eval_string_with_cref): catch up this fix.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14 16:23:17 +00:00
ko1 5e8a147480 * method.h: introduce rb_callable_method_entry_t to remove
rb_control_frame_t::klass.
  [Bug #11278], [Bug #11279]
  rb_method_entry_t data belong to modules/classes.
  rb_method_entry_t::owner points defined module or class.
    module M
      def foo; end
    end
  In this case, owner is M.
  rb_callable_method_entry_t data belong to only classes.
  For modules, MRI creates corresponding T_ICLASS internally.
  rb_callable_method_entry_t can also belong to T_ICLASS.
  rb_callable_method_entry_t::defined_class points T_CLASS or
  T_ICLASS.
  rb_method_entry_t data for classes (not for modules) are also
  rb_callable_method_entry_t data because it is completely same data.
  In this case, rb_method_entry_t::owner == rb_method_entry_t::defined_class.
  For example, there are classes C and D, and incldues M,
    class C; include M; end
    class D; include M; end
  then, two T_ICLASS objects for C's super class and D's super class
  will be created.
  When C.new.foo is called, then M#foo is searcheed and
  rb_callable_method_t data is used by VM to invoke M#foo.
  rb_method_entry_t data is only one for M#foo.
  However, rb_callable_method_entry_t data are two (and can be more).
  It is proportional to the number of including (and prepending)
  classes (the number of T_ICLASS which point to the module).
  Now, created rb_callable_method_entry_t are collected when
  the original module M was modified. We can think it is a cache.
  We need to select what kind of method entry data is needed.
  To operate definition, then you need to use rb_method_entry_t.
  You can access them by the following functions.
  * rb_method_entry(VALUE klass, ID id);
  * rb_method_entry_with_refinements(VALUE klass, ID id);
  * rb_method_entry_without_refinements(VALUE klass, ID id);
  * rb_resolve_refined_method(VALUE refinements, const rb_method_entry_t *me);
  To invoke methods, then you need to use rb_callable_method_entry_t
  which you can get by the following APIs corresponding to the
  above listed functions.
  * rb_callable_method_entry(VALUE klass, ID id);
  * rb_callable_method_entry_with_refinements(VALUE klass, ID id);
  * rb_callable_method_entry_without_refinements(VALUE klass, ID id);
  * rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_entry_t *me);
  VM pushes rb_callable_method_entry_t, so that rb_vm_frame_method_entry()
  returns rb_callable_method_entry_t.
  You can check a super class of current method by
  rb_callable_method_entry_t::defined_class.
* method.h: renamed from rb_method_entry_t::klass to
  rb_method_entry_t::owner.
* internal.h: add rb_classext_struct::callable_m_tbl to cache
  rb_callable_method_entry_t data.
  We need to consider abotu this field again because it is only
  active for T_ICLASS.
* class.c (method_entry_i): ditto.
* class.c (rb_define_attr): rb_method_entry() does not takes
  defiend_class_ptr.
* gc.c (mark_method_entry): mark RCLASS_CALLABLE_M_TBL() for T_ICLASS.
* cont.c (fiber_init): rb_control_frame_t::klass is removed.
* proc.c: fix `struct METHOD' data structure because
  rb_callable_method_t has all information.
* vm_core.h: remove several fields.
  * rb_control_frame_t::klass.
  * rb_block_t::klass.
  And catch up changes.
* eval.c: catch up changes.
* gc.c: ditto.
* insns.def: ditto.
* vm.c: ditto.
* vm_args.c: ditto.
* vm_backtrace.c: ditto.
* vm_dump.c: ditto.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
* vm_method.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-03 11:24:50 +00:00
ko1 57b817f4c5 * method.h: make rb_method_entry_t a VALUE.
Motivation and new data structure are described in [Bug #11203].
  This patch also solve the following issues.
  * [Bug #11200] Memory leak of method entries
  * [Bug #11046] __callee__ returns incorrect method name in orphan
                 proc
* test/ruby/test_method.rb: add a test for [Bug #11046].
* vm_core.h: remvoe rb_control_frame_t::me. me is located at value
  stack.
* vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes
  because method entries are simple VALUEs.
* method.h:  Now, all method entries has own independent method
  definititons. Strictly speaking, this change is not essential,
  but for future changes.
  * rb_method_entry_t::flag is move to rb_method_definition_t::flag.
  * rb_method_definition_t::alias_count is now
    rb_method_definition_t::alias_count_ptr, a pointer to the counter.
* vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to
  search the current method entry from value stack.
* vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable
  assertions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-02 04:20:30 +00:00
naruse dd9265ecf3 * vm_dump.c (rb_print_backtrace): return value of libexec's backtrace
is size_t, so simply cast as int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-20 02:24:17 +00:00
nobu 4ce15bf491 vm_dump.c: statement for crash report log
* vm_dump.c (preface_dump): move the statement to include crash
  report log file from REPORTBUG_MSG in error.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-12 07:22:57 +00:00
nobu 218617161f vm_dump.c: highlight preface
* vm_dump.c (preface_dump): highlight very important but very
  ofhen ignored message like a Xmas tree.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-12 06:50:05 +00:00
nobu 92430a031d vm_dump.c: preface_dump
* vm_dump.c (preface_dump): move platform specific preface.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-12 06:49:51 +00:00
nobu 5a62fdee4d vm_dump.c: check procstat_getvmmap
* configure.in: check also procstat_getvmmap, which is not
  available on FreeBSD 9.  [ruby-core:68468] [Bug #10954]
* vm_dump.c (procstat_vm): use kinfo_getvmmap instead if
  procstat_getvmmap is not available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-11 04:28:51 +00:00
ko1 ed130faf28 * proc.c: use RUBY_VM_IFUNC_P() to recognize IFUNC or not.
* vm.c: ditto.
* vm_dump.c: ditto.
* vm_insnhelper.c: ditto.
* vm_core.h: use RB_TYPE_P() instead of BUILTIN_TYPE().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-10 18:50:15 +00:00
nobu dbffdff1e7 vm_dump.c: no new strings in signal context
* vm_dump.c (rb_vm_bugreport): get rid of making new strings
  inside signal context.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-28 06:44:22 +00:00
nobu 6d2e8b0546 vm_dump.c: check by configured result
* vm_dump.c (rb_vm_bugreport): check by configured result instead
  of system name for old FreeBSD.  based on a patch by Steve Wills
  at [ruby-core:67655].  [Bug #10752]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-18 06:50:41 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
ko1 831e33c780 * vm_core.h: change iseq parameter data structure.
https://bugs.ruby-lang.org/issues/10440#change-49694
  * change terminology `arg' to `param'.
  * move rb_iseq_t::arg_* to rb_iseq_t::param.
  * move rb_iseq_t::arg_size to rb_iseq_t::param::size.
  * move rb_iseq_t::argc to rb_iseq_t::param::lead_num.
  * move rb_iseq_t::arg_opts to rb_iseq_t::param::opt_num.
  * move rb_iseq_t::arg_rest to rb_iseq_t::param::rest_start.
  * move rb_iseq_t::arg_post_num to rb_iseq_t::param::post_num.
  * move rb_iseq_t::arg_post_start to rb_iseq_t::param::post_start.
  * move rb_iseq_t::arg_block to rb_iseq_t::param::block_start.
  * move rb_iseq_t::arg_keyword* to rb_iseq_t::param::keyword.
    rb_iseq_t::param::keyword is allocated only when keyword
    parameters are available.
  * introduce rb_iseq_t::param::flags to represent parameter
    availability. For example, rb_iseq_t::param:🎏:has_kw
    represents that this iseq has keyword parameters and
    rb_iseq_t::param::keyword is allocated.
    We don't need to compare with -1 to check availability.
  * remove rb_iseq_t::arg_simple.
* compile.c: catch up this change.
* iseq.c: ditto.
* proc.c: ditto.
* vm.c, vm_args.c, vm_dump.c, vm_insnhelper.c: ditto.
* iseq.c (iseq_data_to_ary): support keyword argument.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-02 23:14:21 +00:00
normal ea4c97904e compile: translate iseq in-place
running "ruby -rpp -e 'pp GC.stat'", a reduction in
malloc usage is shown:

before:
	:malloc_increase=>118784,
	:oldmalloc_increase=>1178736,

after:
	:malloc_increase=>99832,
	:oldmalloc_increase=>1031976,

For "ruby -e exit", valgrind reports over 300K reduction in
overall allocations (and unnecessary memory copies).

before:
  total heap usage: 49,622 allocs, 20,492 frees, 8,697,493 bytes allocated
after:
  total heap usage: 48,935 allocs, 19,805 frees, 8,373,773 bytes allocated

(numbers from x86-64)

v2 changes based on ko1 recommendations [ruby-core:64883]:
- squashed in-place direct thread translation to avoid alloc+copy
- renamed rb_iseq_untranslate_threaded_code to rb_iseq_original_iseq,
  cache new iseq->iseq_original field.

* compile.c (rb_iseq_translate_threaded_code): modify in-place w/o copy
  (rb_vm_addr2insn): new function for debug
  (rb_iseq_original_iseq): ditto
  (iseq_set_sequence): assign iseq_encoded directly
  [Feature #10185]

* vm_core (rb_iseq_t): move original ->iseq to bottom

* iseq.c (iseq_free, iseq_free): adjust for new layout
  (rb_iseq_disasm): use original iseq for dump
  (iseq_data_to_ary): ditto
  (rb_iseq_line_trace_each): ditto
  (rb_iseq_build_for_ruby2cext): use iseq_encoded directly

* vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-10 06:14:07 +00:00
ko1 68f55c4b35 * dir.c (glob_helper): use #ifdef instead of #if.
gcc's -Wundef option shows warning for undefined macro.
* numeric.c (flo_is_finite_p): ditto.
* vm_dump.c (rb_vmdebug_thread_dump_state): ditto.
* vm_core.h: define VM_DEBUG_VERIFY_METHOD_CACHE to 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 08:50:31 +00:00
ko1 59bdf7eac8 * vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or
rescue clause.
* vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure.
* test/ruby/test_settracefunc.rb: should not invoke b_return at rescue
  clause.
  [Bug #9957]
* vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE.
* vm_dump.c (vm_stack_dump_each): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-19 09:17:21 +00:00
nobu 82f4c4d4d7 report bug with machine regisiters
* error.c (rb_bug_context): new function to report bug with
  context.
* vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
  dump machine regisiters.  based on [GH-584].
* signal.c (sigbus, sigsegv): dump machine regisiters if available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:46:55 +00:00
nobu ecb8378651 vm_dump.c: adjust style
* vm_dump.c (backtrace): adjust style, inserting breaks between
  type, function name with its arguments, and its body.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-25 03:15:49 +00:00
naruse 6ba2c24cc4 * vm_dump.c (rb_print_backtrace): current implementation
uses dladdr to get the path of objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45489 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31 22:34:41 +00:00
naruse 0795c7168f revert r45417
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 01:17:51 +00:00
naruse 2bf56deded * addr2line.c (fill_lines): loop reverse order not to overwrite
the basis of base addresses comparison.

* addr2line.c: use uintptr_t instead of intptr_t for poinrters.

* addr2line.c (rb_dump_backtrace_with_lines): don't use syms.

* vm_dump.c (rb_print_backtrace): ditto.

* addr2line.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 04:30:43 +00:00
naruse 3bd0fd118d temporaly change/add to debug on powerpc64-linux
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 23:55:58 +00:00
naruse fefbd47bdd * vm_dump.c (rb_vm_bugreport): show vm maps on FreeBSD.
* vm_dump.c (procstat_vm): copied from FreeBSD.
  http://svnweb.freebsd.org/base/head/usr.bin/procstat/procstat_vm.c?revision=261780

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-10 17:10:57 +00:00
tmm1 4ece8eea11 vm_dump.c: improve wording of apple crashlog messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-19 23:18:14 +00:00
nobu 3005a9fb62 vm_dump.c: suppress warning
* vm_dump.c (rb_vmdebug_debug_print_pre): suppress warning on a
  platform ptrdiff_t is shorter than long int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 09:05:45 +00:00
tarui 44cb6eaef9 * vm_dump.c (rb_vmdebug_debug_print_pre): Bugfix. Get PC directly.
PC is cached into local stack and cfp->pc is incorrent at next of
	  branch or jump.
	* vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
	* vm_core.h: update signature of rb_vmdebug_debug_print_pre.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 12:01:18 +00:00
nobu f02c2b9cfa * vm_dump.c (rb_vm_bugreport): show name of class and module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 08:03:53 +00:00
nobu 22c0397a20 * vm_dump.c (rb_vm_bugreport): limit class name length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 08:03:51 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
naruse a1a6fd90bb * vm_dump.c (rb_print_backtrace): separate to ease showing C backtrace.
* internal.h (rb_print_backtrace): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-02 07:02:54 +00:00
naruse ab31e97c44 Add comments to r39808
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 17:39:39 +00:00
naruse aa24857f12 * vm_dump.c (backtrace): on darwin use custom backtrace() to trace
beyond _sigtramp. darwin's backtrace can't trace beyond signal
  trampoline with sigaltstack.

* configure.in: check execinfo.h on darwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 04:31:59 +00:00
naruse 10103e8cc7 Correct condition of r39302
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:46:00 +00:00
naruse 0b261c379b * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace
beyond signal trampoline, and as described in r38342 it can't
  trace on -O because it see stack frame pointers.
  libunwind unw_backtrace see dwarf information in the binary
  and it works with -O (without frame pointers).

* configure.in: remove r38342's hack and check libunwind.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:21:02 +00:00
naruse e233ca15e0 * configure.in: check whether backtrace(3) works well or not.
* vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:20:59 +00:00
ko1 4cb4c929df * vm_dump.c (control_frame_dump): capitalize prefix of `ep'
if `ep' points an env object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-04 03:46:12 +00:00
nobu 5efb130d39 vm_dump.c: important message first
* vm_dump.c (rb_vm_bugreport): show the most important message, Crash
  Report log information, first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:21:33 +00:00
kosaki 585afbbc6a * vm_dump.c (rb_vm_bugreport): revert r38533.
* addr2line.c (fill_lines): add ELF sanity check.
  [Bug #7597] [ruby-dev:46786]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 17:21:12 +00:00
tarui 315bf4b6d7 * vm_dump.c (rb_vm_bugreport): commentout addr2line call temporarily
in order to avoid segv. anyone can fix addr2line?
	  [Bug #7597] [ruby-dev:46786]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 12:17:03 +00:00
naruse 486795d951 * configure.in: add -fno-omit-frame-pointer if libexecinfo is used.
At least on FreeBSD ruby will crash on getting C backtrace
  when it is compiled with other than -O0.

* vm_dump.c: enable backtrace on FreeBSD even if with optimizations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 07:36:32 +00:00
naruse 34fb7d7830 Specify rlimits_core to prevent making core file
Stable fix for r38041.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 03:12:37 +00:00
naruse a52c63e420 Experimental fix for r38041
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 00:42:26 +00:00
naruse 64bbd55c85 Experimental: don't use $.*s of fprintf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 21:17:37 +00:00
naruse a6455f2994 Experimentally recommit of r38041: specify smaller max length
* vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
  handler.  based on a patch by charliesome (Charlie Somerville)
  [ruby-core:49573] [Bug #7402]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 17:13:18 +00:00
naruse 0ab057280c Experimentally revert r38041
"vm_dump.c: no methods in segv handler"
It may cause segv:
http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20121130T090301Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 02:58:54 +00:00
nobu 981f9c52c6 vm_dump.c: no methods in segv handler
* vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
  handler.  based on a patch by charliesome (Charlie Somerville)
  [ruby-core:49573] [Bug #7402]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 07:19:16 +00:00
ngoto f17aa9b361 * vm_dump.c: not to include probes.h because the code does not depend
on it.
* common.mk (vm_dump.$(OBJEXT)): remove dependency on probes.h


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19 12:37:43 +00:00
tenderlove 4c740bae97 * probes.d: add DTrace probe declarations. [ruby-core:27448]
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.

* compile.c (rb_insns_name): allowing DTrace probes to access
  instruction sequence name.

* Makefile.in: translate probes.d file to appropriate header file.

* common.mk: declare dependencies on the DTrace header.

* configure.in: add a test for existence of DTrace.

* eval.c (setup_exception): add a probe for when an exception is
  raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
  end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.

* internal.h: function declaration for compile.c change.

* load.c (rb_f_load): add probes for `load` entry and exit, require
  entry and exit, and wrapping search_required for load path search.

* object.c (rb_obj_alloc): added a probe for general object creation.

* parse.y (yycompile0): added a probe around parse and compile phase.

* string.c (empty_str_alloc, str_new): DTrace probes for string
  allocation.

* test/dtrace/*: tests for DTrace probes.

* vm.c (vm_invoke_proc): add probes for function return on exception
  raise, hash create, and instruction sequence execution.

* vm_core.h: add probe declarations for function entry and exit.

* vm_dump.c: add probes header file.

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
  function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
  methods.

* vm_insnhelper.h: vm usage information is always collected, so
  uncomment the functions.

12 19:14:50 2012  Akinori MUSHA  <knu@iDaemons.org>

* configure.in (isinf, isnan): isinf() and isnan() are macros on
  DragonFly which cannot be found by AC_REPLACE_FUNCS().  This
  workaround enforces the fact that they exist on DragonFly.

12 15:59:38 2012  Shugo Maeda  <shugo@ruby-lang.org>

* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
  vm_insnhelper.c (vm_search_method): revert r37616 because it's too
  slow.  [ruby-dev:46477]

* test/ruby/test_refinement.rb (test_inline_method_cache): skip
  the test until the bug is fixed efficiently.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12 21:52:12 +00:00
sorah a8b3d67e7c * vm_dump.c (rb_vm_bugreport): Because of many log directories,
making directory lists readable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02 08:00:02 +00:00
mrkn 8db54e07f9 * vm_dump.c (rb_vm_bugreport): add ~/Library/Logs/DiagnosticReports
in the locations list of crash reports.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02 07:52:56 +00:00
ko1 a52af29271 * vm_dump.c: fix debug prints to catch up recent changes
such as VM data structures.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-10 17:55:57 +00:00
ko1 23dc0dbc4a * vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysis
hooks (old macro name is COLLECT_USAGE_ANALYSIS).
  This feature is only for VM developers.  (I'm not sure I can use
  `VM developers' (the plural form) in this sentence).
  If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
  usage collection features:
  (1) insntruction: collect intruction usages.
  (2) operand: collect operand usages.
  (3) register: collect register usages.
  The results are stored in
  RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
  RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
  RubyVM::USAGE_ANALYSIS_REGS for (3).
  You can stop collecting usages with
  RubyVM::USAGE_ANALYSIS_INSN_STOP(),
  RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
  RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
  for (1), (2), (3) respectively.
  You can also change the hook functions by setting
  C level global variables
  `ruby_vm_collect_usage_func_(insn|operand|register)'
  for (1), (2), (3) respectively.
  See codes for more details.
* tool/instruction.rb: fix macro names.
* iseq.c (insn_operand_intern): make it export (used in vm.c).
  fix to skip several processes if not needed (pointer is 0).
* vm_dump.c: move codes for collection features to vm.c.
* vm_exec.h: rename macro and function names.
* vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 12:31:05 +00:00
mrkn 0d3cd4119e * vm_dump.c (rb_vm_bugreport): add /Library/Logs/DiagnosticReports
in the list of locations of crash reports.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-30 14:34:55 +00:00
ko1 d50483df23 * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
`bp' can be calculate by `sp' (stack pointer) of previous frame.
  Now, `bp_check' field is remained for debug.  You can eliminate
  this field by setting  VM_DEBUG_BP_CHECK as 0.
* vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp).
  This function calculates base pointer from cfp.
* vm_insnhelper.c (vm_setup_method): push `recv' value on top of
  value stack (before method parameters).
  This change is for keeping consistency with normal method dispatch.
* insns.def: fix to use vm_base_ptr().
* vm.c (vm_exec): ditto.
* vm_dump.c: remove `bp' related dumps.
* cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 04:05:36 +00:00
ko1 0d1a905edb * vm_exec.c, insns.def (leave): solve problems on
OPT_CALL_THREADED_CODE.
  Catch up finish frame structure on OPT_CALL_THREADED_CODE.
* vm_core.h: add rb_thread_t#retval for temporary space on
  OPT_CALL_THREADED_CODE.
* vm.c (th_init): clear rb_thread_t#retval as Qundef.
* vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-07 11:13:57 +00:00
kosaki 3e1d8aab17 * dln.c: Simplify and make consistent an ifdef for Mac OS X.
* ext/socket/rubysocket.h: ditto.
* ext/tk/stubs.c: ditto.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09 15:52:49 +00:00
ko1 745c23b2d9 * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
Before this commit:
  `finish frame' was place holder which indicates that VM loop
  needs to return function.
  If a C method calls a Ruby methods (a method written by Ruby),
  then VM loop will be (re-)invoked.  When the Ruby method returns,
  then also VM loop should be escaped.  `finish frame' has only
  one instruction `finish', which returns VM loop function.
  VM loop function executes `finish' instruction, then VM loop
  function returns itself.
  With such mechanism, `leave' instruction (which returns one
  frame from current scope) doesn't need to check that this `leave'
  should also return from VM loop function.
  Strictly, one branch can be removed from `leave' instructon.
  Consideration:
  However, pushing the `finish frame' needs costs because
  it needs several memory accesses.  The number of pushing
  `finish frame' is greater than I had assumed.  Of course,
  pushing `finish frame' consumes additional control frame.
  Moreover, recent processors has good branch prediction,
  with which we can ignore such trivial checking.
  After this commit:
  Finally, I decide to remove `finish frame' and `finish'
  instruction.  Some parts of VM depend on `finish frame',
  so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
  If this frame should escape from VM function loop, then
  the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
  `leave' instruction checks this flag every time.
  I measured performance on it.  However on my environments,
  it improves some benchmarks and slows some benchmarks down.
  Maybe it is because of C compiler optimization parameters.
  I'll re-visit here if this cause problems.
* insns.def (leave, finish): remove finish instruction.
* vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
  apply above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 10:22:34 +00:00
ko1 0a71db8a74 * vm_core.h: remove lfp (local frame pointer) and rename
dfp (dynamic frame pointer) to ep (environment pointer).
  This change make VM `normal' (similar to other interpreters).
  Before this commit:
  Each frame has two env pointers lfp and dfp.  lfp points
  local environment which is method/class/toplevel frame.
  lfp[0] is block pointer.
  dfp is block local frame. dfp[0] points previous (parent)
  environment pointer.
  lfp == dfp when frame is method/class/toplevel.
  You can get lfp from dfp by traversing previous environment
  pointers.
  After this commit:
  Each frame has only `ep' to point respective enviornoment.
  If there is parent environment, then ep[0] points parent
  envioenment (as dfp).  If there are no more environment,
  then ep[0] points block pointer (as lfp).  We call such ep
  as `LEP' (local EP).  We add some macros to get LEP and to
  detect LEP or not.
  In short, we replace dfp and lfp with ep and LEP.
  rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
  and member `ep' is added.
  rename rb_thread_t's member `local_lfp' and `local_svar' to
  `root_lep' and `root_svar'.
  (VM_EP_PREV_EP(ep)): get previous environment pointer.  This macro
  assume that ep is not LEP.
  (VM_EP_BLOCK_PTR(ep)): get block pointer.  This macro assume
  that ep is LEP.
  (VM_EP_LEP_P(ep)): detect ep is LEP or not.
  (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
  (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
  (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
  (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
* vm.c: apply above changes.
  (VM_EP_LEP(ep)): get LEP.
  (VM_CF_LEP(cfp)): get LEP of cfp->ep.
  (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
  (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
* vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
  apply above changes.
* cont.c: ditto.
* eval.c, eval_intern.h: ditto.
* proc.c: ditto.
* thread.c: ditto.
* vm_dump.c: ditto.
* vm_exec.h: fix function name (on vm debug mode).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 03:14:59 +00:00
ko1 bac9f65f70 * vm_core.h (rb_location_t): fix type and field name.
(1) rename rb_location_t to rb_iseq_location_t.
  (2) rename field names of rb_iseq_location_t to adjust
  RubyVM::Backtrace::Location methods.
  (2-1) filename -> path
  (2-2) filepath -> absolute_path
  (2-3) basename -> base_label
  (2-4) name -> label
  (3) rename filed name rb_iseq_location_t#line_no to
  rb_iseq_location_t#first_lineno to clear purpose of this field.
  (4) The field names rb_binding_t#(filename|line_no) are also renamed
  to rb_binding_t#(path|first_lineno).
* compile.c: apply above changes.
* iseq.c: ditto.
* proc.c: ditto.
* vm*.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 02:49:37 +00:00
ko1 b57c81ae3e * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
is no longer included from vm.c).  I hope this separation reduce
  compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:59:37 +00:00
ko1 1f3142a447 * vm.c: refactoring backtrace related funcitons.
(1) unify similar functions (rb_backtrace_each() and
  backtrace_object()).  backtrace_each() is a unified function.
  variation:
  a) backtrace_object(): create backtrace object.
  b) vm_backtrace_str_ary(): create bt as an array of string.
  c) vm_backtrace_print(): print backtrace to specified file.
  d) rb_backtrace_print_as_bugreport(): print backtrace on
  bugreport style.
  (2) remove rb_backtrace_each().  Use backtrace_each() instead.
  (3) chang the type of lev parameter to size_t.
  a) lev == 0 means current frame (exception, etc use it).
  b) lev == 1 means upper frame (caller(0) use it).
* vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
  correct size of caller(lev) array.
  Let n be a "caller(0).size" then ln as caller(lev).size should be
  (n - lev).  However, the previous implementation returns a wrong
  size array (ln > n - lev).  [ruby-dev:45673]
* test/ruby/test_backtrace.rb: add tests for backtrace.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 04:50:10 +00:00
ko1 8bcf7fc402 * vm_core.h: add a data type rb_location_t to store iseq location
information.
  rb_location_t#filename, filepath, name and line_no was moved from
  rb_iseq_t.  rb_location_t#basename is a new field which is
  similar to `name' field without any decoration.
  `name' field contains some decoration such as `block in foo'.
  `basename' only contains `foo'.
  rb_iseq_t contains memory object of rb_location_t.
* iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
* compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
  vm_method.c: support about it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-22 08:31:38 +00:00
kosaki 8cee31214d * io.c (rb_write_error2): get rid of warning on linux. fwrite
of glibc is tagged __attribute__ ((__warn_unused_result__))
  if _FORTIFY_SOURCE != 0.
* vm_dump.c (rb_vm_bugreport): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-27 12:06:10 +00:00
nobu 05e7354864 * vm_dump.c (HAVE_BACKTRACE): fallback to 0.
* vm_dump.c (rb_vm_bugreport): show "Other runtime information"
  header only when available.
* vm_dump.c (rb_vm_bugreport): get rid of modifying the content of
  VM directly.
* vm_dump.c (rb_vm_bugreport): check if vm is non-null.
  Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
  Thank you.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-11 08:09:48 +00:00
nobu 3550766601 * vm_dump.c (VMDEBUG): suppress undefined macro warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-27 02:04:51 +00:00
naruse e33183acca * addr2line.c: use USE_ELF instead of __ELF__ because Solaris
doesn't define it. USE_ELF is already provided by configure.
  patched by Naohisa Goto. [ruby-dev:44066] [Bug #4998]

* addr2line.h: ditto.

* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 12:23:10 +00:00
kosaki 230be2a771 * vm_dump.c (rb_vm_bugreport): change CrashReporter suggestion messages
on Mac. It should be placed after "-- C level backtrace" line.
  Suggested by Endoh-san.

  <before>
  -- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
  -- /Library/Logs/CrashReporter, for the more detail of ---------------------
  -- C level backtrace information -------------------------------------------

<after>
  -- C level backtrace information -------------------------------------------

     See Crash Report log file under ~/Library/Logs/CrashReporter or
     /Library/Logs/CrashReporter, for the more detail of.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-26 04:49:33 +00:00
mrkn 96874ec46e * vm_dump.c: delete dashes to make lines 80 chars, Patched by
Shota Fukumori (sora_h).  [Bug #4275] [ruby-dev:43021]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 04:37:25 +00:00
mrkn 5b9b8d9cfe * vm_dump.c: fix misspelling of CrashReporter.
[Bug #4275] [ruby-dev:43021]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 04:23:30 +00:00
akr 38f129397b * vm_dump.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:37:32 +00:00
nobu af67081446 * vm_dump.c (rb_vm_bugreport): suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-08 12:39:13 +00:00
naruse a926288bee * vm_dump.c: undef HAVE_BACKTRACE when the OS is FreeBSD (in other
words backtrace() is libexecinfo) and it is optimized.
  This temporary hack should be also applied to other libexecinfo
  environments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-30 08:06:22 +00:00
nobu 3e57529e3e * vm_dump.c (rb_vm_bugreport): see CrashReport log on Mac OS X.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-27 06:45:30 +00:00
naruse 086301ac73 * addr2line.c: added to show source filename and line number of
functions in backtrace. [ruby-dev:42625]
  a patch from shinichiro.h <shinichiro.hamaji AT gmail.com>

* addr2line.h: ditto.

* common.mk: add addr2line.$(OBJEXT).

* configure.in: check dl_iterate_phdr.

* vm_dump.c (rb_vm_bugreport): use rb_dump_backtrace_with_lines in
  addr2line.c when the binary is ELF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 03:28:50 +00:00
usa f55d567b59 * vm_dump.c (dump_thread): get only required rights of the target
thread because THREAD_ALL_ACCESS causes an access error on XP.
  reported by Masaya TARUI via IRC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 02:42:46 +00:00
usa 952a357274 * vm_dump.c (dump_thread): show the displacement from the beginning
of the symbol.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 02:10:25 +00:00
usa b96d267c7e * vm_dump.c (dump_thread): follow the output of glibc.
see [ruby-dev:42627]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 01:50:18 +00:00
usa 6f581a68b8 * vm_dump.c (dump_thread): seems to be necessary the 3rd argument of
SymGetLineFromAddr64(), even though MSDN says it can be zero.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-26 00:34:04 +00:00
nobu 8a7aad9952 * fix type warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:30:39 +00:00