Backtraces go back past call outs
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=1326
Reported by Martin Stjernholm mast@roxen.com
With the new backend system, backtraces in call outs give info that is not part of their context. E.g:
int main()
{
call_out (lambda () {error ("foo\n");}, 0);
return -1;
}
produces:
foo
/home/mast/foo.pike:3: __lambda_65590_0()
backend.cmod:2095: `()(3600.000000)
Note the backend.cmod frame. The backtrace also contains the _main frame, but describe_backtrace doesn't write that one out. I consider this an error since those frames are not part of the caller context for the call out; a call out is always called without such a context, just like a function started in a thread.
The function _do_call_outs also exhibits this:
int main()
{
call_out (lambda () {error ("foo\n");}, 0);
_do_call_outs();
}
produces:
foo
/home/mast/foo.pike:3: __lambda_65590_0()
backend.cmod:2095: _do_call_outs()
/home/mast/foo.pike:4: main()
(This might also cause security problems in sandbox situations, since a sandboxed function could use backtrace() to get references to objects outside its restricted environment.)