From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [testsuite] Really ensure printf/fprintf are available in dprintf.exp
Date: Fri, 01 Jun 2012 12:48:00 -0000 [thread overview]
Message-ID: <1338554885-3954-1-git-send-email-yao@codesourcery.com> (raw)
I noticed some fails of gdb.base/dprintf.exp on tic6x-elf-gdb testing.
FAIL: gdb.base/dprintf.exp: 1st dprintf, call
FAIL: gdb.base/dprintf.exp: 2nd dprintf, call
caused by unable to find symbol "printf" and "malloc",
(gdb) continue
Continuing.
kickoff
also to stderr
No symbol "printf" in current context.
If printf/fprintf only prints constant string, compiler will replace
them to puts/fwrite respectively, and actual printf/fprintf is not
linked into executable. This problem should affect other ELF gdb.
This patch simply add extra parameter in printf/fprintf to make sure
they are linked, instead of puts/fwrite.
I'll apply it in two or three days if no comments.
gdb/testsuite:
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.
---
gdb/testsuite/gdb.base/dprintf.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/dprintf.c b/gdb/testsuite/gdb.base/dprintf.c
index 283ff58..8140a3e 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-mental
+ 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);
+}
--
1.7.0.4
next reply other threads:[~2012-06-01 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 12:48 Yao Qi [this message]
2012-06-01 13:03 ` Pierre Muller
2012-06-01 13:13 ` Yao Qi
2012-06-06 8:55 ` [committed]: " Yao Qi
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=1338554885-3954-1-git-send-email-yao@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