bug v gdb?

Horák Jan horak.jan na icebraker.org
Pondělí Únor 26 16:18:04 CET 2007


Mno tak mne to funguje, ale radsi byste si mel opravit volani 'calloc' z:

rec_t* rec = (rec_t*) calloc(sizeof(rec_t),1);

na:

rec_t* rec = (rec_t*) calloc(1,sizeof(rec_t));


S pozdravem,
	Jan Horak.


GNU gdb 6.4-debian
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db
library "/lib/tls/i686/cmov/libthread_db.so.1".

(gdb) b main
Breakpoint 1 at 0x804837c: file a.c, line 9.
(gdb) n
The program is not being run.
(gdb) r
Starting program: /tmp/a

Breakpoint 1, main () at a.c:9
9         rec_t* rec = (rec_t*) calloc(1,sizeof(rec_t));
(gdb) n
10        rec->id      = 10000;
(gdb) print rec->id
$1 = 0
(gdb) n
11        return 0;
(gdb) print rec->id
$2 = 10000
(gdb) print rec->id
$3 = 10000
(gdb) print rec->id
$4 = 10000
(gdb)


Další informace o konferenci Linux