diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-26 07:38:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-26 07:38:57 +0000 |
commit | 93fc059178c22cf58f8bcaf356bdb023a7363e3a (patch) | |
tree | 4608edcad521f5707f15cca9a2bdcf9e302062f2 | |
parent | 075ca923a4b3bb4a47250ffe957906b8047eb47f (diff) | |
download | ruby-93fc059178c22cf58f8bcaf356bdb023a7363e3a.tar.gz |
thread.c: inspect location
* thread.c (rb_thread_inspect): show the location of the block.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | thread.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -2686,7 +2686,19 @@ rb_thread_inspect(VALUE thread) GetThreadPtr(thread, th); status = thread_status_name(th); - str = rb_sprintf("#<%"PRIsVALUE":%p %s>", cname, (void *)thread, status); + str = rb_sprintf("#<%"PRIsVALUE":%p", cname, (void *)thread); + if (!th->first_func && th->first_proc) { + long i; + VALUE v, loc = rb_proc_location(th->first_proc); + if (!NIL_P(loc)) { + char sep = '@'; + for (i = 0; i < RARRAY_LEN(loc) && !NIL_P(v = RARRAY_AREF(loc, i)); ++i) { + rb_str_catf(str, "%c%"PRIsVALUE, sep, v); + sep = ':'; + } + } + } + rb_str_catf(str, " %s>", status); OBJ_INFECT(str, thread); return str; |