This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb/gdb-8.0-branch] Make sure malloc is linked into gdb.cp/oranking.cc.
- From: Keith Seitz <kseitz at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 3 May 2017 19:42:01 -0000
- Subject: [binutils-gdb/gdb-8.0-branch] Make sure malloc is linked into gdb.cp/oranking.cc.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c2449d01b73b19acaf5add85b64c584fca9da366
commit c2449d01b73b19acaf5add85b64c584fca9da366
Author: Keith Seitz <keiths@redhat.com>
Date: Wed May 3 12:40:01 2017 -0700
Make sure malloc is linked into gdb.cp/oranking.cc.
On some platforms, e.g., arm-eabi-none, we need to make certain that
malloc is linked into the program because the test suite uses function
calls requiring malloc:
(gdb) p foo101("abc")
evaluation of this expression requires the program to have a function "malloc".
gdb/testsuite/ChangeLog
* gdb.cp/oranking.cc (dummy): New function to grab malloc.
(main): Call it.
Diff:
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.cp/oranking.cc | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 33d3bf1..5d29de4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-03 Keith Seitz <keiths@redhat.com>
+
+ * gdb.cp/oranking.cc (dummy): New function to grab malloc.
+ (main): Call it.
+
2017-04-27 Keith Seitz <keiths@redhat.com>
* gdb.cp/oranking.cc (test15): New function.
diff --git a/gdb/testsuite/gdb.cp/oranking.cc b/gdb/testsuite/gdb.cp/oranking.cc
index bd2f51b..1357610 100644
--- a/gdb/testsuite/gdb.cp/oranking.cc
+++ b/gdb/testsuite/gdb.cp/oranking.cc
@@ -1,3 +1,18 @@
+#include <cstdlib>
+
+/* Make sure `malloc' is linked into the program. If we don't, tests
+ in the accompanying expect file may fail:
+
+ evaluation of this expression requires the program to have a function
+ "malloc". */
+
+void
+dummy ()
+{
+ void *p = malloc (16);
+
+ free (p);
+}
/* 1. A standard covnersion sequence is better than a user-defined sequence
which is better than an elipses conversion sequence. */
@@ -165,6 +180,8 @@ test15 ()
}
int main() {
+ dummy ();
+
B b;
foo0(b);
foo1(b);