forked from Imagelibrary/binutils-gdb
gdbserver: Prevent stale/random values in register cache
When fetch_inferior_registers does not update all registers, this patch assures that no stale register values remain in the register cache. On Linux platforms using the regsets interface, when one of the ptrace calls used for fetching the register values returns an error, this patch also avoids copying the random data returned from ptrace into the register cache. All unfetched registers are marked "unavailable" instead. gdb/gdbserver/ChangeLog: * linux-low.c (regsets_fetch_inferior_registers): Do not invoke the regset's store function when ptrace returned an error. * regcache.c (get_thread_regcache): Invalidate register cache before fetching inferior's registers.
This commit is contained in:
committed by
Andreas Krebbel
parent
28eef6727d
commit
098dbe6124
@@ -52,6 +52,9 @@ get_thread_regcache (struct thread_info *thread, int fetch)
|
||||
struct thread_info *saved_thread = current_thread;
|
||||
|
||||
current_thread = thread;
|
||||
/* Invalidate all registers, to prevent stale left-overs. */
|
||||
memset (regcache->register_status, REG_UNAVAILABLE,
|
||||
regcache->tdesc->num_registers);
|
||||
fetch_inferior_registers (regcache, -1);
|
||||
current_thread = saved_thread;
|
||||
regcache->registers_valid = 1;
|
||||
|
||||
Reference in New Issue
Block a user