]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
add a test + assert for GDB bug bypassed in r13472
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 30 Jul 2013 20:26:06 +0000 (20:26 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 30 Jul 2013 20:26:06 +0000 (20:26 +0000)
* 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

coregrind/m_gdbserver/remote-utils.c
gdbserver_tests/mcwatchpoints.stderr.exp
gdbserver_tests/mcwatchpoints.stdinB.gdb
gdbserver_tests/mcwatchpoints.stdoutB.exp
gdbserver_tests/watchpoints.c

index 3c208deccf72eca6dbb2ca887b0c97b0bfc44697..ef9af9e4f47fb7e9a7e2a439652ebb88e80d922d 100644 (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.  */
index d873f4f9d63f9608389b2393310127d7b37ffe11..840ce4c1b6ebb2b022316496dee5bd6deac8c0a7 100644 (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
 
index c2750980d1d9c1ad08ec056a6de13b862f183220..d2673cc5bf131f022f556b3679da57453bd2d664 100644 (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
index f725476d6a76810c988a1429f64a431cfd852322..27cd8cbd3e586c3aa883b1ed147ca5a11ecb53c7 100644 (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.
index ae05d8fce6f49be647dc178a180a706ddcff5e11..132dadba549e8e828d8d3199136dc39c0b7a2f14 100644 (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);
 }