bug v gdb? - covece, no to mi reknete Vy, co s tim delate? :-)

Filip Krejci krejcif na gmail.com
Pondělí Únor 26 17:37:31 CET 2007


  >> $ cat test.c
#include <stdlib.h>

typedef struct {
        char d;
        unsigned long long int id;
} rec_t;

int main(void){
   rec_t*rec = (rec_t*) calloc(1,sizeof(rec_t));
   rec->id      = 10000;
   return 0;
}
  >> $ gcc -g test.c -o test
  >> $ gdb test
GNU gdb 6.6
Copyright (C) 2006 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 "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) b main
Breakpoint 1 at 0x8048394: file test.c, line 9.
(gdb) r
Starting program: /tmp/test

Breakpoint 1, main () at test.c:9
9         rec_t*rec = (rec_t*) calloc(1,sizeof(rec_t));
(gdb) display rec->id
1: rec->id = 14087541109396006948
(gdb) n
10        rec->id      = 10000;
1: rec->id = 580477714956288
(gdb) n
11        return 0;
1: rec->id = 580477714956288
(gdb) n
12      }
1: rec->id = 580477714956288
(gdb) n
0x4003b974 in __libc_start_main () from /lib/tls/libc.so.6
(gdb) q
The program is running.  Exit anyway? (y or n) y
  >> $ gcc --version
gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Ze by obstarozni gcc ?


-- 
Filip Krejci <krejcif na gmail.com>

Warum nicht Linux ?


Další informace o konferenci Linux