From: Richard Earnshaw <rearnsha@arm.com>
To: "Thomas,Stephen" <stephen.thomas@superh.com>
Cc: "Geoff Keating" <geoffk@geoffk.org>,
gdb@sources.redhat.com, newlib@sources.redhat.com,
bug-glibc@gnu.org, "McGoogan, Sean" <sean.mcgoogan@superh.com>,
Richard.Earnshaw@arm.com, Andrew Cagney <ac131313@redhat.com>
Subject: Re: memset (0, 0, 0);
Date: Tue, 08 Apr 2003 13:10:00 -0000 [thread overview]
Message-ID: <200304080929.h389TuE03840@pc960.cambridge.arm.com> (raw)
In-Reply-To: Your message of "Tue, 08 Apr 2003 08:52:39 BST." <9FF3133289A7A84E81E2ED8F5E56B379604386@sh-uk-ex01.uk.w2k.superh.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.
next prev parent reply other threads:[~2003-04-08 13:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-08 7:52 Thomas,Stephen
2003-04-08 13:10 ` Richard Earnshaw [this message]
2003-04-08 13:26 ` Daniel Jacobowitz
2003-04-08 16:40 ` Richard Earnshaw
2003-04-08 20:51 ` Andrew Cagney
2003-04-08 17:57 ` Richard Earnshaw
-- strict thread matches above, loose matches on Subject: below --
2003-04-07 9:22 Thomas,Stephen
2003-04-07 13:07 ` Daniel Jacobowitz
2003-04-07 17:18 ` Geoff Keating
2003-04-04 16:12 Petr Vandrovec
2003-04-04 21:36 ` Andreas Schwab
2003-04-04 14:54 Joern Rennecke
2003-04-04 15:04 ` Daniel Jacobowitz
2003-04-04 15:16 ` Andrew Cagney
2003-04-04 15:21 ` Andreas Schwab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200304080929.h389TuE03840@pc960.cambridge.arm.com \
--to=rearnsha@arm.com \
--cc=Richard.Earnshaw@arm.com \
--cc=ac131313@redhat.com \
--cc=bug-glibc@gnu.org \
--cc=gdb@sources.redhat.com \
--cc=geoffk@geoffk.org \
--cc=newlib@sources.redhat.com \
--cc=sean.mcgoogan@superh.com \
--cc=stephen.thomas@superh.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox