From: Michael Snyder <msnyder@cygnus.com>
To: Stephane Carrez <Stephane.Carrez@worldnet.fr>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA]: Fix gdb.base/callfwmall.exp for platforms without malloc
Date: Mon, 21 May 2001 10:43:00 -0000 [thread overview]
Message-ID: <3B0953AC.86578124@cygnus.com> (raw)
In-Reply-To: <3B07B042.6BAD93A0@worldnet.fr>
Stephane Carrez wrote:
>
> Hi!
>
> The test gdb.base/callfwmall.exp checks for the GDB ability to
> 'call/print' a function of the inferior. Several print commands
> require the program to have 'malloc' so that GDB allocates a string
> for input parameters. The 'callfwmall.c' file does not have any
> reference to malloc, which means that the final executable may not
> have it. This is my case for HC11. This means that the test fails
> with:
>
> (gdb) FAIL: gdb.base/callfwmall.exp: p t_string_values("string 1","string 2")
> p t_string_values("string 1",string_val2)
> evaluation of this expression requires the program to have a function "malloc".
This is the whole purpose of the callfwmall.c test. The name stands for
"call functions without malloc". It tests whether GDB can call functions
without the presence of malloc, and if it cannot (as in your case),
then the test should fail. Or else be skipped.
> The following patch uses a new 'gdb,nomalloc' configuration variable
> to check whether these 't_string_values' tests can be made or not.
>
> Can you approve this patch?
No -- but perhaps we could approve a patch that would cause this
test to be skipped (or xfailed) for targets in which we know it
cannot pass.
>
> Stephane
>
> 2001-05-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
>
> * gdb.base/callfwmall.exp (do_function_calls): Check for gdb,nomalloc
> and don't execute the tests that require the program to have malloc.
>
> ----------------------------------------------------------------------------------------------------
> Index: testsuite/gdb.base/callfwmall.exp
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.base/callfwmall.exp,v
> retrieving revision 1.2
> diff -u -p -r1.2 callfwmall.exp
> --- callfwmall.exp 2001/03/06 08:21:50 1.2
> +++ callfwmall.exp 2001/05/20 11:39:27
> @@ -167,18 +167,24 @@ proc do_function_calls {} {
>
> }
>
> - gdb_test "p t_string_values(string_val2,string_val1)" " = 0"
> - gdb_test "p t_string_values(string_val1,string_val2)" " = 1"
> - gdb_test "p t_string_values(\"string 1\",\"string 2\")" " = 1"
> - gdb_test "p t_string_values(\"string 1\",string_val2)" " = 1"
> - gdb_test "p t_string_values(string_val1,\"string 2\")" " = 1"
> -
> + # Calling a function with a string as parameter requires the
> + # program to provide malloc(). The string is allocated in
> + # malloc area (and... by the way never freed!!!).
> + # Don't execute this test on platforms that don't provide malloc.
> + if ![target_info exists gdb,nomalloc] {
> + gdb_test "p t_string_values(string_val2,string_val1)" " = 0"
> + gdb_test "p t_string_values(string_val1,string_val2)" " = 1"
> + gdb_test "p t_string_values(\"string 1\",\"string 2\")" " = 1"
> + gdb_test "p t_string_values(\"string 1\",string_val2)" " = 1"
> + gdb_test "p t_string_values(string_val1,\"string 2\")" " = 1"
> + }
> gdb_test "p t_char_array_values(char_array_val2,char_array_val1)" " = 0"
> gdb_test "p t_char_array_values(char_array_val1,char_array_val2)" " = 1"
> - gdb_test "p t_char_array_values(\"carray 1\",\"carray 2\")" " = 1"
> - gdb_test "p t_char_array_values(\"carray 1\",char_array_val2)" " = 1"
> - gdb_test "p t_char_array_values(char_array_val1,\"carray 2\")" " = 1"
> -
> + if ![target_info exists gdb,nomalloc] {
> + gdb_test "p t_char_array_values(\"carray 1\",\"carray 2\")" " = 1"
> + gdb_test "p t_char_array_values(\"carray 1\",char_array_val2)" " = 1"
> + gdb_test "p t_char_array_values(char_array_val1,\"carray 2\")" " = 1"
> + }
> gdb_test "p doubleit(4)" " = 8"
> gdb_test "p add(4,5)" " = 9"
> gdb_test "p t_func_values(func_val2,func_val1)" " = 0"
> @@ -222,10 +228,12 @@ proc do_function_calls {} {
> gdb_test "p t_enum_value2(enum_val2)" " = 1"
> gdb_test "p t_enum_value2(enum_val1)" " = 0"
>
> - gdb_test "p sum_args(1,{2})" " = 2"
> - gdb_test "p sum_args(2,{2,3})" " = 5"
> - gdb_test "p sum_args(3,{2,3,4})" " = 9"
> - gdb_test "p sum_args(4,{2,3,4,5})" " = 14"
> + if ![target_info exists gdb,nomalloc] {
> + gdb_test "p sum_args(1,{2})" " = 2"
> + gdb_test "p sum_args(2,{2,3})" " = 5"
> + gdb_test "p sum_args(3,{2,3,4})" " = 9"
> + gdb_test "p sum_args(4,{2,3,4,5})" " = 14"
> + }
> gdb_test "p sum10 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" " = 55"
>
> gdb_test "p t_structs_c(struct_val1)" "= 120 'x'" \
next parent reply other threads:[~2001-05-21 10:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3B07B042.6BAD93A0@worldnet.fr>
2001-05-21 10:43 ` Michael Snyder [this message]
2001-05-21 10:56 ` Keith Seitz
2001-05-21 11:10 ` Michael Snyder
2001-05-21 14:20 ` Stephane Carrez
2001-05-21 14:58 ` Michael Snyder
2001-05-21 22:45 ` Jim Blandy
2001-06-06 9:07 ` Andrew Cagney
2001-05-22 9:16 Michael Elizabeth Chastain
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=3B0953AC.86578124@cygnus.com \
--to=msnyder@cygnus.com \
--cc=Stephane.Carrez@worldnet.fr \
--cc=gdb-patches@sources.redhat.com \
/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