Re: memset (0, 0, 0);

Andrew Cagney
2003-04-08T20:51:21Z

> It looks as though that implementation of xmalloc doesn't match the
>> general specification of xmalloc, which is that xmalloc must *never*
>> return NULL (see libiberty/xmalloc.c for the specification).
>>
>> I'm not sure why gdb is trying to provide its own implementation of these
>> functions and not use those in libiberty. Andrew?
>
>
> The ones in libiberty call exit; the ones in gdb call error() and
> unwind cleanups. GDB prefers not to abort when it runs out of memory,
> esp. if it can just abort the current operation and reclaim memory.

The other reason is that, optionally, they need to be routed through to
mmalloc() calls.

Anyway, it should be pretty clear that the real problem here is that
something was lost in the liberty/xmalloc -> gdb/xmalloc translation (I
suspect that there was a debate way back when and it forgot to take
liberty's xmalloc's `well defined semantics' into account).

I'll check in a `fix'.

Andrew