|
From: <sv...@va...> - 2013-07-30 20:26:15
|
philippe 2013-07-30 21:26:06 +0100 (Tue, 30 Jul 2013)
New Revision: 13476
Log:
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
Modified files:
trunk/coregrind/m_gdbserver/remote-utils.c
trunk/gdbserver_tests/mcwatchpoints.stderr.exp
trunk/gdbserver_tests/mcwatchpoints.stdinB.gdb
trunk/gdbserver_tests/mcwatchpoints.stdoutB.exp
trunk/gdbserver_tests/watchpoints.c
Modified: trunk/gdbserver_tests/mcwatchpoints.stderr.exp (+2 -1)
===================================================================
--- trunk/gdbserver_tests/mcwatchpoints.stderr.exp 2013-07-29 20:02:43 +01:00 (rev 13475)
+++ trunk/gdbserver_tests/mcwatchpoints.stderr.exp 2013-07-30 21:26:06 +01:00 (rev 13476)
@@ -16,10 +16,11 @@
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
Modified: trunk/gdbserver_tests/mcwatchpoints.stdinB.gdb (+5 -0)
===================================================================
--- trunk/gdbserver_tests/mcwatchpoints.stdinB.gdb 2013-07-29 20:02:43 +01:00 (rev 13475)
+++ trunk/gdbserver_tests/mcwatchpoints.stdinB.gdb 2013-07-30 21:26:06 +01:00 (rev 13476)
@@ -24,5 +24,10 @@
continue
continue
del
+break watchpoints.c:70
+# continue till //break2:
continue
+# trigger gdb reading data with big packets:
+p *(k50)@50000
+continue
quit
Modified: trunk/coregrind/m_gdbserver/remote-utils.c (+2 -0)
===================================================================
--- trunk/coregrind/m_gdbserver/remote-utils.c 2013-07-29 20:02:43 +01:00 (rev 13475)
+++ trunk/coregrind/m_gdbserver/remote-utils.c 2013-07-30 21:26:06 +01:00 (rev 13476)
@@ -697,6 +697,8 @@
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. */
Modified: trunk/gdbserver_tests/watchpoints.c (+7 -0)
===================================================================
--- trunk/gdbserver_tests/watchpoints.c 2013-07-29 20:02:43 +01:00 (rev 13475)
+++ trunk/gdbserver_tests/watchpoints.c 2013-07-30 21:26:06 +01:00 (rev 13476)
@@ -63,5 +63,12 @@
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);
}
Modified: trunk/gdbserver_tests/mcwatchpoints.stdoutB.exp (+5 -0)
===================================================================
--- trunk/gdbserver_tests/mcwatchpoints.stdoutB.exp 2013-07-29 20:02:43 +01:00 (rev 13475)
+++ trunk/gdbserver_tests/mcwatchpoints.stdoutB.exp 2013-07-30 21:26:06 +01:00 (rev 13476)
@@ -31,5 +31,10 @@
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.
|