[PATCH RFA] utils.c: Fix xcalloc (0, 0) behavior

Kevin Buettner kevinb@cygnus.com
Sat Mar 3 00:02:00 GMT 2001


On Mar 3, 12:58am, Kevin Buettner wrote:

> Unfortunately, our implementation of xcalloc() and xmrealloc() choose
> to treat the NULL return value as an error condition and call nomem()
> as a result.

It just occurred to me that someone reviewing this patch may want
to know which xcalloc() call in gdb was responsible for generating
a zero-sized request.  See below for the backtrace...

Breakpoint 3, nomem (size=0) at /saguaro1/sourceware-ia64/src/gdb/utils.c:1005
1005      if (size > 0)
(top-gdb) bt 8
#0  nomem (size=0) at /saguaro1/sourceware-ia64/src/gdb/utils.c:1005
During symbol reading, type qualifier 'const' ignored.
#1  0x20000100f0162380 in xcalloc (number=0, size=8)
    at /saguaro1/sourceware-ia64/src/gdb/utils.c:1076
#2  0x20000100f00f6760 in alloc_gdbarch_data (gdbarch=0x10000024f18)
    at /saguaro1/sourceware-ia64/src/gdb/gdbarch.c:4229
#3  0x20000100f00eb8d0 in gdbarch_alloc (info=0x3fefffff3d7c0, 
    tdep=0x10000024eb0) at /saguaro1/sourceware-ia64/src/gdb/gdbarch.c:393
#4  0x20000100f01a4ee0 in ia64_gdbarch_init (info={
      bfd_architecture = bfd_arch_ia64, bfd_arch_info = 0x300341fb8, 
      byte_order = 1234, abfd = 0x0, tdep_info = 0x0}, arches=0x0)
    at /saguaro1/sourceware-ia64/src/gdb/ia64-tdep.c:1971
#5  0x20000100f00f7aa0 in gdbarch_update_p (info={
      bfd_architecture = bfd_arch_ia64, bfd_arch_info = 0x300341fb8, 
      byte_order = 1234, abfd = 0x0, tdep_info = 0x0})
    at /saguaro1/sourceware-ia64/src/gdb/gdbarch.c:4579
#6  0x20000100f00f90a0 in initialize_current_architecture ()
    at /saguaro1/sourceware-ia64/src/gdb/arch-utils.c:685
During symbol reading, type qualifier 'volatile' ignored.
#7  0x20000100f015b070 in gdb_init (
    argv0=0x3fefffffff880 "/home/kev/sourceware-ia64-bld/gdb/gdb")
    at /saguaro1/sourceware-ia64/src/gdb/top.c:685




More information about the Gdb-patches mailing list