るりまサーチ

最速Rubyリファレンスマニュアル検索!
319件ヒット [1-100件を表示] (0.020秒)
トップページ > クエリ:end[x] > クエリ:backtrace[x]

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. io seek_end

検索結果

<< 1 2 3 ... > >>

Thread#backtrace -> [String] | nil (18131.0)

スレッドの現在のバックトレースを返します。

...def m1
sleep 5
end

def m2
m1
end

end


th = Thread.new {C1.new.m2; Thread.stop}
th.backtrace
# => [
# [0] "(irb):3:in `sleep'",
# [1] "(irb):3:in `m1'",
# [2] "(irb):6:in `m2'",
# [3] "(irb):10:in `block in irb_binding'"
# ]

th.kill
th.backtrace # => nil
//}...

Exception#backtrace -> [String] (18125.0)

バックトレース情報を返します。

...)
* "#{sourcefile}:#{sourceline}"
(トップレベルの場合)

という形式の String の配列です。

//emlist[例][ruby]{
def methd
raise
end


begin
methd
rescue => e
p e.backtrace
end


#=> ["filename.rb:2:in `methd'", "filename.rb:6"]
//}

@see Exception#backtrace_locations...

Exception#backtrace_locations -> [Thread::Backtrace::Location] (6270.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...バックトレース情報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require...
...return if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end


def get_exception
return begin
yield
rescue => e
e
end

end


e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main...
...>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}

@see Exception#backtrace...

Exception#set_backtrace(errinfo) -> nil | String | [String] (6131.0)

バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。

...定します。

//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end

rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.set_backtrace(["dummy1", "dummy2"])
$!.backtrace # => ["dummy1", "dummy2"]
end

//}...

rubygems/commands/dependency_command (6006.0)

インストールされている Gem パッケージの依存関係を表示するためのライブラリです。

...ge: gem dependency GEMNAME [options]
Options:
-v, --version VERSION 指定したバージョンの依存関係を表示します
--platform PLATFORM 指定したプラットフォームの依存関係を表示します
-R, --[no-]reverse-dependencies...
...静かに実行します
--config-file FILE 指定された設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッグオプションを有...
...効にします
Arguments:
GEMNAME 依存関係を表示する Gem の名前を指定します
Summary:
インストールされている Gem の依存関係を表示します
Defaults:
--local --version '>= 0' --no-reverse-dependencies...

絞り込み条件を変える

Thread::Backtrace::Location (3048.0)

Ruby のフレームを表すクラスです。

...成されます。

//emlist[例1][ruby]{
# caller_locations.rb
def a(skip)
caller_locations(skip)
end

def b(skip)
a(skip)
end

def c(skip)
b(skip)
end


c(0..2).map do |call|
puts call.to_s
end

//}

例1の実行結果:

caller_locations.rb:2:in `a'
caller_locations.rb:5:in `b'
caller_l...
...tions = caller_locations(skip)
end

end


Foo.new(0..2).locations.map do |call|
puts call.to_s
end

//}

例2の実行結果:

init.rb:4:in `initialize'
init.rb:8:in `new'
init.rb:8:in `<main>'

=== 参考

* Ruby VM アドベントカレンダー #4 vm_backtrace.c: https://www.atdot.net/~ko...

Thread::Backtrace::Location#base_label -> String (3040.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...d::Backtrace::Location#label から修飾を取り除いたもので構成
されます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end

end


Foo.new(0..2).locations.map do |call|
puts call.base_label
end


#...
...=> initialize
# new
# <main>
//}

@see Thread::Backtrace::Location#label...

Thread::Backtrace::Location#inspect -> String (3034.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end

end


Foo.new(0..2).loc...
...ations.map do |call|
puts call.inspect
end


# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}...

Thread::Backtrace::Location#absolute_path -> String (3024.0)

self が表すフレームの絶対パスを返します。

...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end

end


Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end


# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}

@see Thread::Backtrace::Location#path...
<< 1 2 3 ... > >>