public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: Tom Tromey <tromey@redhat.com>,
	       Pierre Muller <pierre.muller@ics-cnrs.unistra.fr>,
	       gdb-patches@sourceware.org,
	"'Eli Zaretskii'" <eliz@gnu.org>
Subject: [patch] testsuite: regression on failed charset.exp compilation   [Re: [RFA-v3] Allow explicit 16 or 32 char in 'x /s']
Date: Tue, 20 Jul 2010 20:13:00 -0000	[thread overview]
Message-ID: <20100720201310.GA17005@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <201007051017.o65AHXIE004417@d12av02.megacenter.de.ibm.com>

On Mon, 05 Jul 2010 12:17:33 +0200, Ulrich Weigand wrote:
> Tom Tromey wrote:
> > >>>>> "Ulrich" =3D=3D Ulrich Weigand <uweigand@de.ibm.com> writes:
> > Ulrich> 	* gdb.base/charset.c (main): Make sure malloc gets linked in.
> > With this patch I now get:
> > Running ../../../src/gdb/testsuite/gdb.base/charset.exp ...
> > gdb compile failed, ../../../src/gdb/testsuite/gdb.base/charset.c: In function 'main':
> > ../../../src/gdb/testsuite/gdb.base/charset.c:126: warning: incompatible implicit declaration of built-in function 'malloc'
[...]
> Can we split the testcase so that the parts that require the
> non-standard wchar_t definition are separate from the parts
> that construct strings in the inferior?

Implemented.  OK to check-in?

This is a regression since gdb-7.1.

Testfile tested on x86_64-fedora13-linux-gnu.

While the malloc() result gets ignored warning gets generated only with
_FORTIFY_SOURCE level > 0 so we probably do not have to care about in the gdb
testsuite.


Thanks,
Jan


2010-07-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
	    Ulrich Weigand  <uweigand@de.ibm.com>
	    Tom Tromey  <tromey@redhat.com>

	* gdb.base/charset-malloc.c: New file.
	* gdb.base/charset.c (malloc_stub): New prototype.
	(main): Call it instead of malloc itself.
	* gdb.base/charset.exp: Use only prepare_for_testing.
	(binfile): Remove the variable.

--- /dev/null
+++ b/gdb/testsuite/gdb.base/charset-malloc.c
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2010 Free Software Foundation, Inc.
+
+   Contributed by Red Hat, originally written by Jim Blandy.
+
+   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/>.
+
+   Please email any bugs, comments, and/or additions to this file to:
+   bug-gdb@gnu.org  */
+
+/* charset.c file cannot use a system include file as it has its own wchar_t
+   definition which would be in a conflict.  Use this separate compilation
+   unit.  */
+
+#include <stdlib.h>
+
+void
+malloc_stub (void)
+{
+  /* charset.exp wants to allocate memory for constants.  So make sure malloc
+     gets linked into the program.  */
+  malloc (1);
+}
--- a/gdb/testsuite/gdb.base/charset.c
+++ b/gdb/testsuite/gdb.base/charset.c
@@ -114,6 +114,8 @@ init_utf32 ()
     utf_32_string[i] = iso_8859_1_string[i] & 0xff;
 }
 
+extern void malloc_stub (void);
+
 int main ()
 {
 #ifdef usestubs
@@ -121,9 +123,7 @@ int main ()
   breakpoint();
 #endif
 
-  /* charset.exp wants to allocate memory for constants.  So make sure malloc
-     gets linked into the program.  */
-  malloc (1);
+  malloc_stub ();
 
   /* Initialize ascii_string.  */
   init_string (ascii_string,
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -27,18 +27,11 @@ if $tracelevel then {
 
 set testfile "charset"
 set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-    untested "couldn't compile ${srcdir}/${subdir}/${srcfile}"
+set srcmallocfile ${testfile}-malloc.c
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list $srcfile $srcmallocfile]] } {
     return -1
 }
 
-# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 # Parse the output from a `show charset' command.  Return the host
 # and target charset as a two-element list.
 proc parse_show_charset_output {testname} {

  reply	other threads:[~2010-07-20 20:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <11484.4708740295$1268865815@news.gmane.org>
2010-03-18 22:08 ` [RFC] Allow explicit 16 or 32 char in 'x /s' Tom Tromey
2010-03-19  7:32   ` Eli Zaretskii
2010-03-22 22:54     ` Pierre Muller
     [not found]     ` <15103.6087111153$1269298497@news.gmane.org>
2010-03-30 20:33       ` Tom Tromey
2010-03-31 16:11         ` [RFC-v2] " Pierre Muller
     [not found]         ` <006101cad0ec$cb7915d0$626b4170$%muller@ics-cnrs.unistra.fr>
2010-03-31 16:17           ` Eli Zaretskii
2010-04-01  9:34             ` Pierre Muller
     [not found]             ` <000f01cad17e$7686f140$6394d3c0$%muller@ics-cnrs.unistra.fr>
2010-04-01 13:17               ` Eli Zaretskii
2010-04-05 23:01                 ` Pierre Muller
     [not found]                 ` <002701cad513$e44a7420$acdf5c60$%muller@ics-cnrs.unistra.fr>
2010-04-06 17:51                   ` Eli Zaretskii
2010-04-08 20:58                     ` [RFA-v3] " Pierre Muller
2010-04-16  8:41                       ` [PING] " Pierre Muller
     [not found]                       ` <48335.255837492$1271407316@news.gmane.org>
2010-04-21 22:49                         ` Tom Tromey
2010-04-21 23:22                           ` Pierre Muller
2010-06-11 17:38                       ` Ulrich Weigand
2010-07-02 19:09                         ` Tom Tromey
2010-07-05 10:17                           ` Ulrich Weigand
2010-07-20 20:13                             ` Jan Kratochvil [this message]
2010-07-20 22:00                               ` [patch] testsuite: regression on failed charset.exp compilation [Re: [RFA-v3] Allow explicit 16 or 32 char in 'x /s'] Tom Tromey
2010-07-20 22:13                                 ` Jan Kratochvil

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=20100720201310.GA17005@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=pierre.muller@ics-cnrs.unistra.fr \
    --cc=tromey@redhat.com \
    --cc=uweigand@de.ibm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).