summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-26 07:38:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-26 07:38:57 +0000
commit93fc059178c22cf58f8bcaf356bdb023a7363e3a (patch)
tree4608edcad521f5707f15cca9a2bdcf9e302062f2
parent075ca923a4b3bb4a47250ffe957906b8047eb47f (diff)
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.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/thread.c b/thread.c
index c717184f10b..cacea2c12bd 100644
--- a/thread.c
+++ b/thread.c
@@ -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;