This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Async function calls
- From: Vladimir Prus <vladimir at codesourcery dot com>
- To: gdb at sources dot redhat dot com
- Date: Thu, 20 Mar 2008 10:44:46 +0300
- Subject: Async function calls
Right now, most commands that start inferior have provisions for async
execution -- if a command has to do something after the inferior is
stopped, it adds a 'continuation' which is executed.
The notable exception is the code for calling inferior functions. We
cannot use the continuation trick directly, because function call is
done in the middle of expression evaluation, in general, so we should
return the called function's return value. We cannot return to
event loop, then handle inferior stop event, and then continue
evaluating the expression.
Then, the only way to make function calls async would be run
inner event loop inside call_function_by_hand. This is honestly
scary. Worst case, user can go as far as to start a different program,
possibly invalidating lots of data that callers of call_function_by_hand
will try to use. And in general, if we wait long enough, all of program
state can change. Of course, we can "audit" all the code involved in
evaluating an expression, figure which commands or events can adversely
affect that code, and then disallow those commands while inferior call
is in progress, but that sounds like a huge amount of work.
Maybe, somebody have bright ideas?
Thanks,
Volodya