From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14406 invoked by alias); 23 Apr 2010 00:00:11 -0000 Received: (qmail 14159 invoked by uid 22791); 23 Apr 2010 00:00:05 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Apr 2010 23:59:58 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 1A5E12BAD1A; Thu, 22 Apr 2010 19:59:57 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rF5MGEiGAI4B; Thu, 22 Apr 2010 19:59:57 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id C5B332BAB57; Thu, 22 Apr 2010 19:59:56 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 606EBF5895; Thu, 22 Apr 2010 16:59:56 -0700 (PDT) Date: Fri, 23 Apr 2010 00:00:00 -0000 From: Joel Brobecker To: Pierre Muller Cc: Peter.Schauer@regent.e-technik.tu-muenchen.de, gdb@sourceware.org, 'Pieter Maljaars' , "'Joseph S. Myers'" , 'Pedro Alves' Subject: Re: Question about solaris CANNOT_STEP_HW_WATCHPOINTS macro Message-ID: <20100422235956.GG13204@adacore.com> References: <001501cad820$36771f50$a3655df0$@muller@ics-cnrs.unistra.fr> <20100422135635.GE13204@adacore.com> <003101cae232$e2564ff0$a702efd0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003101cae232$e2564ff0$a702efd0$@muller@ics-cnrs.unistra.fr> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-04/txt/msg00088.txt.bz2 > setting a watchpoint on myrec.x and > stepping should expose the bug if you > remove the CANNOT_STEP_HW_WATCHPOINT from nm-i386sol2.h Looks like a different bug is now occurring: (gdb) start Temporary breakpoint 1 at 0x805067a: file foo.c, line 13. Starting program: [...]/foo Temporary breakpoint 1, main () at foo.c:13 13 myrec.x = 5; (gdb) print myrec.x $1 = 0 (gdb) watch myrec.x Hardware watchpoint 2: myrec.x (gdb) s 14 myrec.y = 3.4; In other words, the program did not "continue" during the step, but the watchpoint did not trigger either. Later on, during the same run: (gdb) s 16 myrec.x = 78; (gdb) s 17 return myrec.x; (no trigger of the watchpoint either). However, when doing a "continue" instead of a step, we do get the watchpoint hit: (gdb) start Temporary breakpoint 1 at 0x805067a: file foo.c, line 13. Starting program: [...]/foo Temporary breakpoint 1, main () at foo.c:13 13 myrec.x = 5; (gdb) watch myrec.x Hardware watchpoint 2: myrec.x (gdb) cont Continuing. Hardware watchpoint 2: myrec.x Old value = 0 New value = 5 main () at foo.c:14 14 myrec.y = 3.4; I compared the behavior with the same program, but on x86-linux. We get the expected behavior: (gdb) watch myrec.x Hardware watchpoint 2: myrec.x (gdb) s Hardware watchpoint 2: myrec.x Old value = 0 New value = 5 main () at foo.c:14 14 myrec.y = 3.4; Looking at the infrun debug output: (gdb) set debug infrun 1 (gdb) s infrun: clear_proceed_status_thread (LWP 1) infrun: proceed (addr=0xffffffff, signal=144, step=1) infrun: resume (step=1, signal=0), trap_expected=0 infrun: wait_for_inferior (treat_exec_as_sigtrap=0) infrun: target_wait (-1, status) = infrun: 3497 [LWP 1], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x8050684 infrun: stepped to a different line infrun: stop_stepping 14 myrec.y = 3.4; So we failed to notice that the watchpoint triggered - we should probably look in the area of procfs_stopped_by_watchpoint. Maybe another kernel issue??? If I use the "continue" command instead of a step, the infrun debug output looks like this: (gdb) cont Continuing. infrun: clear_proceed_status_thread (LWP 1) infrun: proceed (addr=0xffffffff, signal=144, step=0) infrun: resume (step=0, signal=0), trap_expected=0 infrun: wait_for_inferior (treat_exec_as_sigtrap=0) infrun: target_wait (-1, status) = infrun: 3524 [LWP 1], infrun: status->kind = stopped, signal = SIGTRAP infrun: infwait_normal_state infrun: TARGET_WAITKIND_STOPPED infrun: stop_pc = 0x8050684 infrun: stopped by watchpoint <<<<<--------- infrun: (no data address available) infrun: BPSTAT_WHAT_STOP_NOISY infrun: stop_stepping Hardware watchpoint 2: myrec.x Old value = 0 New value = 5 main () at foo.c:14 14 myrec.y = 3.4; I ran watchpoint.exp alone and the testcase passes without any problem. One last thing: It does not make any difference whether the CANNOT_STEP_HW_WATCHPOINT macro is defined or not. So, I think that, starting with version 2.8, it's safe to not have it defined. -- Joel