]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Make sure malloc is linked into gdb.cp/oranking.cc.
authorKeith Seitz <keiths@redhat.com>
Wed, 3 May 2017 19:40:01 +0000 (12:40 -0700)
committerKeith Seitz <keiths@redhat.com>
Wed, 3 May 2017 19:40:01 +0000 (12:40 -0700)
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.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.cp/oranking.cc

index 33d3bf1d4b423fd5f160da1dc26a14b1d1f57484..5d29de4862dc843e3c73d13166b67bfedd8c7e13 100644 (file)
@@ -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.
index bd2f51bb05d15a62889777e4a6bfbbd734262fd8..135761016cc5ea21a816d7547c6741ac27930598 100644 (file)
@@ -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);