bug v gdb? - covece, co s tim delate?

Libor Chocholaty libor_ml1 na mts.cz
Pondělí Únor 26 17:24:57 CET 2007


Filip Krejci wrote:
>> Zkusim upgrade gdb a uvidime.
>
> Tak ani cerstve zkompileny gdb 6.6 se s tim nevyrovna :-/
Clovece, co s tim delate?
ja jsem si copy-pastnul vas zdrojak, opravil volani calloc, prelozil a 
vsechno funguje.
GDB: GNU gdb 6.4.90-debian
GCC: gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

$ cat >gdb-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;
}
<ctrl-d>

$ gcc -g gdb-test.c -o gdb-test
$ gdb gdb-test
libor na chocho:~/progs/test$ gdb gdb-test
GNU gdb 6.4.90-debian
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 "i486-linux-gnu"...Using host libthread_db 
library "/lib/tls/libthread_db.so.1".

(gdb) b main
Breakpoint 1 at 0x8048365: file gdb-test.c, line 9.
(gdb) r
Starting program: /home/libor/progs/test/gdb-test

Breakpoint 1, main () at gdb-test.c:9
9         rec_t* rec = (rec_t*) calloc(1, sizeof(rec_t));
(gdb) display rec->id
1: rec->id = 1352914783712
(gdb) n
10        rec->id      = 10000;
1: rec->id = 0
(gdb)  c
Continuing.

Program exited normally.
(gdb) quit
libor na chocho:~/progs/test$





Další informace o konferenci Linux