]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Avoid having holes in the VgdbShared struct.
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 22 Feb 2012 19:47:27 +0000 (19:47 +0000)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Wed, 22 Feb 2012 19:47:27 +0000 (19:47 +0000)
These holes are not initialized,
and writing these uninitialised bytes to the mapped file
causes an error being reported when running Valgrind
inside Valgrind. Having no holes avoid having this error.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12397

coregrind/m_gdbserver/remote-utils.c
coregrind/pub_core_gdbserver.h

index 145fc2420c11363d830519461064f817a7c2e4b4..76bf4981c0a6f7801c274e95f1fb3c173871548a 100644 (file)
@@ -224,10 +224,11 @@ void remote_open (char *name)
    const HChar *user, *host;
    int save_fcntl_flags, len;
    VgdbShared vgdbinit = 
-      {0, 0, 0, (Addr) VG_(invoke_gdbserver),
+      {0, 0, (Addr) VG_(invoke_gdbserver),
        (Addr) VG_(threads), sizeof(ThreadState), 
        offsetof(ThreadState, status),
-       offsetof(ThreadState, os_state) + offsetof(ThreadOSstate, lwpid)};
+       offsetof(ThreadState, os_state) + offsetof(ThreadOSstate, lwpid),
+       0};
    const int pid = VG_(getpid)();
    const int name_default = strcmp(name, VG_(vgdb_prefix_default)()) == 0;
    Addr addr_shared;
index 481162c5c6fb95183bd672e212566b5ef68a21ec..aca532b7d65088251d76b011732a3d176989510b 100644 (file)
@@ -143,10 +143,6 @@ extern void VG_(gdbserver_status_output)(void);
 
 typedef 
    struct {
-      // PID of the vgdb that last connected to the Valgrind gdbserver.
-      // It will be set by vgdb after connecting.
-      int vgdb_pid;
-
       // nr of bytes vgdb has written to valgrind
       volatile int written_by_vgdb;
       // nr of bytes seen by valgrind
@@ -161,13 +157,15 @@ typedef
       int sizeof_ThreadState;
       int offset_status;
       int offset_lwpid;
+
+      // PID of the vgdb that last connected to the Valgrind gdbserver.
+      // It will be set by vgdb after connecting.
+      int vgdb_pid;
    } VgdbShared32;
 
 /* Same as VgdbShared32 but for 64 bits arch. */
 typedef 
    struct {
-      int vgdb_pid;
-
       volatile int written_by_vgdb;
       volatile int seen_by_valgrind;
       
@@ -177,6 +175,8 @@ typedef
       int sizeof_ThreadState;
       int offset_status;
       int offset_lwpid;
+
+      int vgdb_pid;
    } VgdbShared64;
 
 // The below typedef makes the life of valgrind easier.