From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7418 invoked by alias); 25 Oct 2007 19:05:53 -0000 Received: (qmail 7407 invoked by uid 22791); 25 Oct 2007 19:05:52 -0000 X-Spam-Check-By: sourceware.org Received: from igw2.br.ibm.com (HELO igw2.br.ibm.com) (32.104.18.25) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 25 Oct 2007 19:05:44 +0000 Received: from mailhub1.br.ibm.com (mailhub1 [9.18.232.109]) by igw2.br.ibm.com (Postfix) with ESMTP id 36F5D17F6A8 for ; Thu, 25 Oct 2007 17:03:01 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by mailhub1.br.ibm.com (8.13.8/8.13.8/NCO v8.5) with ESMTP id l9PJ5aCW2461788 for ; Thu, 25 Oct 2007 17:05:38 -0200 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l9PJ5ZMl028594 for ; Thu, 25 Oct 2007 16:05:36 -0300 Received: from [9.18.238.24] ([9.18.238.24]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id l9PJ5X7W028501; Thu, 25 Oct 2007 16:05:35 -0300 Subject: Re: [PATCH] PPC Call-clobbered registers testcase From: Luis Machado Reply-To: luisgpm@linux.vnet.ibm.com To: Daniel Jacobowitz Cc: gdb-patches@sourceware.org In-Reply-To: <20071024205901.GS10943@caradoc.them.org> References: <1190644886.4375.2.camel@localhost> <1190726512.4376.0.camel@localhost> <20071006161230.GA10179@caradoc.them.org> <1191869140.4322.10.camel@localhost> <20071008185507.GA28479@caradoc.them.org> <1191870400.4322.13.camel@localhost> <20071008191416.GA30019@caradoc.them.org> <1193180757.5333.3.camel@localhost> <20071024205901.GS10943@caradoc.them.org> Content-Type: multipart/mixed; boundary="=-/3lpl5EpvgbaPVv8D2a7" Date: Thu, 25 Oct 2007 19:06:00 -0000 Message-Id: <1193339127.4850.16.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 X-IsSubscribed: yes 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-10/txt/msg00667.txt.bz2 --=-/3lpl5EpvgbaPVv8D2a7 Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1008 > Periods at the end of entries. You should just say "Regenerated." for > things like the configure script. Fixed > It's not a big deal, but please don't add this to new files. I don't > think that address has worked in a decade or more. We should get > rid of it. Fixed > Please avoid using send_gdb or gdb_expect, unless you have special > needs for them. If you have only one pass pattern, use gdb_test; > if you have more than one, use gdb_test_multiple. It works like > gdb_expect but includes the send_gdb and handles all sorts of > unexpected output for you. Done Took a different path as you suggested. The synching is being done via matching with the $gdb_prompt at the end of every test. This way it works flawlessly on both x86 and ppc. Passes 3 tests on ppc and passes 2 and fails 1 on x86. I've also moved the patch one level up in the tree to the testsuite directory. How does it look now? Regards, -- Luis Machado IBM Linux Technology Center e-mail: luisgpm@linux.vnet.ibm.com --=-/3lpl5EpvgbaPVv8D2a7 Content-Disposition: attachment; filename=clobbered-registers-testcase.diff Content-Type: text/x-patch; name=clobbered-registers-testcase.diff; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 8418 2007-10-25 Luis Machado * gdb.opt/clobbered-registers-O2.c: New testcase source file. * gdb.opt/clobbered-registers-O2.exp: New testcase expect file. * gdb.opt/Makefile.in: New makefile. * Makefile.in: Create new directory "gdb.opt". * configure.ac: Add "gdb.opt" directory. * configure: Regenerated. Index: testsuite/gdb.opt/clobbered-registers-O2.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ testsuite/gdb.opt/clobbered-registers-O2.c 2007-10-25 11:44:11.000000000 -0700 @@ -0,0 +1,41 @@ +/* This file is part of GDB, the GNU debugger. + + Copyright 2007 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef __GNUC__ +#define __attribute__(x) +#endif + +unsigned * __attribute__((noinline)) +start_sequence (unsigned * x, unsigned * y) +{ + return (unsigned *)0xdeadbeef; +}; + +unsigned __attribute__((noinline)) +gen_movsd (unsigned * operand0, unsigned * operand1) +{ + return *start_sequence(operand0, operand1); +} + +int main(void) +{ + unsigned x, y; + + x = 13; + y = 14; + return (int)gen_movsd (&x, &y); +} Index: testsuite/gdb.opt/clobbered-registers-O2.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ testsuite/gdb.opt/clobbered-registers-O2.exp 2007-10-25 11:47:57.000000000 -0700 @@ -0,0 +1,65 @@ +# Copyright 2007 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# This file is part of the gdb testsuite. + +if $tracelevel then { + strace $tracelevel +} + +# Test displaying call clobbered registers in optimized binaries. +# GDB should not show incorrect values. + +set testfile clobbered-registers-O2 +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# What compiler are we using? +# +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug optimize=-O2 nowarnings]] != "" } { + untested clobbered-registers-O2.exp + return -1 +} + +# use this to debug: +#log_user 1 + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if { ![runto start_sequence] } then { + fail "run to start_sequence" + return +} + +gdb_test "frame 1" "#1.*in gen_movsd.*" "Backtracing" + +gdb_test_multiple "print operand0" "print operand0" { + -re "\\\$$decimal = \r\n$gdb_prompt $" { pass "print operand0"} + -re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand0" "13" "print operand0" } +} + +gdb_test_multiple "print operand1" "print operand1" { + -re "\\\$$decimal = \r\n$gdb_prompt" { pass "print operand1"} + -re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand1" "14" "print operand1" } +} + Index: testsuite/Makefile.in =================================================================== --- testsuite.orig/Makefile.in 2007-10-25 11:35:47.000000000 -0700 +++ testsuite/Makefile.in 2007-10-25 11:41:46.000000000 -0700 @@ -37,7 +37,8 @@ ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \ gdb.dwarf2 \ gdb.fortran gdb.server gdb.java gdb.mi \ - gdb.objc gdb.pascal gdb.threads gdb.trace gdb.xml \ + gdb.objc gdb.opt gdb.pascal gdb.threads gdb.trace \ + gdb.xml \ $(SUBDIRS) EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \ Index: testsuite/configure.ac =================================================================== --- testsuite.orig/configure.ac 2007-10-25 11:35:47.000000000 -0700 +++ testsuite/configure.ac 2007-10-25 11:41:46.000000000 -0700 @@ -116,5 +116,5 @@ gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile \ gdb.fortran/Makefile gdb.server/Makefile \ gdb.java/Makefile gdb.mi/Makefile gdb.modula2/Makefile \ - gdb.objc/Makefile gdb.pascal/Makefile gdb.threads/Makefile \ - gdb.trace/Makefile gdb.xml/Makefile]) + gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ + gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile]) Index: testsuite/gdb.opt/Makefile.in =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ testsuite/gdb.opt/Makefile.in 2007-10-25 11:41:46.000000000 -0700 @@ -0,0 +1,24 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = hello/hello + +MISCELLANEOUS = + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + -find . -name '*.o' -print | xargs rm -f + -find . -name '*.ali' -print | xargs rm -f + -find . -name 'b~*.ad[sb]' -print | xargs rm -f + -rm -f *~ a.out xgdb *.x *.ci *.tmp + -rm -f *~ *.o a.out xgdb *.x *.ci *.tmp + -rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES) + -rm -f $(MISCELLANEOUS) twice-tmp.c + +distclean maintainer-clean realclean: clean + -rm -f *~ core + -rm -f Makefile config.status config.log + -rm -f *-init.exp + -rm -fr *.log summary detail *.plog *.sum *.psum site.* Index: testsuite/configure =================================================================== --- testsuite.orig/configure 2007-10-25 11:35:47.000000000 -0700 +++ testsuite/configure 2007-10-25 11:41:46.000000000 -0700 @@ -3104,7 +3104,7 @@ - ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.objc/Makefile gdb.pascal/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" + ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.mi/Makefile gdb.objc/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -3668,6 +3668,7 @@ "gdb.java/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.java/Makefile" ;; "gdb.mi/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;; "gdb.objc/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.objc/Makefile" ;; + "gdb.opt/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.opt/Makefile" ;; "gdb.threads/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.threads/Makefile" ;; "gdb.trace/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.trace/Makefile" ;; "gdb.xml/Makefile" ) CONFIG_FILES="$CONFIG_FILES gdb.xml/Makefile" ;; --=-/3lpl5EpvgbaPVv8D2a7--