Re: [RFA] Assuming malloc exists in callfwmall.exp

Andrew Cagney
2001-02-14T18:17:00Z

Michael Elizabeth Chastain wrote:
>
> Another hour, another change of mind.
>
> The point of callfwmall.exp is to show that gdb can call functions in
> the inferior even if the inferior does not have "malloc". callfuncs.exp
> will never be able to do that.
>
> So I think the right thing to do in callfwmall.exp is:
>
> (1) Test for the presence of malloc the way Keith Seitz is doing
> (but put the test after runto_main).
>
> (2) If malloc is present, disable the test script.
>
> (3) If malloc is absent, go ahead and run the whole test script.

I don't think this logic is right. Consider:

This GDB was configured as "i386-unknown-netbsdelf1.5.1."...
(gdb) p malloc
No symbol "malloc" in current context.
(gdb) p main
$1 = {int ()} 0x8048954
(gdb) b main
Breakpoint 1 at 0x8048959: file
/home/scratch/GDB/src/gdb/testsuite/gdb.base/callfwmall.c, line 177.
(gdb) run
Starting program:
/home/scratch/GDB/native/gdb/testsuite/gdb.base/callfwmall

Breakpoint 1, main ()
at /home/scratch/GDB/src/gdb/testsuite/gdb.base/callfwmall.c:177
177 t_structs_c(struct_val1);
(gdb) p malloc
$2 = {<text variable, no debug info>} 0x4804d020 <malloc>
(gdb)

it is testing exactly what it should be testing but the above would
disable malloc for this target.

Andrew