ruby trace 功能嘗試

2021-07-02 18:18:59 字數 4368 閱讀 1092

因為想跟蹤ruby**執行,所以找到了這個功能,我想在別的語言上也找到響應實現,比如php、python。先談談ruby上的實現。

tr=tracepoint.new(:call) do |tp|

p [tp.lineno,tp.defined_class,tp.path,tp.method_id]

endtr.enable

執行這麼幾行,大功告成。運**況一覽無餘。

[204, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :notify?]

[198, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :<=>]

[179, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :peek]

[77, rubytoken, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :token]

[22, rubytoken::token, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :initialize

][276, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :token]

[69, irb::slex, "c:/ruby22/lib/ruby/2.2.0/irb/slex.rb", :match]

[203, irb::slex::node, "c:/ruby22/lib/ruby/2.2.0/irb/slex.rb", :match_io]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[143, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :ungetc]

[69, irb::notifier::abstractnotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :printf]

[204, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :notify?]

[198, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :<=>]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[179, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :peek]

[179, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :peek]

[747, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :identify_identifier]

[179, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :peek]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[143, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :ungetc]

[77, rubytoken, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :token]

[38, rubytoken::tkid, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :initialize]

[22, rubytoken::token, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :initialize

][33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[276, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :token]

[69, irb::slex, "c:/ruby22/lib/ruby/2.2.0/irb/slex.rb", :match]

[203, irb::slex::node, "c:/ruby22/lib/ruby/2.2.0/irb/slex.rb", :match_io]

[101, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc]

[203, irb::slex::node, "c:/ruby22/lib/ruby/2.2.0/irb/slex.rb", :match_io]

[135, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :getc_of_rests]

[69, irb::notifier::abstractnotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :printf]

[204, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :notify?]

[198, irb::notifier::levelednotifier, "c:/ruby22/lib/ruby/2.2.0/irb/notifier.rb"

, :<=>]

[33, #, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :debug?]

[77, rubytoken, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :token]

[22, rubytoken::token, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-token.rb", :initialize

][89, rubylex, "c:/ruby22/lib/ruby/2.2.0/irb/ruby-lex.rb", :get_readed]

[185, irb::readlineinputmethod, "c:/ruby22/lib/ruby/2.2.0/irb/input-method.rb",

111 簡單的Git提交功能嘗試

由於已經使用了gui的git一陣子了,現在的使用操作最初至少應該對標gui中常用的幾個操作來考慮一下。說到gui的操作,除了建立倉庫 變化對比之外,用的最多的或許就是提交了。接下來,嘗試命令列下的提交。同時,這次也切換我自己的終端到cmder。首先建立乙個新的倉庫 相比自帶的bash,這個好處除了主...

嘗試著說,嘗試著做

成長,需要磨練 生活,需要經歷 習慣,需要堅持。心裡有什麼,說出來 想什麼,寫出來 要什麼,做出來。很多東西,如果自己不去說,不去做。就真的成為自己的東西了,成為爛在自己心裡的東西了。如果自己不知道自己想做什麼,會做什麼,就嘗試著去想,嘗試著去做,不能讓自己在混沌中屏跡。如果自己沒有自己的心聲,就嘗...

分治嘗試A

簡單的分治 平面上最近點對 description 給定平面上n個點,找出其中的一對點的距離,使得這n個點的所有點對中,該距離為所有點對中最小的。input 第一行 n 2 n 60000 接下來n行 每行兩個整數 x y,表示乙個點的行座標和列座標,中間用乙個空格隔開。output 僅一行,乙個實...