From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18595 invoked by alias); 9 Oct 2014 10:44:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 18519 invoked by uid 89); 9 Oct 2014 10:44:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Oct 2014 10:44:30 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s999qtPd018241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 9 Oct 2014 05:52:55 -0400 Received: from blade.nx (ovpn-116-100.ams2.redhat.com [10.36.116.100]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s999qrY1023465 for ; Thu, 9 Oct 2014 05:52:54 -0400 Received: from blade.nx (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id 3032A2626CF for ; Thu, 9 Oct 2014 10:52:49 +0100 (BST) From: Gary Benson To: gdb-patches@sourceware.org Subject: [PATCH 13/13 v2] Move duplicated Linux x86 code to nat/x86-linux.c Date: Thu, 09 Oct 2014 10:44:00 -0000 Message-Id: <1412848358-9958-14-git-send-email-gbenson@redhat.com> In-Reply-To: <1412848358-9958-1-git-send-email-gbenson@redhat.com> References: <1412848358-9958-1-git-send-email-gbenson@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00197.txt.bz2 This commit moves two identical functions from gdb/x86-linux-nat.c and gdb/gdbserver/linux-x86-low.c into the shared file gdb/nat/x86-linux.c. gdb/ChangeLog: * nat/x86-linux.h (x86_linux_new_thread): New declaration. (x86_linux_prepare_to_resume): Likewise. * x86-linux-nat.c (x86_linux_new_thread): Moved to nat/x86-linux.c. (x86_linux_prepare_to_resume): Likewise. * nat/x86-linux.c (x86_linux_new_thread): New function. (x86_linux_prepare_to_resume): Likewise. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_linux_new_thread): Removed. (x86_linux_prepare_to_resume): Likewise. --- gdb/ChangeLog | 10 ++++++++++ gdb/gdbserver/ChangeLog | 5 +++++ gdb/gdbserver/linux-x86-low.c | 16 ---------------- gdb/nat/x86-linux.c | 17 +++++++++++++++++ gdb/nat/x86-linux.h | 8 ++++++++ gdb/x86-linux-nat.c | 16 ---------------- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index b1d2d27..40e96e2 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -637,14 +637,6 @@ x86_linux_new_process (void) return info; } -/* Called when a new thread is detected. */ - -static void -x86_linux_new_thread (struct lwp_info *lwp) -{ - lwp_set_debug_registers_changed (lwp, 1); -} - /* See nat/x86-dregs.h. */ struct x86_debug_reg_state * @@ -654,14 +646,6 @@ x86_debug_reg_state (pid_t pid) return &proc->private->arch_private->debug_reg_state; } - -/* Called prior to resuming a thread. */ - -static void -x86_linux_prepare_to_resume (struct lwp_info *lwp) -{ - x86_linux_update_debug_registers (lwp); -} /* When GDBSERVER is built as a 64-bit application on linux, the PTRACE_GETSIGINFO data is always presented in 64-bit layout. Since diff --git a/gdb/nat/x86-linux.c b/gdb/nat/x86-linux.c index efeeab9..7dd3f9b 100644 --- a/gdb/nat/x86-linux.c +++ b/gdb/nat/x86-linux.c @@ -19,6 +19,7 @@ #include "common-defs.h" #include "x86-linux.h" +#include "x86-linux-dregs.h" /* Per-thread arch-specific data we want to keep. */ @@ -55,3 +56,19 @@ lwp_debug_registers_changed (struct lwp_info *lwp) return info->debug_registers_changed; } + +/* See nat/x86-linux.h. */ + +void +x86_linux_new_thread (struct lwp_info *lwp) +{ + lwp_set_debug_registers_changed (lwp, 1); +} + +/* See nat/x86-linux.h. */ + +void +x86_linux_prepare_to_resume (struct lwp_info *lwp) +{ + x86_linux_update_debug_registers (lwp); +} diff --git a/gdb/nat/x86-linux.h b/gdb/nat/x86-linux.h index 6409898..76271b5 100644 --- a/gdb/nat/x86-linux.h +++ b/gdb/nat/x86-linux.h @@ -35,4 +35,12 @@ extern void lwp_set_debug_registers_changed (struct lwp_info *lwp, extern int lwp_debug_registers_changed (struct lwp_info *lwp); +/* Function to call when a new thread is detected. */ + +extern void x86_linux_new_thread (struct lwp_info *lwp); + +/* Function to call prior to resuming a thread. */ + +extern void x86_linux_prepare_to_resume (struct lwp_info *lwp); + #endif /* X86_LINUX_H */ diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index 97ce443..61710ce 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -52,22 +52,6 @@ struct arch_lwp_info /* Does the current host support PTRACE_GETREGSET? */ int have_ptrace_getregset = -1; - -/* Called prior to resuming a thread. */ - -static void -x86_linux_prepare_to_resume (struct lwp_info *lwp) -{ - x86_linux_update_debug_registers (lwp); -} - -/* Called when a new thread is detected. */ - -static void -x86_linux_new_thread (struct lwp_info *lwp) -{ - lwp_set_debug_registers_changed (lwp, 1); -} /* linux_nat_new_fork hook. */ -- 1.7.1