Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado <luisgpm@linux.vnet.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] PPC Call-clobbered registers testcase
Date: Thu, 25 Oct 2007 19:06:00 -0000	[thread overview]
Message-ID: <1193339127.4850.16.camel@localhost> (raw)
In-Reply-To: <20071024205901.GS10943@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 1008 bytes --]

> 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

[-- Attachment #2: clobbered-registers-testcase.diff --]
[-- Type: text/x-patch, Size: 8418 bytes --]

2007-10-25  Luis Machado  <luisgpm@br.ibm.com>

    * 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 <http://www.gnu.org/licenses/>.  */
+
+#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 = <value optimized out>\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 = <value optimized out>\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" ;;

  reply	other threads:[~2007-10-25 19:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 14:41 Luis Machado
2007-09-25 16:21 ` Luis Machado
2007-10-06 16:12   ` Daniel Jacobowitz
2007-10-08 18:55     ` Luis Machado
2007-10-08 19:06       ` Daniel Jacobowitz
2007-10-08 19:14         ` Luis Machado
2007-10-08 19:35           ` Daniel Jacobowitz
2007-10-23 22:18             ` Luis Machado
2007-10-24 21:00               ` Daniel Jacobowitz
2007-10-25 19:06                 ` Luis Machado [this message]
2007-10-25 19:30                   ` Daniel Jacobowitz
2007-10-25 20:36                     ` Luis Machado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1193339127.4850.16.camel@localhost \
    --to=luisgpm@linux.vnet.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox