From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30114 invoked by alias); 15 Jul 2008 16:45:19 -0000 Received: (qmail 30106 invoked by uid 22791); 15 Jul 2008 16:45:19 -0000 X-Spam-Check-By: sourceware.org Received: from igw1.br.ibm.com (HELO igw1.br.ibm.com) (32.104.18.24) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 15 Jul 2008 16:44:56 +0000 Received: from mailhub1.br.ibm.com (mailhub1 [9.18.232.109]) by igw1.br.ibm.com (Postfix) with ESMTP id 46D8032C013 for ; Tue, 15 Jul 2008 13:17:31 -0300 (BRT) Received: from d24av02.br.ibm.com (d24av02.br.ibm.com [9.18.232.47]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6FGiurs2482678 for ; Tue, 15 Jul 2008 13:44:56 -0300 Received: from d24av02.br.ibm.com (loopback [127.0.0.1]) by d24av02.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6FGiprn012288 for ; Tue, 15 Jul 2008 13:44:51 -0300 Received: from [9.18.238.180] ([9.18.238.180]) by d24av02.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m6FGio5G012243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jul 2008 13:44:51 -0300 Subject: Re: (maybe) Async mode failures on PPC From: Luis Machado Reply-To: luisgpm@linux.vnet.ibm.com To: Pedro Alves Cc: gdb@sourceware.org In-Reply-To: <1216133200.7260.4.camel@gargoyle> References: <1216050287.2607.10.camel@gargoyle> <1216053102.2607.13.camel@gargoyle> <200807141757.51890.pedro@codesourcery.com> <1216055220.2607.18.camel@gargoyle> <1216133200.7260.4.camel@gargoyle> Content-Type: text/plain Date: Tue, 15 Jul 2008 16:45:00 -0000 Message-Id: <1216140289.7260.8.camel@gargoyle> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00180.txt.bz2 On Tue, 2008-07-15 at 11:46 -0300, Luis Machado wrote: > On Mon, 2008-07-14 at 14:06 -0300, Luis Machado wrote: > > Hey Pedro, > > > > On Mon, 2008-07-14 at 17:57 +0100, Pedro Alves wrote: > > > Hi Luis, > > > > > > On Monday 14 July 2008 17:31:42, Luis Machado wrote: > > > > Steps to reproduce this failure: > > > > > > > > 1 - Load the watchpoint.exp test binary into gdb. > > > > 2 - start it and next over a few lines. > > > > > > I can't reproduce it on x86 (sync or async), neither with your > > > recipe or by running the watchpoint.exp test. > > > > It seems to be a ppc-specific thing. I forgot to mention that you need > > to place a watchpoint on variable "ptr1" to trigger this. When no > > watchpoints are inserted, it runs as expected. And this is sync mode, > > i > > did not turn async on, and i presume it's off by default, like it was > > until recently. > > > > > :-( > > > > > > The "Target is executing" notice comes from > > frame.c:get_current_frame. > > > > > > I couldn't figure out for sure from your description of the > > > problem if this only happens in async, or if it happen in sync as > > well, > > > but I understood async only. > > > > > > Why is GDB trying to get the current frame of an executing > > > thread, or why does GDB think that the current thread is > > > executing at this point, if it isn't? > > > > > > Can you do a bit of debugging and figure out what is the > > > code path that ended up triggering the first error? > > > get_current_frame is called from too many places to be able > > > to do an educated guess. > > > > Yes, sorry. I was just wondering if anyone else was having the same > > problem and did not provide much info about it. I'll dig into it and > > will provide the code path for the error as it seems to be a > > regression. > > But i feel it's related somehow to watchpoints. > > > > Regards, > > Luis > > Here is a patch i discussed with Pedro to fix this regression. Tested > and nothing showed up in the testsuite. > > Is this OK? Updated the changelog entry according to Pedro's suggestion. 2008-07-15 Luis Machado * infrun.c (handle_inferior_event): Tag threads as stopped before inserting breakpoints. Index: gdb/infrun.c =================================================================== --- gdb.orig/infrun.c 2008-07-15 09:36:19.000000000 -0500 +++ gdb/infrun.c 2008-07-15 09:37:20.000000000 -0500 @@ -1828,6 +1828,29 @@ adjust_pc_after_break (ecs); + reinit_frame_cache (); + + /* If it's a new process, add it to the thread database */ + + ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid) + && !ptid_equal (ecs->ptid, minus_one_ptid) + && !in_thread_list (ecs->ptid)); + + if (ecs->ws.kind != TARGET_WAITKIND_EXITED + && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event) + add_thread (ecs->ptid); + + if (ecs->ws.kind != TARGET_WAITKIND_IGNORE) + { + /* Mark the non-executing threads accordingly. */ + if (!non_stop + || ecs->ws.kind == TARGET_WAITKIND_EXITED + || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED) + set_executing (pid_to_ptid (-1), 0); + else + set_executing (ecs->ptid, 0); + } + switch (infwait_state) { case infwait_thread_hop_state: @@ -1867,29 +1890,6 @@ } infwait_state = infwait_normal_state; - reinit_frame_cache (); - - /* If it's a new process, add it to the thread database */ - - ecs->new_thread_event = (!ptid_equal (ecs->ptid, inferior_ptid) - && !ptid_equal (ecs->ptid, minus_one_ptid) - && !in_thread_list (ecs->ptid)); - - if (ecs->ws.kind != TARGET_WAITKIND_EXITED - && ecs->ws.kind != TARGET_WAITKIND_SIGNALLED && ecs->new_thread_event) - add_thread (ecs->ptid); - - if (ecs->ws.kind != TARGET_WAITKIND_IGNORE) - { - /* Mark the non-executing threads accordingly. */ - if (!non_stop - || ecs->ws.kind == TARGET_WAITKIND_EXITED - || ecs->ws.kind == TARGET_WAITKIND_SIGNALLED) - set_executing (pid_to_ptid (-1), 0); - else - set_executing (ecs->ptid, 0); - } - switch (ecs->ws.kind) { case TARGET_WAITKIND_LOADED: