Re: malloc in inferior

Andrew Cagney
2003-05-29T16:42:04Z

> For some stubs these would be useful; for the stubs I deal with, which
> sit in user space on normal OS's, rather less so. The stub would end
> up calling malloc anyway.
>
> Personally, I'm of the opinion that we should solve this problem by
> changing the definitions: mark strings as ephemeral and let the user
> call malloc or strdup directly if they want something to last.

That wouldn't work. A user needs to be able to cut/paste arbitrary C
source code into the GDB console and have it just work.

Given that most users don't even realize that the malloc is being
called, I think it is working well.

> Or make
> it a set option. I'm not sure how popular that idea would be; anyone
> else have a comment?

A set option, or (discussed previously) allocated lazy fashion.

Andrew