This is the mail archive of the gdb@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]
Other format: [Raw text]

Re: memset (0, 0, 0);


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



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