This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed]: [testsuite] Really ensure printf/fprintf are available in dprintf.exp
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Wed, 6 Jun 2012 16:55:30 +0800
- Subject: [committed]: [testsuite] Really ensure printf/fprintf are available in dprintf.exp
- References: <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);
+}