* Async function calls
@ 2008-03-20 12:10 Vladimir Prus
2008-03-20 12:22 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2008-03-20 12:10 UTC (permalink / raw)
To: gdb
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Async function calls
2008-03-20 12:10 Async function calls Vladimir Prus
@ 2008-03-20 12:22 ` Daniel Jacobowitz
2008-03-20 16:23 ` Vladimir Prus
2008-03-20 17:35 ` Michael Snyder
0 siblings, 2 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-03-20 12:22 UTC (permalink / raw)
To: Vladimir Prus; +Cc: gdb
On Thu, Mar 20, 2008 at 10:44:46AM +0300, Vladimir Prus wrote:
> Maybe, somebody have bright ideas?
Could we pick out the inferior function calls and evaluate them first,
with continuations? Except that could change order of evaluation;
we'd have to read the values of variables at the same time.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Async function calls
2008-03-20 12:22 ` Daniel Jacobowitz
@ 2008-03-20 16:23 ` Vladimir Prus
2008-03-20 17:01 ` Daniel Jacobowitz
2008-03-20 17:35 ` Michael Snyder
1 sibling, 1 reply; 6+ messages in thread
From: Vladimir Prus @ 2008-03-20 16:23 UTC (permalink / raw)
To: gdb
Daniel Jacobowitz wrote:
> On Thu, Mar 20, 2008 at 10:44:46AM +0300, Vladimir Prus wrote:
>> Maybe, somebody have bright ideas?
>
> Could we pick out the inferior function calls and evaluate them first,
> with continuations? Except that could change order of evaluation;
> we'd have to read the values of variables at the same time.
Will it help? Say, we do:
print foo()
then to do it async way, we have to do the function call, and then
'print' should get back to action and print the value. Right now,
print_command has no continuations, so we'll have to add it.
And likewise, it seems that every command that can call a function
will have to be converted to use continuation.
- Volodya
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Async function calls
2008-03-20 16:23 ` Vladimir Prus
@ 2008-03-20 17:01 ` Daniel Jacobowitz
2008-03-20 17:24 ` Daniel Jacobowitz
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-03-20 17:01 UTC (permalink / raw)
To: gdb, gdb
On Thu, Mar 20, 2008 at 03:21:44PM +0300, Vladimir Prus wrote:
> Will it help? Say, we do:
>
> print foo()
>
> then to do it async way, we have to do the function call, and then
> 'print' should get back to action and print the value. Right now,
> print_command has no continuations, so we'll have to add it.
> And likewise, it seems that every command that can call a function
> will have to be converted to use continuation.
You're right, it wouldn't help unless we did this all the way from
the top: centralized parsing for commands before we dispatched to
the command functions, that knew what was an expression. And I don't
think that's a practical idea.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Async function calls
2008-03-20 17:01 ` Daniel Jacobowitz
@ 2008-03-20 17:24 ` Daniel Jacobowitz
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2008-03-20 17:24 UTC (permalink / raw)
To: gdb, gdb
On Thu, Mar 20, 2008 at 03:21:44PM +0300, Vladimir Prus wrote:
> Will it help? Say, we do:
>
> print foo()
>
> then to do it async way, we have to do the function call, and then
> 'print' should get back to action and print the value. Right now,
> print_command has no continuations, so we'll have to add it.
> And likewise, it seems that every command that can call a function
> will have to be converted to use continuation.
You're right, it wouldn't help unless we did this all the way from
the top: centralized parsing for commands before we dispatched to
the command functions, that knew what was an expression. And I don't
think that's a practical idea.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Async function calls
2008-03-20 12:22 ` Daniel Jacobowitz
2008-03-20 16:23 ` Vladimir Prus
@ 2008-03-20 17:35 ` Michael Snyder
1 sibling, 0 replies; 6+ messages in thread
From: Michael Snyder @ 2008-03-20 17:35 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: Vladimir Prus, gdb
On Thu, 2008-03-20 at 08:10 -0400, Daniel Jacobowitz wrote:
> On Thu, Mar 20, 2008 at 10:44:46AM +0300, Vladimir Prus wrote:
> > Maybe, somebody have bright ideas?
>
> Could we pick out the inferior function calls and evaluate them first,
> with continuations? Except that could change order of evaluation;
> we'd have to read the values of variables at the same time.
Sounds like a job for -- ax-gdb!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-03-20 17:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-20 12:10 Async function calls Vladimir Prus
2008-03-20 12:22 ` Daniel Jacobowitz
2008-03-20 16:23 ` Vladimir Prus
2008-03-20 17:01 ` Daniel Jacobowitz
2008-03-20 17:24 ` Daniel Jacobowitz
2008-03-20 17:35 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox