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:
parent
075ca923a4
commit
93fc059178
1 changed files with 13 additions and 1 deletions
14
thread.c
14
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue