Re: [RFA]: Fix gdb.base/callfwmall.exp for platforms without malloc

Michael Elizabeth Chastain
2001-05-22T09:16:00Z

As other people have pointed out, gdb needs a way to allocate memory in
the inferior. The chosen way is: call "malloc".

If the inferior program truly has no function named "malloc",
then gdb will produce this error:

evaluation of this expression requires the program to have a function "malloc"

If the inferior program has a function named "malloc", then gdb will
call it. Sometimes this is non-trivial. In particular, on hppa*-*-hpux*
targets, the inferior program uses a pair of function stubs for each
call to a shared library function. These stubs do some bookkeeping
for the address space change from the program text to the shared library
text.

Ordinarily the inferior program sets up these stubs and gdb piggybacks on
that work. But if a function is available in a shared library, but the
inferior does not call it, then gdb has to do additional work to find the
right place to call. There are actually different code paths for "call an
inferior function which the inferior itself calls" and "call an inferior
function which the inferior itself does not call". This is a feature,
and it needs testing.

Also, callfwmall.exp has 11 FAILs on native Red Hat Linux 6.2:

FAIL: gdb.base/callfwmall.exp: p t_float_values(3.14159,-2.3765)
FAIL: gdb.base/callfwmall.exp: p t_float_values(float_val1,float_val2)
FAIL: gdb.base/callfwmall.exp: p t_float_values(3.14159,float_val2)
FAIL: gdb.base/callfwmall.exp: p t_float_values(float_val1,-2.3765)
FAIL: gdb.base/callfwmall.exp: p t_float_values2(3.14159,float_val2)
FAIL: gdb.base/callfwmall.exp: p t_double_values(45.654,-67.66)
FAIL: gdb.base/callfwmall.exp: p t_double_values(double_val1,double_val2)
FAIL: gdb.base/callfwmall.exp: p t_double_values(45.654,double_val2)
FAIL: gdb.base/callfwmall.exp: p t_double_values(double_val1,-67.66)
FAIL: gdb.base/callfwmall.exp: call inferior func with struct - returns float
FAIL: gdb.base/callfwmall.exp: call inferior func with struct - returns double

The same tests in callfuncs.exp PASS.

Michael