Make sure malloc is linked into gdb.cp/oranking.cc.
Commit Message
On some platforms, e.g., arm-eabi-none, we need to make certain that
malloc is linked into the program because oranking.exp uses function
calls requiring it:
(gdb) p foo101("abc")
evaluation of this expression requires the program to have a function "malloc".
While not a big deal (this is /not/ a regression), I think this would be
appropriate for inclusion in 8.0.
gdb/testsuite/ChangeLog
* gdb.cp/oranking.cc (dummy): New function to grab malloc.
(main): Call it.
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.cp/oranking.cc | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
Comments
Keith Seitz <keiths@redhat.com> writes:
> While not a big deal (this is /not/ a regression), I think this would be
> appropriate for inclusion in 8.0.
Yes.
>
> gdb/testsuite/ChangeLog
>
> * gdb.cp/oranking.cc (dummy): New function to grab malloc.
> (main): Call it.
Patch is good to me.
Hi,
On 02/05/17 19:42, Keith Seitz wrote:
> On some platforms, e.g., arm-eabi-none, we need to make certain that
> malloc is linked into the program because oranking.exp uses function
> calls requiring it:
>
> (gdb) p foo101("abc")
> evaluation of this expression requires the program to have a function "malloc".
>
> While not a big deal (this is /not/ a regression), I think this would be
> appropriate for inclusion in 8.0.
>
> gdb/testsuite/ChangeLog
>
> * gdb.cp/oranking.cc (dummy): New function to grab malloc.
> (main): Call it.
> ---
> 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 9c0d68b..2e587d6 100644
> --- a/gdb/testsuite/ChangeLog
> +++ b/gdb/testsuite/ChangeLog
> @@ -1,3 +1,8 @@
> +2017-05-02 Keith Seitz <keiths@redhat.com>
> +
> + * gdb.cp/oranking.cc (dummy): New function to grab malloc.
> + (main): Call it.
> +
> 2017-05-01 Tim Wiederhake <tim.wiederhake@intel.com>
>
> * gdb.python/py-record-btrace.exp: Rename prev_sibling and next_sibling
> 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);
>
Thanks Keith. I've tested the patch on arm-none-eabi and this solve the issue at
end. I can also confirm that this is not a regression, the KFAIL->FAIL is only
due to the the removal of setup_kfail in
e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f, the error was already there before the
commit.
Best regards,
Thomas
On 05/03/2017 03:38 AM, Thomas Preudhomme wrote:
> Thanks Keith. I've tested the patch on arm-none-eabi and this solve
> the issue at end. I can also confirm that this is not a regression,
> the KFAIL->FAIL is only due to the the removal of setup_kfail in
> e15c3eb45bdc8bd5717fd5ceddcc30c3de07b58f, the error was already there
> before the commit.
Excellent. I've pushed the patch to both master and the 8.0 branch.
Thank you for following up on this.
Keith
@@ -1,3 +1,8 @@
+2017-05-02 Keith Seitz <keiths@redhat.com>
+
+ * gdb.cp/oranking.cc (dummy): New function to grab malloc.
+ (main): Call it.
+
2017-05-01 Tim Wiederhake <tim.wiederhake@intel.com>
* gdb.python/py-record-btrace.exp: Rename prev_sibling and next_sibling
@@ -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);