This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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.

Stan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]