[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: memset (0, 0, 0);
From: |
Daniel Jacobowitz |
Subject: |
Re: memset (0, 0, 0); |
Date: |
Mon, 7 Apr 2003 09:07:31 -0400 |
User-agent: |
Mutt/1.5.1i |
On Mon, Apr 07, 2003 at 10:22:04AM +0100, Thomas,Stephen wrote:
> Hi,
>
> gdb appears to call memset(0,0,0) from build_regcache() in gdb/regcache.c. I
> can't really claim to understand how this works, but this function appears to
> get called 3 times during gdb initialization:
>
> static void build_regcache (void)
> {
> ...
> int sizeof_register_valid;
> ...
> sizeof_register_valid = ((NUM_REGS + NUM_PSEUDO_REGS) * sizeof
> (*register_valid));
> register_valid = xmalloc (sizeof_register_valid);
> memset (register_valid, 0, sizeof_register_valid);
> }
>
> On the 1st time of calling, none of the gdbarch stuff is set up, so NUM_REGS
> = NUM_PSEUDO_REGS = 0. So xmalloc gets called with size=0. That returns 0 as
> the 'address', which gets passed to memset. I guess this just works OK on
> other architectures (it does on x86 anyway).
>
> Easy enough to fix I suppose, but is that really the point?
Yes, I think that really is the point. It's just a bug, IMO.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
- memset (0, 0, 0);, Joern Rennecke, 2003/04/04
- Re: memset (0, 0, 0);, Daniel Jacobowitz, 2003/04/04
- Re: memset (0, 0, 0);, Andrew Cagney, 2003/04/04
- Re: memset (0, 0, 0);, Andreas Schwab, 2003/04/04
- Re: memset (0, 0, 0);, Petr Vandrovec, 2003/04/04
- RE: memset (0, 0, 0);, Thomas,Stephen, 2003/04/07
- Re: memset (0, 0, 0);, Wolfram Gloger, 2003/04/07
- Re: memset (0, 0, 0);,
Daniel Jacobowitz <=
- Re: memset (0, 0, 0);, Geoff Keating, 2003/04/07
- RE: memset (0, 0, 0);, Thomas,Stephen, 2003/04/07
- RE: memset (0, 0, 0);, Thomas,Stephen, 2003/04/08