aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-06-06 08:51:22 +0000
committerYao Qi <yao@codesourcery.com>2012-06-06 08:51:22 +0000
commit7b2fe205fd75672d5925fe63f3a0896fa3168aaf (patch)
treed68baf05b2ba67a30adc0e27bc455bdfad61d252
parent3eca55e89d6002176819277291508cbb7556c0c9 (diff)
downloadgdb-7b2fe205fd75672d5925fe63f3a0896fa3168aaf.zip
gdb-7b2fe205fd75672d5925fe63f3a0896fa3168aaf.tar.gz
gdb-7b2fe205fd75672d5925fe63f3a0896fa3168aaf.tar.bz2
gdb/testsuite/
* 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.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/dprintf.c18
2 files changed, 23 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9268014..d2aa587 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2012-06-06 Yao Qi <yao@codesourcery.com>
+
* gdb.base/info-proc.exp: Return if target doesn't support
'info proc'.
diff --git a/gdb/testsuite/gdb.base/dprintf.c b/gdb/testsuite/gdb.base/dprintf.c
index 283ff58..f695ff1 100644
--- a/gdb/testsuite/gdb.base/dprintf.c
+++ b/gdb/testsuite/gdb.base/dprintf.c
@@ -33,8 +33,8 @@ main (int argc, char *argv[])
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 @@ main (int argc, char *argv[])
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);
+}