1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-05-26 07:38:57 +00:00
parent 075ca923a4
commit 93fc059178

View file

@ -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;