summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/dprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/dprintf.c')
-rw-r--r--gdb/testsuite/gdb.base/dprintf.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/dprintf.c b/gdb/testsuite/gdb.base/dprintf.c
index 283ff5803aa..f695ff1306b 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);
+}