From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 910 invoked by alias); 8 Apr 2003 17:57:24 -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 902 invoked from network); 8 Apr 2003 17:57:22 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 8 Apr 2003 17:57:22 -0000 Received: by fw-cam.cambridge.arm.com; id SAA26036; Tue, 8 Apr 2003 18:57:14 +0100 (BST) Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma025742; Tue, 8 Apr 03 18:56:18 +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 OAA07384; Tue, 8 Apr 2003 14:17:42 +0100 (BST) Received: from pc960.cambridge.arm.com (rearnsha@localhost) by pc960.cambridge.arm.com (8.11.6/8.9.3) with ESMTP id h38DHge05315; Tue, 8 Apr 2003 14:17:42 +0100 Message-Id: <200304081317.h38DHge05315@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, "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 17:57:00 -0000 From: Richard Earnshaw X-SW-Source: 2003-04/txt/msg00072.txt.bz2 [I've trimmed the cc list, cos the message was bouncing at sources.redhat.com] > > 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.