From: Pedro Alves <pedro@codesourcery.com>
To: gdb@sourceware.org
Cc: Doug Evans <dje@google.com>
Subject: Re: bogus extra code in gdbserver detach command support?
Date: Tue, 26 Apr 2011 10:37:00 -0000 [thread overview]
Message-ID: <201104261137.45851.pedro@codesourcery.com> (raw)
In-Reply-To: <20110425215758.AEED22461A8@ruffy.mtv.corp.google.com>
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
prev parent reply other threads:[~2011-04-26 10:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-25 21:58 Doug Evans
2011-04-26 10:37 ` Pedro Alves [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201104261137.45851.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=dje@google.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox