add a test + assert for GDB bug bypassed in r13472

* modify mcwatchpoints to print a 50000 char array
* add an assert to check the max allowed size



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13476
This commit is contained in:
Philippe Waroquiers 2013-07-30 20:26:06 +00:00
parent f79c9ac8c5
commit d4d5d3790b
5 changed files with 21 additions and 1 deletions

View File

@ -697,6 +697,8 @@ int putpkt_binary (char *buf, int cnt)
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. */

View File

@ -16,10 +16,11 @@ before rewriting 0
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

View File

@ -24,5 +24,10 @@ continue
continue
continue
del
break watchpoints.c:70
# continue till //break2:
continue
# trigger gdb reading data with big packets:
p *(k50)@50000
continue
quit

View File

@ -31,5 +31,10 @@ New value = 68 'D'
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.

View File

@ -63,5 +63,12 @@ int main (int argc, char *argv[])
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);
}