From 52fa2412d2c92af1cc974335a7ec14e1bd0c4356 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 17 Apr 2008 21:21:38 +0000 Subject: [PATCH] 2008-04-17 Daniel Jacobowitz * 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. --- gdb/gdbserver/ChangeLog | 11 +++++++ gdb/gdbserver/linux-low.c | 61 +++++++++++++++------------------------ 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index c3aaeb521de..c6025e38d1a 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,14 @@ +2008-04-17 Daniel Jacobowitz + + * 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. + 2008-04-14 Daniel Jacobowitz * Makefile.in (LIBOBJS): New. diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index da638f56751..b41e679c626 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 } -- 2.30.2