From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18537 invoked by alias); 11 Sep 2007 15:42:35 -0000 Received: (qmail 18527 invoked by uid 22791); 11 Sep 2007 15:42:34 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 11 Sep 2007 15:42:27 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1IV7se-0002WX-00; Tue, 11 Sep 2007 16:42:24 +0100 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1IV7sQ-0006hX-00; Tue, 11 Sep 2007 16:42:10 +0100 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1IV7sL-0003dn-K2; Tue, 11 Sep 2007 16:42:05 +0100 Date: Tue, 11 Sep 2007 15:42:00 -0000 From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org, Daniel Jacobowitz cc: "Maciej W. Rozycki" Subject: mi*-watch.exp: Test both hardware and software watchpoints Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.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: 2007-09/txt/msg00151.txt.bz2 Hello, This change rearranges how the MI watchpoints tests are done so that both hardware and software watchpoints are examined by running the same set of tests with both. This change has been tested natively for mips-linux-gnu and i386-linux-gnu and remotely for mipsisa32-sde-elf, with mips-sim-sde32/-EB and mips-sim-sde32/-EL. The change adds a failure for all the targets for previously untested sw watchpoints (mips-linux-gnu fails already for no hw watchpoint support for this platform is there still, sigh...) with the watchpoint-out-of-scope test like below: FAIL: gdb.mi/mi-watch.exp: wp out of scope (2) The reason for MIPS is (and I suppose for i386 likewise) as soon as the frame pointer is destroyed in the callee, the watchpoint vanishes. There is this in_function_epilogue_p() hook that may be used to single-step out of the function epilogue which is currently not implemented. For MIPS I have a fix for it which I will sent separately and which works for non-PIC o32 (tested as above) and should work for all the new ABIs (untested). It does not quite work for o32 PIC, because the GOT pointer restoration in the caller is still considered a part of the source line associated with the function call. It is still a step forward though -- at least it triggers in the right function and only one load instruction too early. 2007-09-11 Maciej W. Rozycki * gdb.mi/mi-watch.exp (test_watchpoint_all): New function. Move all the tests here and run them twice, once using software watchpoints and once using hardware watchpoints. * gdb.mi/mi2-watch.exp (test_watchpoint_all): Likewise. OK to apply? Maciej 14678.diff Index: binutils-quilt/src/gdb/testsuite/gdb.mi/mi2-watch.exp =================================================================== --- binutils-quilt.orig/src/gdb/testsuite/gdb.mi/mi2-watch.exp 2007-09-07 12:50:38.000000000 +0100 +++ binutils-quilt/src/gdb/testsuite/gdb.mi/mi2-watch.exp 2007-09-07 13:03:36.000000000 +0100 @@ -41,10 +41,6 @@ return -1 } -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - proc test_watchpoint_creation_and_listing {} { global mi_gdb_prompt global srcfile @@ -167,16 +163,42 @@ } } -# Disable hardware watchpoints if necessary. +proc test_watchpoint_all {} { + upvar srcdir srcdir + upvar subdir subdir + upvar binfile binfile + + mi_delete_breakpoints + mi_gdb_reinitialize_dir $srcdir/$subdir + mi_gdb_load ${binfile} + + mi_runto callee4 + test_watchpoint_creation_and_listing + #test_rwatch_creation_and_listing + #test_awatch_creation_and_listing + test_watchpoint_triggering +} + +# Run the tests twice, once using software watchpoints... +mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \ + "567\\^done" \ + "hw watchpoints toggle" +test_watchpoint_all + +mi_gdb_exit + +# ... and unless requested otherwise... if [target_info exists gdb,no_hardware_watchpoints] { - mi_gdb_test "-gdb-set can-use-hw-watchpoints 0" "\\^done" "" + return 0 } -mi_runto callee4 -test_watchpoint_creation_and_listing -#test_rwatch_creation_and_listing -#test_awatch_creation_and_listing -test_watchpoint_triggering +mi_gdb_start + +# ... once using hardware watchpoints (if available). +mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \ + "890\\^done" \ + "hw watchpoints toggle" +test_watchpoint_all mi_gdb_exit return 0 Index: binutils-quilt/src/gdb/testsuite/gdb.mi/mi-watch.exp =================================================================== --- binutils-quilt.orig/src/gdb/testsuite/gdb.mi/mi-watch.exp 2007-09-07 12:50:38.000000000 +0100 +++ binutils-quilt/src/gdb/testsuite/gdb.mi/mi-watch.exp 2007-09-07 13:02:52.000000000 +0100 @@ -41,10 +41,6 @@ return -1 } -mi_delete_breakpoints -mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile} - proc test_watchpoint_creation_and_listing {} { global mi_gdb_prompt global srcfile @@ -167,16 +163,42 @@ } } -# Disable hardware watchpoints if necessary. +proc test_watchpoint_all {} { + upvar srcdir srcdir + upvar subdir subdir + upvar binfile binfile + + mi_delete_breakpoints + mi_gdb_reinitialize_dir $srcdir/$subdir + mi_gdb_load ${binfile} + + mi_runto callee4 + test_watchpoint_creation_and_listing + #test_rwatch_creation_and_listing + #test_awatch_creation_and_listing + test_watchpoint_triggering +} + +# Run the tests twice, once using software watchpoints... +mi_gdb_test "567-gdb-set can-use-hw-watchpoints 0" \ + "567\\^done" \ + "hw watchpoints toggle" +test_watchpoint_all + +mi_gdb_exit + +# ... and unless requested otherwise... if [target_info exists gdb,no_hardware_watchpoints] { - mi_gdb_test "-gdb-set can-use-hw-watchpoints 0" "\\^done" "" + return 0 } -mi_runto callee4 -test_watchpoint_creation_and_listing -#test_rwatch_creation_and_listing -#test_awatch_creation_and_listing -test_watchpoint_triggering +mi_gdb_start + +# ... once using hardware watchpoints (if available). +mi_gdb_test "890-gdb-set can-use-hw-watchpoints 1" \ + "890\\^done" \ + "hw watchpoints toggle" +test_watchpoint_all mi_gdb_exit return 0