This patch adds linux native async mode support. It is based on the same idea as Nick's patch. The basic idea is that listening for SIGCHLD signals, call waitpid in the handler until we get all the pending waits out, and stuff the results in a pipe. This pipe is registered as the waitable file in the event loop at the appropriate times. I had to make a couple of target stack changes. I had to replace the target_async_mask_value target variable by a proper target method, which unfortunatelly makes me have to change remote.c as well. There are several target_can_async_p calls that are made *before* the running target is pushed on the stack. That problem wasn't visible in "target async", because there you're testing against a target that doesn't know how to run or attach anyway. I fixed it by making the dummy target look for the default run target like we do for the run and attach commands. This is the part that I think I could split out of this patch, but I though that showing it without showing this linux patch wouldn't make much sense. The patch still maintains support for non-async mode, which is why we see caring to enable/disable in async handling in several places. With this patch on top of the pending posted async patches, I only have regressions in define.exp. Those are not caused by this patch. They are generic async problems (that have to be fixed, but independently) that are visible in "target async" as well. To enable/disable async mode, there's a new set/show command "set linux-async 1" enables it. I left it on in this patch, but if/when this goes in, it should be turned off by default until we fix at least the defines.exp problems. To enable it from the command line, you can use gdb -ex "set linux-async 1", of course. (remote.c could take the same treatment and get rid of "target async"). There are no regressions if async mode is disabled. Comments ? I'll be happy to clarify more. -- Pedro Alves