summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/tracer.rb2
-rw-r--r--test/test_tracer.rb20
-rw-r--r--version.h2
4 files changed, 27 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ff2542f9ec..f38830e412 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 17 08:30:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tracer.rb: count only non-internal libraries in stack trace,
+ ignoring custom_require. [ruby-core:31858]
+
Thu Sep 16 08:30:28 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyuki
diff --git a/lib/tracer.rb b/lib/tracer.rb
index a0b4fdf133..318b254ac8 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -190,6 +190,6 @@ if $0 == __FILE__
ARGV.shift
Tracer.on
require $0
-elsif caller.size <= 1
+elsif caller.count {|bt| /\A<internal:[^<>]+>:/ !~ bt} <= 1
Tracer.on
end
diff --git a/test/test_tracer.rb b/test/test_tracer.rb
new file mode 100644
index 0000000000..2580205338
--- /dev/null
+++ b/test/test_tracer.rb
@@ -0,0 +1,20 @@
+require 'test/unit'
+require_relative 'ruby/envutil'
+
+class TestTracer < Test::Unit::TestCase
+ include EnvUtil
+
+ def test_work_with_e
+ assert_in_out_err(%w[-rtracer -e 1]) do |(*lines),|
+ case lines.size
+ when 2
+ assert_match %r[#0:<internal:lib/rubygems/custom_require>:\d+:Kernel:<: -], lines[0]
+ when 1
+ # do nothing
+ else
+ flunk 'unexpected output from `ruby -rtracer -e 1`'
+ end
+ assert_equal "#0:-e:1::-: 1", lines[1]
+ end
+ end
+end
diff --git a/version.h b/version.h
index 3ab160be85..b3c9161237 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_PATCHLEVEL 46
+#define RUBY_PATCHLEVEL 47
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1