From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28809 invoked by alias); 17 Dec 2011 20:13:20 -0000 Received: (qmail 28797 invoked by uid 22791); 17 Dec 2011 20:13:18 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Dec 2011 20:13:02 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Rc0cu-0007Bn-Ot from pedro_alves@mentor.com ; Sat, 17 Dec 2011 12:13:00 -0800 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Sat, 17 Dec 2011 20:12:58 +0000 From: Pedro Alves To: Jan Kratochvil Subject: Re: [patch] s390*: watchpoints regression [repost] Date: Sat, 17 Dec 2011 20:35:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-13-generic; KDE/4.7.2; x86_64; ; ) Cc: gdb-patches@sourceware.org References: <20111217094753.GA20113@host2.jankratochvil.net> <20111217194454.GA15156@host2.jankratochvil.net> <201112171956.33037.alves.ped@gmail.com> In-Reply-To: <201112171956.33037.alves.ped@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201112172012.57734.pedro@codesourcery.com> 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 X-SW-Source: 2011-12/txt/msg00583.txt.bz2 On Saturday 17 December 2011 19:56:32, Pedro Alves wrote: > On Saturday 17 December 2011 19:44:54, Jan Kratochvil wrote: > > On Sat, 17 Dec 2011 20:40:13 +0100, Pedro Alves wrote: > > > In the loop that runs through the shell, fork-child.c:startup_inferior, > > > nothing inserts breakpoints/watchpoints. So nothing ends up > > > setting lwp->arch_private->debug_registers_changed, and so we should > > > not be setting DR_CONTROL to 0 for the wrapper shell. Do you > > > actually see it happen? > > > > I see it happenning. [attached] > > Ah, I forgot this: > > static void > i386_linux_new_thread (struct lwp_info *lp) > { > struct arch_lwp_info *info = XCNEW (struct arch_lwp_info); > > info->debug_registers_changed = 1; > > lp->arch_private = info; > } > > Hmm. I'm starting to think that the easiest is jut to > go back at not calling new_thread for the first thread. > Let me give that a try. Seems to work fine. This should obsolete the s390 patch. I think GDBserver has a similar problem with --wrapper. -- Pedro Alves 2011-12-17 Pedro Alves Jan Kratochvil * linux-nat.c (add_lwp): Don't call linux_nat_new_thread on the first LWP. * amd64-linux-nat.c (update_debug_registers_callback): Instantiate `lwp->arch_private' if NULL. (amd64_linux_prepare_to_resume): Do nothing if `lwp->arch_private' is NULL. * i386-linux-nat.c (update_debug_registers_callback): Instantiate `lwp->arch_private' if NULL. (i386_linux_prepare_to_resume): Do nothing if `lwp->arch_private' is NULL. --- gdb/amd64-linux-nat.c | 8 ++++++++ gdb/i386-linux-nat.c | 8 ++++++++ gdb/linux-nat.c | 2 +- 3 files changed, 17 insertions(+), 1 deletions(-) diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 288160b..6ee9596 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -343,6 +343,9 @@ amd64_linux_dr_get_status (void) static int update_debug_registers_callback (struct lwp_info *lwp, void *arg) { + if (lwp->arch_private == NULL) + lwp->arch_private = XCNEW (struct arch_lwp_info); + /* The actual update is done later just before resuming the lwp, we just mark that the registers need updating. */ lwp->arch_private->debug_registers_changed = 1; @@ -386,6 +389,11 @@ amd64_linux_prepare_to_resume (struct lwp_info *lwp) { int clear_status = 0; + /* This is the main thread still going through the shell, or, no + watchpoint has been set yet. */ + if (lwp->arch_private == NULL) + return; + if (lwp->arch_private->debug_registers_changed) { struct i386_debug_reg_state *state = i386_debug_reg_state (); diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index 190979b..3c56a22 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -715,6 +715,9 @@ i386_linux_dr_get_status (void) static int update_debug_registers_callback (struct lwp_info *lwp, void *arg) { + if (lwp->arch_private == NULL) + lwp->arch_private = XCNEW (struct arch_lwp_info); + /* The actual update is done later just before resuming the lwp, we just mark that the registers need updating. */ lwp->arch_private->debug_registers_changed = 1; @@ -758,6 +761,11 @@ i386_linux_prepare_to_resume (struct lwp_info *lwp) { int clear_status = 0; + /* This is the main thread still going through the shell, or, no + watchpoint has been set yet. */ + if (lwp->arch_private == NULL) + return; + if (lwp->arch_private->debug_registers_changed) { struct i386_debug_reg_state *state = i386_debug_reg_state (); diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 1cbfc44..2b1ecb7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -1151,7 +1151,7 @@ add_lwp (ptid_t ptid) lp->next = lwp_list; lwp_list = lp; - if (linux_nat_new_thread != NULL) + if (num_lwps (GET_PID (ptid)) > 1 && linux_nat_new_thread != NULL) linux_nat_new_thread (lp); return lp;