From patchwork Thu Jun 2 09:30:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yao Qi X-Patchwork-Id: 12704 Received: (qmail 83684 invoked by alias); 2 Jun 2016 09:31:16 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 83595 invoked by uid 89); 2 Jun 2016 09:31:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=SRC X-HELO: mail-pf0-f195.google.com Received: from mail-pf0-f195.google.com (HELO mail-pf0-f195.google.com) (209.85.192.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 02 Jun 2016 09:31:05 +0000 Received: by mail-pf0-f195.google.com with SMTP id b124so7384245pfb.0 for ; Thu, 02 Jun 2016 02:31:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=bqRC0v9JSH56WdyJNe59Idw8kMtoYi4SCR+VZHaqXEk=; b=crRpv1AqXcZDWcZ559YPx+iecx2sJ254JYqlHLBtZ+10grkRpAQMLc16xvPdAy+ALx fmPLRm3zjhiYf1nS5LJyJ1DYWvjkYV733Q/3dHSZg7D6UvNnDS4gerSp+PCtYJthAsfP PwHJSnBrc2IVbz5KcShcZy8/RDN7R6v1ScUVFvUnkz7ey9CZxoQV+Y8UfuSrUCH6E3mW zZAxNQNYfgRBXWxHXVMKaOgq+Tw8GhUEm1Wkj4Ekjx2tR/VAMYIbTqKNJjwzeo/5SX8+ iymG+d66AtZLK9xh6nrLYp6dnZ3CDQ+M9socwE+FKJRSGVHLKP8bux3YBn+7K1YLkn45 BiyA== X-Gm-Message-State: ALyK8tLRnmGzX9KMzB6jseJlsmNHvDQPOed1tQD397wTTM5jSWZ7kOTH6RkvB0BxSMQzRg== X-Received: by 10.98.6.69 with SMTP id 66mr2597417pfg.115.1464859864035; Thu, 02 Jun 2016 02:31:04 -0700 (PDT) Received: from E107787-LIN.cambridge.arm.com (gcc113.osuosl.org. [140.211.9.71]) by smtp.gmail.com with ESMTPSA id hw10sm68656218pac.15.2016.06.02.02.31.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 02:31:03 -0700 (PDT) From: Yao Qi X-Google-Original-From: Yao Qi To: gdb-patches@sourceware.org Subject: [PATCH 08/12] Refactor clone_all_breakpoints Date: Thu, 2 Jun 2016 10:30:42 +0100 Message-Id: <1464859846-15619-9-git-send-email-yao.qi@linaro.org> In-Reply-To: <1464859846-15619-1-git-send-email-yao.qi@linaro.org> References: <1464859846-15619-1-git-send-email-yao.qi@linaro.org> X-IsSubscribed: yes V2: pass parent thread instead of parent process to clone_all_breakpoints, This patch is to change the interface of clone_all_breakpoints, from lists of breakpoints and raw_breakpoints to child thread and parent thread. I choose child thread to pass because we need the ptid of the child thread in the following patch. gdb/gdbserver: 2016-05-20 Yao Qi * mem-break.c (clone_all_breakpoints): Remove all parameters. Add new parameters child_thread and parent_thread. Callers updated. * mem-break.h (clone_all_breakpoints): Update declaration. --- gdb/gdbserver/linux-low.c | 4 +--- gdb/gdbserver/mem-break.c | 15 ++++++++------- gdb/gdbserver/mem-break.h | 8 ++++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index dd92e78..b0af178 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -559,9 +559,7 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat) current_thread = saved_thread; } - clone_all_breakpoints (&child_proc->breakpoints, - &child_proc->raw_breakpoints, - parent_proc->breakpoints); + clone_all_breakpoints (child_thr, event_thr); tdesc = XNEW (struct target_desc); copy_target_description (tdesc, parent_proc->tdesc); diff --git a/gdb/gdbserver/mem-break.c b/gdb/gdbserver/mem-break.c index 3539422..6a38e6a 100644 --- a/gdb/gdbserver/mem-break.c +++ b/gdb/gdbserver/mem-break.c @@ -2184,21 +2184,22 @@ clone_one_breakpoint (const struct breakpoint *src) return dest; } -/* Create a new breakpoint list NEW_LIST that is a copy of the - list starting at SRC_LIST. Create the corresponding new - raw_breakpoint list NEW_RAW_LIST as well. */ +/* See mem-break.h. */ void -clone_all_breakpoints (struct breakpoint **new_list, - struct raw_breakpoint **new_raw_list, - const struct breakpoint *src_list) +clone_all_breakpoints (struct thread_info *child_thread, + struct thread_info *parent_thread) { const struct breakpoint *bp; struct breakpoint *new_bkpt; struct breakpoint *bkpt_tail = NULL; struct raw_breakpoint *raw_bkpt_tail = NULL; + struct process_info *child_proc = get_thread_process (child_thread); + struct process_info *parent_proc = get_thread_process (parent_thread); + struct breakpoint **new_list = &child_proc->breakpoints; + struct raw_breakpoint **new_raw_list = &child_proc->raw_breakpoints; - for (bp = src_list; bp != NULL; bp = bp->next) + for (bp = parent_proc->breakpoints; bp != NULL; bp = bp->next) { new_bkpt = clone_one_breakpoint (bp); APPEND_TO_LIST (new_list, new_bkpt, bkpt_tail); diff --git a/gdb/gdbserver/mem-break.h b/gdb/gdbserver/mem-break.h index 321de12..d4af890 100644 --- a/gdb/gdbserver/mem-break.h +++ b/gdb/gdbserver/mem-break.h @@ -267,10 +267,10 @@ int insert_memory_breakpoint (struct raw_breakpoint *bp); int remove_memory_breakpoint (struct raw_breakpoint *bp); -/* Create a new breakpoint list NEW_BKPT_LIST that is a copy of SRC. */ +/* Create a new breakpoint list in CHILD_THREAD's process that is a + copy of breakpoint list in PARENT_THREAD's process. */ -void clone_all_breakpoints (struct breakpoint **new_bkpt_list, - struct raw_breakpoint **new_raw_bkpt_list, - const struct breakpoint *src); +void clone_all_breakpoints (struct thread_info *child_thread, + struct thread_info *parent_thread); #endif /* MEM_BREAK_H */