diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-23 09:10:34 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-23 09:10:34 +0000 |
commit | 1942e9254744bc9629d2c7ea0e670e75051311de (patch) | |
tree | ed225c2142f2a3b7ae4a25fcd4833966b5bc81c9 /iseq.c | |
parent | a747834a69ffebd8a7b86e16b62fe7a36b30cf21 (diff) |
iseq.c: show first_lineno on iseq inspect
My motivation was to improve the output of `ruby --dump=insns xxx.rb`.
When one file has many iseqs, it's hard to find the one I want to read.
So I wanted `iseq_disasm` to show first_lineno. I unified the behavior
of `iseqw_disasm` for consistency.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1035,9 +1035,10 @@ iseqw_inspect(VALUE self) return rb_sprintf("#<%"PRIsVALUE": uninitialized>", klass); } else { - return rb_sprintf("<%"PRIsVALUE":%"PRIsVALUE"@%"PRIsVALUE">", + return rb_sprintf("<%"PRIsVALUE":%"PRIsVALUE"@%"PRIsVALUE":%d>", klass, - iseq->body->location.label, rb_iseq_path(iseq)); + iseq->body->location.label, rb_iseq_path(iseq), + FIX2INT(rb_iseq_first_lineno(iseq))); } } @@ -1661,7 +1662,9 @@ iseq_inspect(const rb_iseq_t *iseq) return rb_sprintf("#<ISeq: uninitialized>"); } else { - return rb_sprintf("#<ISeq:%s@%s>", RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(rb_iseq_path(iseq))); + return rb_sprintf("#<ISeq:%s@%s:%d>", + RSTRING_PTR(iseq->body->location.label), RSTRING_PTR(rb_iseq_path(iseq)), + FIX2INT(rb_iseq_first_lineno(iseq))); } } |