1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| $ gdb -q ./pouet
Reading symbols from /home/machin/tests/dvp/coin/pouet...done.
(gdb) set disassembly-flavor intel
(gdb) set follow-fork-mode child
(gdb) list 23,24
23 printf("%s\n", tinfo->file);
24 char *line;
(gdb) b 24
Breakpoint 1 at 0x400b72: file pouet.c, line 24.
(gdb) list 68,68
68 pthread_create(&tinfo->thread_id, &attr, count_lines, &tinfo);
(gdb) b 68
Breakpoint 2 at 0x400d12: file pouet.c, line 68.
(gdb) r
Starting program: /home/machin/tests/dvp/coin/./pouet
(...)
Breakpoint 2, main (argc=1, argv=0x7fffffffe1a8) at pouet.c:68
68 pthread_create(&tinfo->thread_id, &attr, count_lines, &tinfo);
(gdb) print tinfo
$1 = (struct thread_info *) 0x60b050
(gdb) print *tinfo
$2 = {thread_id = 0, thread_num = 0, file = 0x400e5c "contributors.txt", current_dir = 0x7fffffffdfa0 "/home/machin/tests/dvp/coin"}
(gdb) x/4gx tinfo
0x60b050: 0x0000000000000000 0x0000000000000000
0x60b060: 0x0000000000400e5c 0x00007fffffffdfa0
(gdb) c
Continuing.
[New Thread 0x7ffff77f4700 (LWP 9770)]
(...)
Breakpoint 1, count_lines (args=0x7fffffffdf40) at pouet.c:25
25 line = (char*) malloc (sizeof(char));
(gdb) print args
$3 = (void *) 0x7fffffffdf40
(gdb) print tinfo
$4 = (struct thread_info *) 0x7fffffffdf40
(gdb) print *tinfo
$5 = {thread_id = 6336592, thread_num = -8288, file = 0x603010 "\a", current_dir = 0x0}
(gdb) x/4gx tinfo
0x7fffffffdf40: 0x000000000060b050 0x00007fffffffdfa0
0x7fffffffdf50: 0x0000000000603010 0x0000000000000000[/color]
(gdb) print *(struct thread_info*)*tinfo
$6 = {thread_id = 140737345701632, thread_num = 0, file = 0x400e5c "contributors.txt", current_dir = 0x7fffffffdfa0 "/home/machin/tests/dvp/coin"} |
Partager