aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2018-04-10 20:18:53 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2018-07-06 14:31:37 +0100
commite0e5e971ae89da1ded13013bb7378dc5f09363af (patch)
treedbe01bb92318d1a449c1340f6c957470f0acb815 /gdb
parentd20e98ab59ea49d3f90bf05ac7b16c0d3588ce41 (diff)
downloadgdb-e0e5e971ae89da1ded13013bb7378dc5f09363af.zip
gdb-e0e5e971ae89da1ded13013bb7378dc5f09363af.tar.gz
gdb-e0e5e971ae89da1ded13013bb7378dc5f09363af.tar.bz2
gdb/testsuite: Ensure test links in malloc and free
The test associated with the source file gdb.base/share-env-with-gdbserver.c relies on calling malloc and free within the inferior from GDB. However, as the test source itself makes no use of these functions, there's no requirement that they be linked into the test executable. This commit adds a dummy call to malloc and free to ensure they are linked into the test executable. gdb/testsuite/ChangeLog: * gdb.base/share-env-with-gdbserver.c (main): Add call to malloc/free.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/share-env-with-gdbserver.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a9e1618..d908b85 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.base/share-env-with-gdbserver.c (main): Add call to
+ malloc/free.
+
2018-07-04 Tom de Vries <tdevries@suse.de>
* gdb.dwarf2/dw2-error.exp: Update expected error message.
diff --git a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
index 2b821cd..213dde3 100644
--- a/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
+++ b/gdb/testsuite/gdb.base/share-env-with-gdbserver.c
@@ -29,6 +29,8 @@ my_getenv (const char *name)
int
main (int argc, char *argv[])
{
+ /* Call malloc to ensure it is linked in. */
+ char *tmp = malloc (1);
const char *myvar = getenv ("GDB_TEST_VAR");
if (myvar != NULL)
@@ -36,5 +38,6 @@ main (int argc, char *argv[])
else
printf ("It failed.");
+ free (tmp);
return 0; /* break-here */
}