From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1391 invoked by alias); 8 Apr 2003 13:10:49 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1372 invoked from network); 8 Apr 2003 13:10:44 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 8 Apr 2003 13:10:44 -0000 Received: by fw-cam.cambridge.arm.com; id OAA20357; Tue, 8 Apr 2003 14:10:40 +0100 (BST) Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma018664; Tue, 8 Apr 03 14:09:28 +0100 Received: from pc960.cambridge.arm.com (pc960.cambridge.arm.com [10.1.205.4]) by cam-admin0.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id KAA28384; Tue, 8 Apr 2003 10:29:56 +0100 (BST) Received: from pc960.cambridge.arm.com (rearnsha@localhost) by pc960.cambridge.arm.com (8.11.6/8.9.3) with ESMTP id h389TuE03840; Tue, 8 Apr 2003 10:29:56 +0100 Message-Id: <200304080929.h389TuE03840@pc960.cambridge.arm.com> X-Authentication-Warning: pc960.cambridge.arm.com: rearnsha owned process doing -bs To: "Thomas,Stephen" cc: "Geoff Keating" , gdb@sources.redhat.com, newlib@sources.redhat.com, bug-glibc@gnu.org, "McGoogan, Sean" , Richard.Earnshaw@arm.com, Andrew Cagney Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. Subject: Re: memset (0, 0, 0); In-reply-to: Your message of "Tue, 08 Apr 2003 08:52:39 BST." <9FF3133289A7A84E81E2ED8F5E56B379604386@sh-uk-ex01.uk.w2k.superh.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 08 Apr 2003 13:10:00 -0000 From: Richard Earnshaw X-SW-Source: 2003-04/txt/msg00069.txt.bz2 > > Hi Geoff, > > Which xmalloc are you referring to? The xmalloc in this case is a gdb internal function, defined in gdb/utils.c: > > PTR xmalloc (size_t size) > { > return xmmalloc (NULL, size); > } > > And xmmalloc is: > > void * xmmalloc (void *md, size_t size) > { > void *val; > > if (size == 0) > { > val = NULL; > } > else > { > val = mmalloc (md, size); > if (val == NULL) > nomem (size); > } > return (val); > } > > So size=0 does indeed return NULL. Also, I have single stepped this code to verify that this is actually what happens. 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? R.