aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/linux-low.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-04-17 21:21:38 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-04-17 21:21:38 +0000
commit52fa2412d2c92af1cc974335a7ec14e1bd0c4356 (patch)
tree451410ab95925f4382d0200046c0ccb24419a912 /gdb/gdbserver/linux-low.c
parent475bbd17e013a6aaa565d2d664572af56a1bd23d (diff)
downloadgdb-52fa2412d2c92af1cc974335a7ec14e1bd0c4356.zip
gdb-52fa2412d2c92af1cc974335a7ec14e1bd0c4356.tar.gz
gdb-52fa2412d2c92af1cc974335a7ec14e1bd0c4356.tar.bz2
2008-04-17 Daniel Jacobowitz <dan@codesourcery.com>
* linux-low.c (disabled_regsets, num_regsets): New. (use_regsets_p): Delete. (linux_wait_for_process): Clear disabled_regsets. (regsets_fetch_inferior_registers): Check and set it. (regsets_store_inferior_registers): Likewise. (linux_fetch_registers, linux_store_registers): Do not use use_regsets_p. (initialize_low): Allocate disabled_regsets.
Diffstat (limited to 'gdb/gdbserver/linux-low.c')
-rw-r--r--gdb/gdbserver/linux-low.c61
1 files changed, 24 insertions, 37 deletions
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index da638f5..b41e679 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -131,7 +131,8 @@ struct pending_signals
#define PTRACE_XFER_TYPE long
#ifdef HAVE_LINUX_REGSETS
-static int use_regsets_p = 1;
+static char *disabled_regsets;
+static int num_regsets;
#endif
#define pid_of(proc) ((proc)->head.id)
@@ -631,6 +632,9 @@ retry:
if (new_inferior)
{
the_low_target.arch_setup ();
+#ifdef HAVE_LINUX_REGSETS
+ memset (disabled_regsets, 0, num_regsets);
+#endif
new_inferior = 0;
}
@@ -1496,7 +1500,7 @@ regsets_fetch_inferior_registers ()
void *buf;
int res;
- if (regset->size == 0)
+ if (regset->size == 0 || disabled_regsets[regset - target_regsets])
{
regset ++;
continue;
@@ -1508,18 +1512,10 @@ regsets_fetch_inferior_registers ()
{
if (errno == EIO)
{
- /* If we get EIO on the first regset, do not try regsets again.
- If we get EIO on a later regset, disable that regset. */
- if (regset == target_regsets)
- {
- use_regsets_p = 0;
- return -1;
- }
- else
- {
- regset->size = 0;
- continue;
- }
+ /* If we get EIO on a regset, do not try it again for
+ this process. */
+ disabled_regsets[regset - target_regsets] = 1;
+ continue;
}
else
{
@@ -1553,7 +1549,7 @@ regsets_store_inferior_registers ()
void *buf;
int res;
- if (regset->size == 0)
+ if (regset->size == 0 || disabled_regsets[regset - target_regsets])
{
regset ++;
continue;
@@ -1579,18 +1575,10 @@ regsets_store_inferior_registers ()
{
if (errno == EIO)
{
- /* If we get EIO on the first regset, do not try regsets again.
- If we get EIO on a later regset, disable that regset. */
- if (regset == target_regsets)
- {
- use_regsets_p = 0;
- return -1;
- }
- else
- {
- regset->size = 0;
- continue;
- }
+ /* If we get EIO on a regset, do not try it again for
+ this process. */
+ disabled_regsets[regset - target_regsets] = 1;
+ continue;
}
else
{
@@ -1616,11 +1604,8 @@ void
linux_fetch_registers (int regno)
{
#ifdef HAVE_LINUX_REGSETS
- if (use_regsets_p)
- {
- if (regsets_fetch_inferior_registers () == 0)
- return;
- }
+ if (regsets_fetch_inferior_registers () == 0)
+ return;
#endif
#ifdef HAVE_LINUX_USRREGS
usr_fetch_inferior_registers (regno);
@@ -1631,11 +1616,8 @@ void
linux_store_registers (int regno)
{
#ifdef HAVE_LINUX_REGSETS
- if (use_regsets_p)
- {
- if (regsets_store_inferior_registers () == 0)
- return;
- }
+ if (regsets_store_inferior_registers () == 0)
+ return;
#endif
#ifdef HAVE_LINUX_USRREGS
usr_store_inferior_registers (regno);
@@ -2084,4 +2066,9 @@ initialize_low (void)
the_low_target.breakpoint_len);
linux_init_signals ();
linux_test_for_tracefork ();
+#ifdef HAVE_LINUX_REGSETS
+ for (num_regsets = 0; target_regsets[num_regsets].size >= 0; num_regsets++)
+ ;
+ disabled_regsets = malloc (num_regsets);
+#endif
}