Is gdb script execution intended to work this way in async mode?

Doug Evans
Sat Mar 22 00:13:00 GMT 2014

If I source a script in target-async mode, non-asynchronous execution
commands "finish" immediately in the sense that the following command
in the script is done before the previous command has completed (in
the expected sense - the command completes immediately, so to speak,
but continuations are registered to perform the rest of the command,
e.g. to keep stepping until a "next" has fully completed).

I hope this is a bug.

main ()
  while (1)
    sleep (1);

set target-async on
file a.out
source foo.gdb



foo.gdb:2: Error in sourced command file:

Cannot execute this command while the selected thread is running.

Turn on the following for better visualization:
set debug infrun 1
set trace-commands on

The second "next" command is executed before the continuations that
implement the completion of the previous "next" command have, umm,

More information about the Gdb mailing list