buf2 = malloc (PBUFSIZ+POVERHSIZ);
// should malloc PBUFSIZ, but bypass GDB bug (see gdbserver_init in server.c)
+ vg_assert (5 == POVERHSIZ);
+ vg_assert (cnt <= PBUFSIZ); // be tolerant for GDB bug.
/* Copy the packet into buffer BUF2, encapsulating it
and giving it a checksum. */
before rewriting 4
before rewriting 8
value 0nde4ine8
+value of k50[1000] p
HEAP SUMMARY:
in use at exit: 0 bytes in 0 blocks
- total heap usage: 0 allocs, 0 frees, 0 bytes allocated
+ total heap usage: 1 allocs, 1 frees, 50,000 bytes allocated
For a detailed leak analysis, rerun with: --leak-check=full
continue
continue
del
+break watchpoints.c:70
+# continue till //break2:
+continue
+# trigger gdb reading data with big packets:
+p *(k50)@50000
continue
quit
main (argc=1, argv=0x........) at watchpoints.c:49
49 fprintf(stderr, "after writing 8\n");
Delete all breakpoints? (y or n) [answered Y; input not from terminal]
+Breakpoint 8 at 0x........: file watchpoints.c, line 70.
+Continuing.
+Breakpoint 8, main (argc=1, argv=0x........) at watchpoints.c:70
+70 free(k50); //break2
+$1 = 'p' <repeats 50000 times>
Continuing.
Program exited normally.
fprintf(stderr, "value %s\n", undefined);
+ {
+ char *k50 = malloc(50000);
+ memset (k50, 'p', 50000);
+ fprintf(stderr, "value of k50[1000] %c\n", k50[1000]);
+ free(k50); //break2
+ }
+
exit(0);
}