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