Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [committed]: [testsuite] Really ensure printf/fprintf are available in dprintf.exp
Date: Wed, 06 Jun 2012 08:55:00 -0000	[thread overview]
Message-ID: <4FCF1B02.5020707@codesourcery.com> (raw)
In-Reply-To: <1338554885-3954-1-git-send-email-yao@codesourcery.com>

On 06/01/2012 08:48 PM, Yao Qi wrote:
> 2012-06-01  Yao Qi  <yao@codesourcery.com>
> 
> 	* gdb.base/dprintf.c (main): Add extra parameter.
> 	(bar): New function.  It is a dead function, but to ensure
> 	'malloc' is linked explicitly.

Patch attached is what I committed (with the typo fixed).
http://sourceware.org/ml/gdb-cvs/2012-06/msg00045.html

-- 
Yao (齐尧) 

2012-06-06  Yao Qi  <yao@codesourcery.com>
 
	* gdb.base/dprintf.c (main): Add extra parameter when calling
	printf and fprintf.
	(bar): New function.  It is a dead function, but to ensure
	'malloc' is linked explicitly.

RCS file: /cvs/src/src/gdb/testsuite/gdb.base/dprintf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- src/gdb/testsuite/gdb.base/dprintf.c	2012/05/14 15:38:41	1.1
+++ src/gdb/testsuite/gdb.base/dprintf.c	2012/06/06 08:51:22	1.2
@@ -33,8 +33,8 @@
   int loc = 1234;
 
   /* Ensure these functions are available.  */
-  printf ("kickoff\n");
-  fprintf (stderr, "also to stderr\n");
+  printf ("kickoff %d\n", loc);
+  fprintf (stderr, "also to stderr %d\n", loc);
 
   foo (loc++);
   foo (loc++);
@@ -42,3 +42,17 @@
   return g;
 }
 
+#include <stdlib.h>
+/* Make sure function 'malloc' is linked into program.  One some bare-metal
+   port, if we don't use 'malloc', it will not be linked in program.  'malloc'
+   is needed, otherwise we'll see such error message
+
+   evaluation of this expression requires the program to have a function
+   "malloc".  */
+void
+bar (void)
+{
+  void *p = malloc (16);
+
+  free (p);
+}


      parent reply	other threads:[~2012-06-06  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-01 12:48 Yao Qi
2012-06-01 13:03 ` Pierre Muller
2012-06-01 13:13   ` Yao Qi
2012-06-06  8:55 ` Yao Qi [this message]

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=4FCF1B02.5020707@codesourcery.com \
    --to=yao@codesourcery.com \
    --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