* bogus extra code in gdbserver detach command support?
@ 2011-04-25 21:58 Doug Evans
2011-04-26 10:37 ` Pedro Alves
0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2011-04-25 21:58 UTC (permalink / raw)
To: gdb
Hi.
Under what circumstances does this code in server.c actually do something?
/* If we are attached, then we can exit. Otherwise, we
need to hang around doing nothing, until the child is
gone. */
for_each_inferior (&all_processes,
join_inferiors_callback);
This is for the 'D' packet.
AIUI, this code will already have emptied all_processes:
if (detach_inferior (pid) != 0)
write_enn (own_buf);
Or can multiprocess debugging be used without the extended remote protocol?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: bogus extra code in gdbserver detach command support?
2011-04-25 21:58 bogus extra code in gdbserver detach command support? Doug Evans
@ 2011-04-26 10:37 ` Pedro Alves
0 siblings, 0 replies; 2+ messages in thread
From: Pedro Alves @ 2011-04-26 10:37 UTC (permalink / raw)
To: gdb; +Cc: Doug Evans
On Monday 25 April 2011 22:57:58, Doug Evans wrote:
> Hi.
>
> Under what circumstances does this code in server.c actually do something?
>
> /* If we are attached, then we can exit. Otherwise, we
> need to hang around doing nothing, until the child is
> gone. */
> for_each_inferior (&all_processes,
> join_inferiors_callback);
>
> This is for the 'D' packet.
> AIUI, this code will already have emptied all_processes:
>
> if (detach_inferior (pid) != 0)
> write_enn (own_buf);
Hmm, looks like I broke this with the multi-process changes. If you
look back at, e.g., gdb 6.8, the join backend implementations would work
because they only relied on the signal_pid global, not any process
structure:
static void
linux_join (void)
{
extern unsigned long signal_pid;
int status, ret;
do {
ret = waitpid (signal_pid, &status, 0);
if (WIFEXITED (status) || WIFSIGNALED (status))
break;
} while (ret != -1 || errno != ECHILD);
}
/* Wait for inferiors to end. */
static void
win32_join (void)
{
extern unsigned long signal_pid;
HANDLE h = OpenProcess (PROCESS_ALL_ACCESS, FALSE, signal_pid);
if (h != NULL)
{
WaitForSingleObject (h, INFINITE);
CloseHandle (h);
}
}
Looks like removing the:
struct process_info *process;
process = find_process_pid (pid);
if (process == NULL)
return;
bit from linux_join, and call join_inferior
directly on the detachee's pid from server.c
would restore the old behavior.
>
> Or can multiprocess debugging be used without the extended remote protocol?
Nope.
--
Pedro Alves
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-26 10:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-25 21:58 bogus extra code in gdbserver detach command support? Doug Evans
2011-04-26 10:37 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).