From: Yao Qi <qiyaoltc@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 6/8] Set proc->priv->new_inferior out of linux_add_process
Date: Mon, 20 Jul 2015 11:36:00 -0000 [thread overview]
Message-ID: <1437392126-29503-7-git-send-email-yao.qi@linaro.org> (raw)
In-Reply-To: <1437392126-29503-1-git-send-email-yao.qi@linaro.org>
Nowadays, we set proc->priv->new_inferior to 1 inside linux_add_process,
and new_inferior is used as a flag to initialise target description later.
linux_add_process is used for the three cases, fork/vfork event
(handle_extended_wait), run the program (linux_create_inferior), and
attach to the process (linux_attach). In the first case, the child's
target description is copied from parent's, so we don't need to initialise
target description again later, which means we don't need to set
proc->priv->new_inferior to 1 in this case. For the rest of two cases,
we need this flag.
This patch move the code setting proc->priv->new_inferior to 1 inside
linux_add_process to linux_create_inferior and linux_attach. No
functionality is changed.
gdb/gdbserver:
2015-07-16 Yao Qi <yao.qi@linaro.org>
* linux-low.c (linux_add_process): Don't set
proc->priv->new_inferior.
(linux_create_inferior): Set proc->priv->new_inferior to 1.
(linux_attach): Likewise.
---
gdb/gdbserver/linux-low.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index 2dafb03..fa9dc29 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -405,9 +405,6 @@ linux_add_process (int pid, int attached)
proc = add_process (pid, attached);
proc->priv = xcalloc (1, sizeof (*proc->priv));
- /* Set the arch when the first LWP stops. */
- proc->priv->new_inferior = 1;
-
if (the_low_target.new_process != NULL)
proc->priv->arch_private = the_low_target.new_process ();
@@ -766,6 +763,7 @@ linux_create_inferior (char *program, char **allargs)
ptid_t ptid;
struct cleanup *restore_personality
= maybe_disable_address_space_randomization (disable_randomization);
+ struct process_info *proc;
#if defined(__UCLIBC__) && defined(HAS_NOMMU)
pid = vfork ();
@@ -813,7 +811,9 @@ linux_create_inferior (char *program, char **allargs)
do_cleanups (restore_personality);
- linux_add_process (pid, 0);
+ proc = linux_add_process (pid, 0);
+ /* Set the arch when the first LWP stops. */
+ proc->priv->new_inferior = 1;
ptid = ptid_build (pid, pid, 0);
new_lwp = add_lwp (ptid);
@@ -959,6 +959,7 @@ linux_attach (unsigned long pid)
{
ptid_t ptid = ptid_build (pid, pid, 0);
int err;
+ struct process_info *proc;
/* Attach to PID. We will check for other threads
soon. */
@@ -967,7 +968,9 @@ linux_attach (unsigned long pid)
error ("Cannot attach to process %ld: %s",
pid, linux_ptrace_attach_fail_reason_string (ptid, err));
- linux_add_process (pid, 1);
+ proc = linux_add_process (pid, 1);
+ /* Set the arch when the first LWP stops. */
+ proc->priv->new_inferior = 1;
if (!non_stop)
{
--
1.9.1
next prev parent reply other threads:[~2015-07-20 11:35 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 11:35 [PATCH 0/8] Fix various issues in --wrapper in GDBserver Yao Qi
2015-07-20 11:35 ` [PATCH 4/8] Test --wrapper when restarting process Yao Qi
2015-07-23 22:59 ` Pedro Alves
2015-07-20 11:35 ` [PATCH 1/8] Disallow using --attach and --wrapper together Yao Qi
2015-07-23 22:29 ` Pedro Alves
2015-07-24 8:44 ` Yao Qi
2015-07-24 8:51 ` Pedro Alves
2015-07-20 11:35 ` [PATCH 2/8] Test --wrapper in extended-remote Yao Qi
2015-07-23 22:35 ` Pedro Alves
2015-07-20 11:36 ` [PATCH 3/8] Set general_thread after restart Yao Qi
2015-07-23 22:58 ` Pedro Alves
2015-07-24 9:33 ` Yao Qi
2015-07-24 9:53 ` Pedro Alves
2015-07-24 11:31 ` Yao Qi
2015-07-20 11:36 ` [PATCH 7/8] Initialise target descrption after skipping extra traps for --wrapper Yao Qi
2015-07-23 23:26 ` Pedro Alves
2015-07-24 11:12 ` Yao Qi
2015-07-24 11:52 ` Pedro Alves
2015-07-24 13:08 ` Yao Qi
2015-07-24 13:44 ` Pedro Alves
2015-07-20 11:36 ` [PATCH 5/8] Refactor start_inferior Yao Qi
2015-07-23 23:27 ` Pedro Alves
2015-07-20 11:36 ` Yao Qi [this message]
2015-07-23 23:26 ` [PATCH 6/8] Set proc->priv->new_inferior out of linux_add_process Pedro Alves
2015-07-20 11:36 ` [PATCH 8/8] Remove proc->priv->new_inferior Yao Qi
2015-07-23 23:27 ` Pedro Alves
2015-07-24 13:49 ` [PATCH 0/8] Fix various issues in --wrapper in GDBserver Yao Qi
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=1437392126-29503-7-git-send-email-yao.qi@linaro.org \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@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