From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Stan Shebs Cc: Michael Snyder , Keith Seitz , gdb-patches@sources.redhat.com Subject: Re: [RFA] Assuming malloc exists in callfwmall.exp Date: Wed, 14 Feb 2001 13:46:00 -0000 Message-id: <3A8AFC92.53BEBA7F@cygnus.com> References: <3A8ABA01.C25B0FD2@cygnus.com> <3A8AEFEA.A2E2A61E@cygnus.com> <3A8AF68A.9B2CF558@cygnus.com> <3A8AFA2B.605F177D@apple.com> X-SW-Source: 2001-02/msg00227.html 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