summaryrefslogtreecommitdiff
path: root/vm_backtrace.c
AgeCommit message (Collapse)Author
2015-04-14vm_backtrace.c: use rb_id2strnobu
* 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
2014-12-01use 0 for reservednobu
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
2014-11-18* internal.h: Gather declarations in non-header files.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15* internal.h: Include ruby.h and ruby/encoding.h to beakr
includable without prior inclusion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-18* vm_core.h, proc.c, vm_backtrace.c, vm_trace.c:ktsj
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
2014-10-16* vm_backtrace.c (id2str): Fix a variable name.akr
[ruby-dev:48642] [Bug #10389] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-15vm_backtrace.c: fix unknown ID namenobu
* 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
2014-10-15vm_backtrace.c: unknown name methodnobu
* 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
2014-09-13simplify some trivial rb_data_type_t callbacksnormal
* 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
2014-06-18constify parametersnobu
* 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
2014-01-24vm_backtrace.c: initialize flagnobu
* 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
2013-12-13* error.c: add Exception#backtrace_locations.ko1
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
2013-10-29* add RUBY_TYPED_FREE_IMMEDIATELY to data types which only useko1
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
2013-10-27* vm_backtrace.c (rb_profile_frame_classpath): do not use rb_inspecttmm1
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
2013-10-27* vm_backtrace.c (rb_profile_frame_classpath): handle singletontmm1
methods defined directly on an object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09vm_backtrace.c: copy without creating prefix stringnobu
* 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
2013-10-09* include/ruby/debug.h,ko1
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
2013-10-08load.c: display backtrace to $stderrnobu
* 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
2013-10-08* vm_backtrace.c, include/ruby/debug.h: add new APIsko1
* 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
2013-10-07* include/ruby/debug.h: add backtrace collecting APIs for profiler.ko1
* 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
2013-09-10* vm_backtrace.c (vm_backtrace_to_ary): Ignore the second argument ifsorah
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
2013-06-17* vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1zzak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}nobu
* 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
2013-03-06prefix global symbolsnobu
* 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
2013-01-29* vm_backtrace.c: fix issue of rb_debug_inspector_open().ko1
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
2013-01-28vm_backtrace.c: use longnobu
* 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
2012-12-31* vm_backtrace.c: Add documentation for Kernel#caller_locations,zzak
Kernel#caller, and Thread::Backtrace::Location git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-03* vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01* vm_backtrace.c (location_inspect_m): addko1
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
2012-11-30vm_backtrace.c: suppress warningnobu
* 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
2012-11-30vm_backtrace.c: RB_GC_GUARDnobu
* 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
2012-11-29* vm_backtrace.c: add GC guards.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29remove trainling spacesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_backtrace.c (rb_debug_inspector_open): use RARRAY_LENINT() forko1
int variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* include/ruby/debug.h: add rb_debug_inspector_* APIs.ko1
* vm_backtrace.c: ditto. * common.mk: add dpendency from vm_backtrace.o to include/ruby/debug.h. * proc.c (rb_binding_new_with_cfp): constify. * vm.c (rb_vm_get_ruby_level_next_cfp): consitify. * vm_core.h, vm_trace.c: move decls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_backtrace.c: same as a last patch.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_backtrace.c: use `long' for return values of `NUM2LONG()'.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-29* vm_backtrace.c (vm_backtrace_to_ary): support range argumentko1
like Array#[]. [ruby-core:50092] [ruby-trunk - Feature #7434] Test and document is not available. Please help us. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* vm_backtrace.c (backtrace_to_str_ary2): rename to backtrace_to_str_ary.ko1
* vm_backtrace.c (rb_backtrace_to_str_ary): use `backtrace_to_str_ary()'. * vm_backtrace.c (backtrace_to_frame_ary): rename to backtrace_to_location_ary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* vm_backtrace.c: rename Class name fromko1
::RubyVM::Backtrace and ::RubyVM::Backtrace::Location to ::Thread::Backtrace and ::Thread::Backtrace::Location. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* vm_core.h (enum rb_thread_status): remove THREAD_TO_KILLkosaki
* vm_core.h (struct rb_thread_struct): add to_kill field * thread.c (terminate_i): convert THREAD_TO_KILL to to_kill. * thread.c (rb_threadptr_to_kill): ditto. * thread.c (rb_thread_kill): ditto. * thread.c (rb_thread_wakeup_alive): ditto. * thread.c (thread_list_i): ditto. * thread.c (static const char): ditto. * thread.c (thread_status_name): ditto. * thread.c (rb_thread_status): ditto. * thread.c (rb_thread_inspect): ditto. * vm_backtrace.c (thread_backtrace_to_ary): ditto. * thread.c (rb_threadptr_execute_interrupts): fix thread status overwritten issue. [Bug #7450] [ruby-core:50249] * test/ruby/test_thread.rb (test_hread_status_raise_after_kill): test for the above. * test/ruby/test_thread.rb (test_thread_status_in_trap): test for thread status in trap. * test/ruby/test_thread.rb (test_status_and_stop_p): remove Thread.control_interrupt unsafe test. Thread#kill no longer changes thread status. Instead of, Thread#kill receiver changes their own status when receiving kill signal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* vm_backtrace.c (vm_backtrace_to_ary): fix a typo of an variable name.nagachika
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* thread.c: add `Thread#backtrace_locations' method.ko1
This method is similart to `caller_locations' method for specific method. And fix to accept `level' and `n' parameters for `Thread#backtrace' and `Thread#backtrace_locations'. `caller' (and `caller_locations') do not return `caller' method frame. However, `Thread#backtrace' (and `Thread#backtrace_locations') return `Thread#backtrace' method frame itself if `Thread.current.backtrace' was called. * vm_backtrace.c: ditto. * internal.h: ditto. * test/ruby/test_backtrace.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-08internal.h: allocator function in rb_classext_tnobu
* internal.h (struct rb_classext_struct): move allocator function into rb_classext_t from ordinary method table. [ruby-dev:46121] [Feature #6993] * object.c (rb_obj_alloc): call allocator function directly. * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func) (rb_get_alloc_func): use allocator function in rb_classext_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15* vm_backtrace.c (backtrace_collect): rename from backtreace_collectkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15* vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).ko1
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-11 * compile.c (iseq_set_sequence): nonstatic initializer of anshyouhei
aggregate type is a C99ism. * compile.c (enum compile_array_type_t): comma at the end of enum list is a C99ism. * vm_backtrace.c (enum LOCATION_TYPE): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-08* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04* vm_core.h (rb_location_t): fix type and field name.ko1
(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-02* vm_backtrace.c: change names.ko1
(1) Class name: RubyVM::FrameInfo -> RubyVM::Backtrace::Location. (2) Method name: RubyVM::FrameInfo.caller -> Kernel.caller_locations. (3) Instance methods of RubyVM::FrameInfo (RubyVM::Backtrace::Location) (3-1) name -> label (3-2) basename -> base_label (basename is confusing with File.basename) (3-3) line_no -> lineno (We have already similar name File#lineno, commented by kou [ruby-dev:45686]). (3-4) filename -> path. (3-5) filepath -> absolute_path. (3-5) iseq -> removed (we will make other APIs to access iseq and other information of frame for debugging). * test/ruby/test_backtrace.rb: apply above changes. And apply comment from kou [ruby-dev:45686]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e