|
From: <sv...@va...> - 2012-02-22 19:52:01
|
Author: philippe
Date: 2012-02-22 19:47:27 +0000 (Wed, 22 Feb 2012)
New Revision: 12397
Log:
Avoid having holes in the VgdbShared struct.
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.
Modified:
trunk/coregrind/m_gdbserver/remote-utils.c
trunk/coregrind/pub_core_gdbserver.h
Modified: trunk/coregrind/m_gdbserver/remote-utils.c
===================================================================
--- trunk/coregrind/m_gdbserver/remote-utils.c 2012-02-21 15:53:35 UTC (rev 12396)
+++ trunk/coregrind/m_gdbserver/remote-utils.c 2012-02-22 19:47:27 UTC (rev 12397)
@@ -224,10 +224,11 @@
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;
Modified: trunk/coregrind/pub_core_gdbserver.h
===================================================================
--- trunk/coregrind/pub_core_gdbserver.h 2012-02-21 15:53:35 UTC (rev 12396)
+++ trunk/coregrind/pub_core_gdbserver.h 2012-02-22 19:47:27 UTC (rev 12397)
@@ -143,10 +143,6 @@
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 @@
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 @@
int sizeof_ThreadState;
int offset_status;
int offset_lwpid;
+
+ int vgdb_pid;
} VgdbShared64;
// The below typedef makes the life of valgrind easier.
|