Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: "'Joel Brobecker'" <brobecker@adacore.com>
Cc: <gdb@sourceware.org>, <gdb-patches@sourceware.org>
Subject: [RFA] more fixes to testsuite (was RE: GDB 6.8.92 available for testing)
Date: Thu, 01 Oct 2009 21:22:00 -0000	[thread overview]
Message-ID: <000c01ca42dd$3f8c37c0$bea4a740$@u-strasbg.fr> (raw)
In-Reply-To: <20091001172928.GE6532@adacore.com>

  I here request approval 
for changes to the testsuite related to 
problems on a configuration where
gcc emits format warnings by default.

> -----Message d'origine-----
> De : gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] De la
> part de Joel Brobecker
> Envoyé : Thursday, October 01, 2009 7:29 PM
> À : Pierre Muller
> Cc : gdb@sourceware.org
> Objet : Re: GDB 6.8.92 available for testing
> 
> > 3) gdb.base/shr1.c (wrong format arg type)
> > 3) is about an address, but "%p" does not seem to be supported by all
> > C lib format implementation, so I don't know if this can be fixed
> correctly.
> 
> We already use %p in a couple of testcase, so let's use it again here.
> Best to avoid printing stuff on stdout/stderr when writing a testcase,
> as we don't always have access to the inferior output (for instance,
> when doing remote debugging), so matching the inferior output in the
> testcase won't work in those case.  But we'd have to dig deeper in
> the history of this testcase to determine whether removing the printf
> would not impact the effectiveness of the testcase.

 I used "%p" as suggested.
  
> For now, I vote for a group hug and the use of %p.
> 
> > 4) gdb.base/unload.c (format arg not literal)
> > 5) gdb.base/watchpoint-solib.c (format arg not literal)
> > 4) and 5) seem more difficult ...
> 
> Is that the source of the problem?
> 
>         fprintf (stderr, dlerror ());
> 
> The following should take care of it:
> 
>         fprintf (stderr, "%s", dlerror ())
> 
> --
> Joel
 This was a bit more tricky, because
dlerror is a macro if __WIN32__
is defined, 
  I removed the macro and
separated the fprintf.

Is this OK?

 
Tested on gcc16, no changes in the results of these tests.

PS: the #ifdef __WIN32__
should probably be replaced by 
something that is also defined for
64-bit windows, no?


2009-10-01  Pierre Muller  <muller@ics.u-strasbg.fr>

	* src/gdb/testsuite/gdb.base/shr1.c: Use %p in format string.
	* src/gdb/testsuite/gdb.base/unload.c: Avoid warning in fprintf.
	* src/gdb/testsuite/gdb.base/watchpoint-solib.c: Idem.

Index: src/gdb/testsuite/gdb.base/shr1.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shr1.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 shr1.c
--- src/gdb/testsuite/gdb.base/shr1.c	28 Jun 1999 16:04:00 -0000
1.1.1.2
+++ src/gdb/testsuite/gdb.base/shr1.c	1 Oct 2009 20:58:06 -0000
@@ -25,7 +25,7 @@ int x;
   sg = 6.6;
   sgi++;
   sgs = 8;
-  printf("address of sgs is 0x%x\n", &sgs);
+  printf("address of sgs is %p\n", &sgs);
   return 2*x;
 }
 
Index: src/gdb/testsuite/gdb.base/unload.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/unload.c,v
retrieving revision 1.9
diff -u -p -r1.9 unload.c
--- src/gdb/testsuite/gdb.base/unload.c	3 Jan 2009 05:58:03 -0000	1.9
+++ src/gdb/testsuite/gdb.base/unload.c	1 Oct 2009 20:58:06 -0000
@@ -27,7 +27,6 @@
 # define dlsym(handle, func) GetProcAddress (handle, func)
 #endif
 #define dlclose(handle) FreeLibrary (handle)
-#define dlerror() "error %d occurred", GetLastError ()
 #else
 #include <dlfcn.h>
 #endif
@@ -53,7 +52,11 @@ int main()
 
   if (!unloadshr)
     {
-      fprintf (stderr, dlerror ());
+#ifdef __WIN32__
+      fprintf (stderr, "error %d occurred", GetLastError ());
+#else
+      fprintf (stderr, "%s", dlerror ());
+#endif
       exit (1);
     }
 
Index: src/gdb/testsuite/gdb.base/watchpoint-solib.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/watchpoint-solib.c,v
retrieving revision 1.2
diff -u -p -r1.2 watchpoint-solib.c
--- src/gdb/testsuite/gdb.base/watchpoint-solib.c	3 Jan 2009 05:58:03
-0000	1.2
+++ src/gdb/testsuite/gdb.base/watchpoint-solib.c	1 Oct 2009 20:58:06
-0000
@@ -27,7 +27,6 @@
 # define dlsym(handle, func) GetProcAddress (handle, func)
 #endif
 #define dlclose(handle) FreeLibrary (handle)
-#define dlerror() "error %d occurred", GetLastError ()
 #else
 #include <dlfcn.h>
 #endif
@@ -42,7 +41,11 @@ void open_shlib ()
   
   if (!handle)
     {
-      fprintf (stderr, dlerror ());
+#ifdef __WIN32__
+      fprintf (stderr, "error %d occurred", GetLastError ());
+#else
+      fprintf (stderr, "%s", dlerror ());
+#endif
       exit (1);
     }
 



  reply	other threads:[~2009-10-01 21:22 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 20:48 GDB 6.8.92 available for testing Joel Brobecker
2009-10-01  3:17 ` Ralf Corsepius
2009-10-01  8:59   ` Andreas Schwab
2009-10-01  9:35     ` Pierre Muller
2009-10-01  9:42       ` Andreas Schwab
2009-10-01 12:11         ` Ralf Corsepius
2009-10-01 13:10           ` Jan Kratochvil
2009-10-02 15:40             ` Tom Tromey
2009-10-02 17:26               ` Jan Kratochvil
2009-10-01 10:09   ` Jan Kratochvil
2009-10-01 11:20     ` Ralf Corsepius
2009-10-01 18:16       ` Joel Brobecker
2009-10-02  2:46         ` Ralf Corsepius
2009-10-02 15:39     ` Tom Tromey
2009-10-02 17:28       ` Jan Kratochvil
2009-10-01 17:07   ` Joel Brobecker
2009-10-01 17:21     ` Ralf Corsepius
2009-10-01 17:35       ` Mark Kettenis
2009-10-01 18:27         ` Joel Brobecker
2009-10-01 18:37           ` Mark Kettenis
2009-10-01 20:22             ` Eli Zaretskii
2009-10-01 18:40           ` Paul Pluzhnikov
2009-10-01 18:25       ` Joel Brobecker
2009-10-02 15:48       ` Tom Tromey
2009-10-02 16:57         ` Ralf Corsepius
2009-10-02 17:27           ` Tom Tromey
2009-10-02 18:04             ` Mark Kettenis
2009-10-02 18:15               ` Joel Brobecker
2009-10-02 18:24                 ` Mark Kettenis
2009-10-02 18:38                   ` Jan Kratochvil
2009-10-02 21:46                     ` Tom Tromey
2009-10-02 22:00                       ` Jan Kratochvil
2009-10-02 15:35   ` Tom Tromey
2009-10-01 12:02 ` Pierre Muller
2009-10-01 17:56   ` Joel Brobecker
2009-10-01 21:22     ` Pierre Muller [this message]
2009-10-01 21:28       ` [RFA] more fixes to testsuite (was RE: GDB 6.8.92 available for testing) Joel Brobecker

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='000c01ca42dd$3f8c37c0$bea4a740$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@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