1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

8 commits

Author SHA1 Message Date
ko1
a359da8420 * test/ruby/test_backtrace.rb: decrease recursion depth
to reduce consuming stack size.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 08:58:29 +00:00
ko1
2e7c769633 * test/ruby/test_backtrace.rb: fix test.
Windows path includes `:' character.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 03:04:34 +00:00
ko1
f6f769d26d * vm_backtrace.c: change names.
(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
2012-06-02 16:46:08 +00:00
ko1
9c3d8bb0f2 * test/ruby/test_backtrace.rb (test_caller_lev):
decreaze recursion size.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 06:31:31 +00:00
ko1
4f54d4710e * vm.c (RubyVM::FrameInfo): add a class to access each frame
information.  You don't need to parse strings from caller().
  FrameInfo has the following methods:
  FrameInfo#name: method name, class name, etc with decorations.
  FrameInfo#basename: name without decorations.
  FrameInfo#line_no: line number.
  FrameInfo#filename: file name.
  FrameInfo#filepath: full filepath.
  FrameInfo#iseq: iseq if it is iseq frame (defined by ruby script)
  FrameInfo#to_s: return caller() method style string.
  RubyVM::FrameInfoFrameInfo.caller(n, lev) returns array of
  FrameInfo objects.  The name "RubyVM::FrameInfoFrameInfo.caller"
  is long and ambiguous (same as caller() method), we need to change
  the name before Ruby 2.0 release.
  Good names or comments are welcome.
* test/ruby/test_backtrace.rb: add a test for above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-26 04:49:23 +00:00
ko1
4258db7954 * vm_eval.c (rb_f_caller): caller() method accepts second optional
argument `n' which specify how many frames should return.
  For example, `caller(0, 1)' returns only one frame information
  which calls caller() method.  If there are less than n frame
  information, then all frame information are returned.  If n is 0,
  then always return [].
  This fix is part of [ruby-dev:42345] [Ruby 1.9-Feature#3917].
  However, performance and features are not enough.
  RDoc is also not available.
* test/ruby/test_backtrace.rb: add a test for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 11:01:01 +00:00
nobu
9a66f6f07e * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 04:53:54 +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