This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Assuming malloc exists in callfwmall.exp
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.
>
OK. But it makes no sense trying it on a target that does not have malloc().
For such targets, the inferior call attempt should fail when strings are passed as arguments with some meaningful message (maybe that is what happens, I haven't seem the gdb.log).
Do you happen to know why was it important to test with a test program that does not call malloc() itself?
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9