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.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12397
This commit is contained in:
Philippe Waroquiers 2012-02-22 19:47:27 +00:00
parent e9f922b442
commit 564e685793
2 changed files with 9 additions and 8 deletions

View 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;

View 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.