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

Michael Snyder
2001-02-14T14:35:00Z

Stan Shebs wrote:
>
> Fernando Nasser wrote:
> >
> > But how is it possible that GDB needs malloc() when the target does not have it?
>
> (gdb) p strlen("foobar")
>
> The string itself needs to be in the target's memory, so you can give
> the function a pointer to it. malloc() is a convenient default way
> to acquire the space, then GDB copies in the string's contents.

That's exactly why the source code for the test (callfuncs)
has a superfluous call to malloc, and exactly why this test
(callfwmall) removes the superfluous malloc call.

By the way, the name "callfwmall" stands for
"callfuncs without malloc".

Michael