I made a patch to Thread#caller(lev=1).  It may be more flexible than
fetching "all" backtrace.
How about it? (not tested enough)

> Index: vm_eval.c
> ===================================================================
> --- vm_eval.c	(リビジョン 23650)
> +++ vm_eval.c	(作業コピー)
> @@ -1342,6 +1342,19 @@ rb_make_backtrace(void)
>  }
>  
>  VALUE
> +rb_thread_backtrace(VALUE thval, int lev)
> +{
> +    rb_thread_t *th;
> +    GetThreadPtr(thval, th);
> +
> +    if (th->status != THREAD_KILLED && GET_THREAD() != th) {
> +	lev--;
> +    }
> +
> +    return vm_backtrace(th, lev);
> +}
> +
> +VALUE
>  rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg)
>  {
>      return vm_backtrace_each(GET_THREAD(), -1, iter, arg);
> Index: thread.c
> ===================================================================
> --- thread.c	(リビジョン 23651)
> +++ thread.c	(作業コピー)
> @@ -3817,6 +3817,26 @@ ruby_suppress_tracing(VALUE (*func)(VALU
>      return result;
>  }
>  
> +VALUE rb_thread_backtrace(VALUE thval, int lev);
> +
> +static VALUE
> +rb_thread_caller_m(int argc, VALUE *argv, VALUE thval)
> +{
> +    VALUE level;
> +    int lev;
> +
> +    rb_scan_args(argc, argv, "01", &level);
> +
> +    if (NIL_P(level))
> +	lev = 1;
> +    else
> +	lev = NUM2INT(level);
> +    if (lev < 0)
> +	rb_raise(rb_eArgError, "negative level (%d)", lev);
> +
> +    return rb_thread_backtrace(thval, lev);
> +}
> +
>  /*
>   *  +Thread+ encapsulates the behavior of a thread of
>   *  execution, including the main thread of the Ruby script.
> @@ -3873,6 +3893,7 @@ Init_Thread(void)
>      rb_define_method(rb_cThread, "abort_on_exception=", rb_thread_abort_exc_set, 1);
>      rb_define_method(rb_cThread, "safe_level", rb_thread_safe_level, 0);
>      rb_define_method(rb_cThread, "group", rb_thread_group, 0);
> +    rb_define_method(rb_cThread, "caller", rb_thread_caller_m, -1);
>  
>      rb_define_method(rb_cThread, "inspect", rb_thread_inspect, 0);
>  

Roger Pack wrote::
> Bug #977: caller for all threads patch
> http://redmine.ruby-lang.org/issues/show/977
> 
> Author: Roger Pack
> Status: Open, Priority: Normal
> 
> Here is a patch which provides backtrace for all current threads, instead of just the current one.
> http://ph7spot.com/articles/caller_for_all_threads
> Author said it would be great to have it accepted upstream.
> Thoughts?
> -=r
> 
> 
> ----------------------------------------
> http://redmine.ruby-lang.org
> 


-- 
// SASADA Koichi at atdot dot net