aboutsummaryrefslogtreecommitdiffstats
path: root/vm_backtrace.c
Commit message (Collapse)AuthorAgeFilesLines
* introduce rb_thread_ptr() to replace GetThreadPtr().ko12017-06-281-5/+4
| | | | | | | | | | * vm_core.h (rb_thread_ptr): added to replace GetThreadPtr() macro. * thread.c (in some functions: use "target_th" instead of "th" to make clear that it is not a current thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-2/+2
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename absolute_path to realpath internally and introduce pathobj.ko12017-06-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h: rename absolute_path to realpath because it is expected name. external APIs (#absolute_path methods) are remained. * vm_core.h: remove rb_iseq_location_struct::path and rb_iseq_location_struct::absolute_path and introduce pathobj. if given path equals to given absolute_path (and most of case it is true), pathobj is simply given path String. If it is not same, pathobj is Array and pathobj[0] is path and pathobj[1] is realpath. This size optimization reduce 8 bytes and sizeof(struct rb_iseq_constant_body) is 200 bytes -> 192 bytes on 64bit CPU. To support this change, the following functions are introduced: * pathobj_path() (defined in vm_core.h) * pathobj_realpath() (ditto) * rb_iseq_path() (decl. in vm_core.h) * rb_iseq_realpath() (ditto) * rb_iseq_pathobj_new() (ditto) * rb_iseq_pathobj_set() (ditto) * vm_core.h (rb_binding_t): use pathobj instead of path. If binding is given at eval methods, realpath (absolute_path) was caller's realpath. However, they should use binding's realpath. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_execution_context_t: move stack, stack_size and cfp from rb_thread_tnormal2017-05-091-4/+4
| | | | | | | | | | The goal is to reduce rb_context_t and rb_fiber_t size by removing the need to store the entire rb_thread_t in there. [ruby-core:81045] Work-in-progress: soon, we will move more fields here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: backtrace of circular requirenobu2017-04-251-4/+12
| | | | | | | * load.c (load_lock): print backtrace of circular require via `Warning.warn` [ruby-core:80850] [Bug #13505] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: backtrace functions per threadsnobu2017-04-171-19/+13
| | | | | | | | | | | | * vm_backtrace.c (rb_threadptr_backtrace_object): rename and extern. * vm_backtrace.c (rb_threadptr_backtrace_str_ary): rename as threadptr since the parameter is rb_thread_t*. * vm_backtrace.c (rb_threadptr_backtrace_location_ary): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_trace.c (tracepoint_attr_callee_id, rb_tracearg_callee_id):ktsj2016-11-051-1/+1
| | | | | | | | | | | add TracePoint#callee_id. [ruby-core:77241] [Feature #12747] * cont.c, eval.c, gc.c, include/ruby/intern.h, insns.def, thread.c, vm.c, vm_backtrace.c, vm_core.h, vm_eval.c, vm_insnhelper.c, vm_trace.c: ditto. * test/ruby/test_settracefunc.rb: tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56593 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h (WARN_UNUSED_RESULT): moved to configure.in, toshyouhei2016-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | actually check its availability rather to check GCC's version. * configure.in (WARN_UNUSED_RESULT): moved to here. * configure.in (RUBY_FUNC_ATTRIBUTE): change function declaration to return int rather than void, because it makes no sense for a warn_unused_result attributed function to return void. Funny thing however is that it also makes no sense for noreturn attributed function to return int. So there is a fundamental conflict between them. While I tested this, I confirmed both GCC 6 and Clang 3.8 prefers int over void to correctly detect necessary attributes under this setup. Maybe subject to change in future. * internal.h (UNINITIALIZED_VAR): renamed to MAYBE_UNUSED, then moved to configure.in for the same reason we move WARN_UNUSED_RESULT. * configure.in (MAYBE_UNUSED): moved to here. * internal.h (__has_attribute): deleted, because it has no use now. * string.c (rb_str_enumerate_lines): refactor macro rename. * string.c (rb_str_enumerate_bytes): ditto. * string.c (rb_str_enumerate_chars): ditto. * string.c (rb_str_enumerate_codepoints): ditto. * thread.c (do_select): ditto. * vm_backtrace.c (rb_debug_inspector_open): ditto. * vsnprintf.c (BSD_vfprintf): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56169 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: introduce VM_FRAME_RUBYFRAME_P()ko12016-08-031-6/+5
| | | | | | | | | | | | | | 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
* use TH_JUMP_TAGnobu2016-05-051-1/+1
| | | | | | | | * vm_eval.c (rb_eval_cmd, rb_catch_obj): use TH_JUMP_TAG with the same rb_thread_t used for TH_PUSH_TAG, instead of JUMP_TAG with the current thread global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (frame2klass): filter only for imemo_ment.ko12016-04-111-5/+5
| | | | | | | T_IMEMO/imemo_iseq can be passed here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: ignore ifunc framesnobu2015-12-211-5/+5
| | | | | | | * vm_backtrace.c (rb_profile_frames): ignore ifunc frames as it did before. [ruby-core:72409] [Bug #11851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* version.c: remove ruby_engine_namenobu2015-11-291-2/+2
| | | | | | | | | | | | | * ruby.c (load_file_internal, ruby_process_options): share ruby_engine instead of literal strings. * version.c (Init_version): remove internal `ruby_engine_name`, but set the VM program name in addition to the global constant. * vm_backtrace.c (location_to_str, oldbt_init): use th eVM program name always. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * make rb_iseq_t T_IMEMO object (type is imemo_iseq).ko12015-07-211-41/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * vm_backtrace.c: remove debug flag introduced accidentaly.ko12015-07-071-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.ko12015-07-061-13/+68
| | | | | | | | | | | | | | | | | | | | | | * internal.h, iseq.c (rb_iseq_klass): remove it because rb_iseq_t::klass is removed. * vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but check callable method entry on a frame. This fix simplify the logic to search super class. * test/ruby/test_method.rb: support super() from Proc. Now, [Bug #4881] and [Bug #3136] was solved. * proc.c (rb_mod_define_method): catch up this change. * vm.c (vm_define_method): ditto. * vm_backtrace.c (rb_profile_frames): now, each `frame' objects are rb_callable_method_entry_t data or iseq VALUEs. This fix introduce minor compatibility issue that rb_profile_frame_label() always returns rb_profile_frame_base_label(). * test/-ext-/debug/test_profile_frames.rb: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * method.h: introduce rb_callable_method_entry_t to removeko12015-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* * method.h: make rb_method_entry_t a VALUE.ko12015-06-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* vm_backtrace.c: use rb_id2strnobu2015-04-141-1/+1
| | | | | | | * vm_backtrace.c (location_base_label): convert ID to string directly, and the return value is frozen. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use 0 for reservednobu2014-12-011-2/+2
| | | | | | | use 0 for rb_data_type_t::reserved instead of NULL, since its type may be changed in the future and possibly not a pointer type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Gather declarations in non-header files.akr2014-11-181-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: Include ruby.h and ruby/encoding.h to beakr2014-11-151-3/+1
| | | | | | | | includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_core.h, proc.c, vm_backtrace.c, vm_trace.c:ktsj2014-10-181-1/+1
| | | | | | remove rb_binding_new_with_cfp, and use rb_vm_make_binding instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48001 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (id2str): Fix a variable name.akr2014-10-161-1/+1
| | | | | | | | [ruby-dev:48642] [Bug #10389] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: fix unknown ID namenobu2014-10-151-0/+9
| | | | | | | | * vm_backtrace.c (id2str): adapt rb_id2str which returns 0 on unknown ID to return Qnil, since oldbt_arg functions expect Qnil on unknown method names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: unknown name methodnobu2014-10-151-4/+8
| | | | | | | * vm_backtrace.c (location_format): adjust unknown name method results to other functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* simplify some trivial rb_data_type_t callbacksnormal2014-09-131-27/+12
| | | | | | | | | | | | | | | | | | * process.c (free_exec_arg): remove (memsize_exec_arg): ptr is never NULL (exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE * variable.c (autoload_i_free): remove (autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE (autoload_memsize): ptr is never NULL * vm_backtrace.c (location_free): remove (location_mark): ptr is never NULL (location_data_type): use RUBY_TYPED_DEFAULT_FREE (backtrace_mark): ditto (backtrace_free): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* constify parametersnobu2014-06-181-4/+4
| | | | | | | | * include/ruby/intern.h: constify `argv` parameters. * include/ruby/ruby.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46459 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: initialize flagnobu2014-01-241-1/+1
| | | | | | | * vm_backtrace.c (rb_backtrace_print_as_bugreport): initialize header-printed flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * error.c: add Exception#backtrace_locations.ko12013-12-131-1/+15
| | | | | | | | | | | | | | | Now, there are no setter and independent from Exception#backtrace. [Feature #8960] * eval.c (setup_exception): set backtrace locations for `bt_location' special attribute. * vm_backtrace.c (rb_backtrace_to_location_ary): added. * internal.h: ditto. * test/ruby/test_backtrace.rb: add a test for Exception#backtrace_locations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko12013-10-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | safe functions during garbage collection such as xfree(). On default, T_DATA objects are freed at same points as fianlizers. This approach protects issues such as reported by [ruby-dev:35578]. However, freeing T_DATA objects immediately helps heap usage. Most of T_DATA (in other words, most of dfree functions) are safe. However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default for safety. * cont.c: ditto. * dir.c: ditto. * encoding.c: ditto. * enumerator.c: ditto. * error.c: ditto. * file.c: ditto. * gc.c: ditto. * io.c: ditto. * iseq.c: ditto. * marshal.c: ditto. * parse.y: ditto. * proc.c: ditto. * process.c: ditto. * random.c: ditto. * thread.c: ditto. * time.c: ditto. * transcode.c: ditto. * variable.c: ditto. * vm.c: ditto. * vm_backtrace.c: ditto. * vm_trace.c: ditto. * ext/bigdecimal/bigdecimal.c: ditto. * ext/objspace/objspace.c: ditto. * ext/stringio/stringio.c: ditto. * ext/strscan/strscan.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (rb_profile_frame_classpath): do not use rb_inspecttmm12013-10-271-1/+1
| | | | | | directly, since it might have a custom implementation or show ivars. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (rb_profile_frame_classpath): handle singletontmm12013-10-271-0/+2
| | | | | | methods defined directly on an object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: copy without creating prefix stringnobu2013-10-091-2/+2
| | | | | | | * vm_backtrace.c (rb_profile_frame_full_label): copy from label directly, without creating prefix string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/debug.h,ko12013-10-091-0/+19
| | | | | | | | | | | | | | vm_backtrace.c (rb_profile_frame_full_label): add new C API rb_profile_frame_full_label() which returns label with qualified method name. Note that in future version of Ruby label() may return same return value of full_label(). * ext/-test-/debug/profile_frames.c, test/-ext-/debug/test_profile_frames.rb: fix a test for this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c: display backtrace to $stderrnobu2013-10-081-0/+29
| | | | | | | | | * load.c (load_lock): display backtrace to $stderr at circular require. * vm_backtrace.c (rb_backtrace_print_to): new function to print backtrace to the given output. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c, include/ruby/debug.h: add new APIsko12013-10-081-0/+27
| | | | | | | | | | | | | * VALUE rb_profile_frame_method_name(VALUE frame) * VALUE rb_profile_frame_qualified_method_name(VALUE frame) * iseq.c (rb_iseq_klass), internal.h: add new internal function rb_iseq_method_name(). * ext/-test-/debug/profile_frames.c (profile_frames), test/-ext-/debug/test_profile_frames.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/debug.h: add backtrace collecting APIs for profiler.ko12013-10-071-0/+87
| | | | | | | | | | | | | | | | | | | | | | | * int rb_profile_frames(int start, int limit, VALUE *buff, int *lines); Collect information of frame information. * VALUE rb_profile_frame_path(VALUE frame); * VALUE rb_profile_frame_absolute_path(VALUE frame); * VALUE rb_profile_frame_label(VALUE frame); * VALUE rb_profile_frame_base_label(VALUE frame); * VALUE rb_profile_frame_first_lineno(VALUE frame); * VALUE rb_profile_frame_classpath(VALUE frame); * VALUE rb_profile_frame_singleton_method_p(VALUE frame); Get information about each frame. These APIs are designed for profilers, for example, no objectallocation, and enough information for profilers. In this version, this API collects only collect Ruby level frames. This issue will be fixed after Ruby 2.1. * vm_backtrace.c: implement above APIs. * iseq.c (rb_iseq_klass): return local_iseq's class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument ifsorah2013-09-101-0/+2
| | | | | | | | | it is nil. [Bug #8884] [ruby-core:57094] * test/ruby/test_backtrace.rb (test_caller_with_nil_length): Test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1zzak2013-06-171-3/+20
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}nobu2013-04-051-6/+2
| | | | | | | * include/ruby/defines.h (RUBY_SYMBOL_EXPORT_{BEGIN,END}): visibility control macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* prefix global symbolsnobu2013-03-061-6/+6
| | | | | | | | | | | | | | * iseq.c (rb_insn_operand_intern): prefix global symbols. * numeric.c (ruby_num_interval_step_size): ditto. * vm_backtrace.c (rb_vm_backtrace_str_ary), (rb_vm_backtrace_location_ary, rb_vm_thread_backtrace), (rb_vm_thread_backtrace_locations): ditto. * vm_trace.c (rb_vm_trace_mark_event_hooks): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c: fix issue of rb_debug_inspector_open().ko12013-01-291-13/+72
| | | | | | | | | | | | | | | | | | | The order of making binding should be stack (frame) top to bottom. [Bug #7635] And also fix issue of collecting klass. Collecting klass is same as TracePoint#defined_class. (previous version, it returns T_ICLASS (internal objects). * test/-ext-/debug/test_debug.rb: add a test. * ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto. * vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*. * vm_backtrace.c, include/ruby/debug.h: add new C api (experimental) rb_debug_inspector_frame_self_get(). * vm.c, vm_core.h, vm_trace.c: move decl. of rb_vm_control_frame_id_and_class() and constify first parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: use longnobu2013-01-281-6/+6
| | | | | | | * vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get): use long as index as well as RARRAY_LEN(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c: Add documentation for Kernel#caller_locations,zzak2012-12-311-7/+126
| | | | | | | Kernel#caller, and Thread::Backtrace::Location git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).ko12012-12-031-1/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c (location_inspect_m): addko12012-12-011-0/+7
| | | | | | | | | Thread::Backtrace::Location#inspect. It same as loc_obj.to_s.inspect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: suppress warningnobu2012-11-301-1/+1
| | | | | | | * vm_backtrace.c (rb_debug_inspector_open): suppress uninitialized-variable warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c: RB_GC_GUARDnobu2012-11-301-3/+3
| | | | | | | | | | * include/ruby/ruby.h (RB_GC_GUARD_PTR): add note. * vm_backtrace.c (backtrace_to_str_ary): use RB_GC_GUARD() instead of RB_GC_GUARD_PTR() which has no effect. (backtrace_to_location_ary): ditto. (vm_backtrace_to_ary): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * vm_backtrace.c: add GC guards.ko12012-11-291-4/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e