Re: Build question

Pedro Alves
2009-09-11T15:22:35Z

On Friday 11 September 2009 15:42:53, Danny Backx wrote:
> Question : it looks like breaking a gdb-gdbserver session always kills
> the inferior. Or at least it does so on my target. Has this been subject
> of research yet ? I would expect it to be possible to detach without
> killing the inferior, much like you can when debugging a linux process
> from a linux gdb.

What do you mean by breaking, and what do you mean by
detaching? Please be specific.

Neither DebugActiveProcessStop nor DebugSetProcessKillOnExit were support
by Windows CE up until version 5. I see that DebugActiveProcessStop
was added to CE 6.0:

http://msdn.microsoft.com/pt-br/library/aa924105.aspx

... although there's no sign of DebugSetProcessKillOnExit.

win32-low.c:win32_detach has this:

/* Detach from inferior PID. */
static int
win32_detach (int pid)
{
struct process_info *process;
winapi_DebugActiveProcessStop DebugActiveProcessStop = NULL;
winapi_DebugSetProcessKillOnExit DebugSetProcessKillOnExit = NULL;
#ifdef _WIN32_WCE
HMODULE dll = GetModuleHandle (_T("COREDLL.DLL"));
#else
HMODULE dll = GetModuleHandle (_T("KERNEL32.DLL"));
#endif
DebugActiveProcessStop = GETPROCADDRESS (dll, DebugActiveProcessStop);
DebugSetProcessKillOnExit = GETPROCADDRESS (dll, DebugSetProcessKillOnExit);

if (DebugSetProcessKillOnExit == NULL
|| DebugActiveProcessStop == NULL)
return -1;

Try checking if DebugActiveProcessStop is non-NULL here on
your CE >= 6.0 device, and tweak this code to make it possible to detach
with DebugActiveProcessStop even if we don't support
DebugSetProcessKillOnExit.

(In fact, I don't understand why DebugSetProcessKillOnExit is
needed here. does Windows really kill a detached inferior when
gdbserver exits _after_having_detached_from_it_?)

--
Pedro Alves