From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21882 invoked by alias); 8 Jun 2007 23:23:41 -0000 Received: (qmail 21871 invoked by uid 22791); 8 Jun 2007 23:23:39 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate1.de.ibm.com (HELO mtagate1.de.ibm.com) (195.212.29.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Jun 2007 23:23:36 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate1.de.ibm.com (8.13.8/8.13.8) with ESMTP id l58NNXQb164764 for ; Fri, 8 Jun 2007 23:23:33 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l58NNXee4137068 for ; Sat, 9 Jun 2007 01:23:33 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l58NNWmM019717 for ; Sat, 9 Jun 2007 01:23:32 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l58NNWf5019714 for ; Sat, 9 Jun 2007 01:23:32 +0200 Message-Id: <200706082323.l58NNWf5019714@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sat, 9 Jun 2007 01:23:32 +0200 Subject: [3/3] Remove deprecated_register_gdbarch_swap infrastructure To: gdb-patches@sourceware.org Date: Fri, 08 Jun 2007 23:23:00 -0000 From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00127.txt.bz2 Hello, after all the preceeding patches have been applied, there is no further user of deprecated_register_gdbarch_swap. This patch finally removes it! Bye, Ulrich ChangeLog: * gdbarch.sh (gdbarch_swap_ftype, deprecated_register_gdbarch_swap, DEPRECATED_REGISTER_GDBARCH_SWAP): Remove. (struct gdbarch_swap, struct gdbarch_swap_registration, struct gdbarch_swap_registry, gdbarch_swap_registry, current_gdbarch_swap_init_hack, current_gdbarch_swap_out_hack, current_gdbarch_swap_in_hack): Remove. (find_arch_by_info): Do not call current_gdbarch_swap_init_hack. (gdbarch_find_by_info): Do not call current_gdbarch_swap_in_hack and current_gdbarch_swap_out_hack, update current_gdbarch directly. (deprecated_current_gdbarch_select_hack): Likewise. diff -urNp gdb-orig/gdb/gdbarch.c gdb-head/gdb/gdbarch.c --- gdb-orig/gdb/gdbarch.c 2007-06-08 13:48:40.084649000 +0200 +++ gdb-head/gdb/gdbarch.c 2007-06-08 21:00:27.317789781 +0200 @@ -3544,107 +3544,6 @@ gdbarch_data (struct gdbarch *gdbarch, s } - -/* Keep a registry of swapped data required by GDB modules. */ - -struct gdbarch_swap -{ - void *swap; - struct gdbarch_swap_registration *source; - struct gdbarch_swap *next; -}; - -struct gdbarch_swap_registration -{ - void *data; - unsigned long sizeof_data; - gdbarch_swap_ftype *init; - struct gdbarch_swap_registration *next; -}; - -struct gdbarch_swap_registry -{ - int nr; - struct gdbarch_swap_registration *registrations; -}; - -struct gdbarch_swap_registry gdbarch_swap_registry = -{ - 0, NULL, -}; - -void -deprecated_register_gdbarch_swap (void *data, - unsigned long sizeof_data, - gdbarch_swap_ftype *init) -{ - struct gdbarch_swap_registration **rego; - for (rego = &gdbarch_swap_registry.registrations; - (*rego) != NULL; - rego = &(*rego)->next); - (*rego) = XMALLOC (struct gdbarch_swap_registration); - (*rego)->next = NULL; - (*rego)->init = init; - (*rego)->data = data; - (*rego)->sizeof_data = sizeof_data; -} - -static void -current_gdbarch_swap_init_hack (void) -{ - struct gdbarch_swap_registration *rego; - struct gdbarch_swap **curr = ¤t_gdbarch->swap; - for (rego = gdbarch_swap_registry.registrations; - rego != NULL; - rego = rego->next) - { - if (rego->data != NULL) - { - (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, - struct gdbarch_swap); - (*curr)->source = rego; - (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, - rego->sizeof_data); - (*curr)->next = NULL; - curr = &(*curr)->next; - } - if (rego->init != NULL) - rego->init (); - } -} - -static struct gdbarch * -current_gdbarch_swap_out_hack (void) -{ - struct gdbarch *old_gdbarch = current_gdbarch; - struct gdbarch_swap *curr; - - gdb_assert (old_gdbarch != NULL); - for (curr = old_gdbarch->swap; - curr != NULL; - curr = curr->next) - { - memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); - memset (curr->source->data, 0, curr->source->sizeof_data); - } - current_gdbarch = NULL; - return old_gdbarch; -} - -static void -current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) -{ - struct gdbarch_swap *curr; - - gdb_assert (current_gdbarch == NULL); - for (curr = new_gdbarch->swap; - curr != NULL; - curr = curr->next) - memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); - current_gdbarch = new_gdbarch; -} - - /* Keep a registry of the architectures known by GDB. */ struct gdbarch_registration @@ -3888,13 +3787,6 @@ find_arch_by_info (struct gdbarch_info i verify_gdbarch (new_gdbarch); new_gdbarch->initialized_p = 1; - /* Initialize any per-architecture swap areas. This phase requires - a valid global CURRENT_GDBARCH. Set it momentarially, and then - swap the entire architecture out. */ - current_gdbarch = new_gdbarch; - current_gdbarch_swap_init_hack (); - current_gdbarch_swap_out_hack (); - if (gdbarch_debug) gdbarch_dump (new_gdbarch, gdb_stdlog); @@ -3904,26 +3796,28 @@ find_arch_by_info (struct gdbarch_info i struct gdbarch * gdbarch_find_by_info (struct gdbarch_info info) { + struct gdbarch *new_gdbarch; + /* Save the previously selected architecture, setting the global to NULL. This stops things like gdbarch->init() trying to use the previous architecture's configuration. The previous architecture may not even be of the same architecture family. The most recent architecture of the same family is found at the head of the rego->arches list. */ - struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + struct gdbarch *old_gdbarch = current_gdbarch; + current_gdbarch = NULL; /* Find the specified architecture. */ - struct gdbarch *new_gdbarch = find_arch_by_info (info); + new_gdbarch = find_arch_by_info (info); /* Restore the existing architecture. */ gdb_assert (current_gdbarch == NULL); - current_gdbarch_swap_in_hack (old_gdbarch); + current_gdbarch = old_gdbarch; return new_gdbarch; } -/* Make the specified architecture current, swapping the existing one - out. */ +/* Make the specified architecture current. */ void deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) @@ -3931,8 +3825,7 @@ deprecated_current_gdbarch_select_hack ( gdb_assert (new_gdbarch != NULL); gdb_assert (current_gdbarch != NULL); gdb_assert (new_gdbarch->initialized_p); - current_gdbarch_swap_out_hack (); - current_gdbarch_swap_in_hack (new_gdbarch); + current_gdbarch = new_gdbarch; architecture_changed_event (); reinit_frame_cache (); } diff -urNp gdb-orig/gdb/gdbarch.h gdb-head/gdb/gdbarch.h --- gdb-orig/gdb/gdbarch.h 2007-06-08 13:48:40.136641000 +0200 +++ gdb-head/gdb/gdbarch.h 2007-06-08 20:53:04.215440201 +0200 @@ -1345,25 +1345,6 @@ extern void deprecated_set_gdbarch_data extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); - -/* Register per-architecture memory region. - - Provide a memory-region swap mechanism. Per-architecture memory - region are created. These memory regions are swapped whenever the - architecture is changed. For a new architecture, the memory region - is initialized with zero (0) and the INIT function is called. - - Memory regions are swapped / initialized in the order that they are - registered. NULL DATA and/or INIT values can be specified. - - New code should use gdbarch_data_register_*(). */ - -typedef void (gdbarch_swap_ftype) (void); -extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init); -#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL) - - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff -urNp gdb-orig/gdb/gdbarch.sh gdb-head/gdb/gdbarch.sh --- gdb-orig/gdb/gdbarch.sh 2007-06-08 13:48:40.187634000 +0200 +++ gdb-head/gdb/gdbarch.sh 2007-06-08 20:59:46.301579149 +0200 @@ -1125,25 +1125,6 @@ extern void deprecated_set_gdbarch_data extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *); - -/* Register per-architecture memory region. - - Provide a memory-region swap mechanism. Per-architecture memory - region are created. These memory regions are swapped whenever the - architecture is changed. For a new architecture, the memory region - is initialized with zero (0) and the INIT function is called. - - Memory regions are swapped / initialized in the order that they are - registered. NULL DATA and/or INIT values can be specified. - - New code should use gdbarch_data_register_*(). */ - -typedef void (gdbarch_swap_ftype) (void); -extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init); -#define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL) - - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ @@ -1850,107 +1831,6 @@ gdbarch_data (struct gdbarch *gdbarch, s } - -/* Keep a registry of swapped data required by GDB modules. */ - -struct gdbarch_swap -{ - void *swap; - struct gdbarch_swap_registration *source; - struct gdbarch_swap *next; -}; - -struct gdbarch_swap_registration -{ - void *data; - unsigned long sizeof_data; - gdbarch_swap_ftype *init; - struct gdbarch_swap_registration *next; -}; - -struct gdbarch_swap_registry -{ - int nr; - struct gdbarch_swap_registration *registrations; -}; - -struct gdbarch_swap_registry gdbarch_swap_registry = -{ - 0, NULL, -}; - -void -deprecated_register_gdbarch_swap (void *data, - unsigned long sizeof_data, - gdbarch_swap_ftype *init) -{ - struct gdbarch_swap_registration **rego; - for (rego = &gdbarch_swap_registry.registrations; - (*rego) != NULL; - rego = &(*rego)->next); - (*rego) = XMALLOC (struct gdbarch_swap_registration); - (*rego)->next = NULL; - (*rego)->init = init; - (*rego)->data = data; - (*rego)->sizeof_data = sizeof_data; -} - -static void -current_gdbarch_swap_init_hack (void) -{ - struct gdbarch_swap_registration *rego; - struct gdbarch_swap **curr = ¤t_gdbarch->swap; - for (rego = gdbarch_swap_registry.registrations; - rego != NULL; - rego = rego->next) - { - if (rego->data != NULL) - { - (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch, - struct gdbarch_swap); - (*curr)->source = rego; - (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch, - rego->sizeof_data); - (*curr)->next = NULL; - curr = &(*curr)->next; - } - if (rego->init != NULL) - rego->init (); - } -} - -static struct gdbarch * -current_gdbarch_swap_out_hack (void) -{ - struct gdbarch *old_gdbarch = current_gdbarch; - struct gdbarch_swap *curr; - - gdb_assert (old_gdbarch != NULL); - for (curr = old_gdbarch->swap; - curr != NULL; - curr = curr->next) - { - memcpy (curr->swap, curr->source->data, curr->source->sizeof_data); - memset (curr->source->data, 0, curr->source->sizeof_data); - } - current_gdbarch = NULL; - return old_gdbarch; -} - -static void -current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch) -{ - struct gdbarch_swap *curr; - - gdb_assert (current_gdbarch == NULL); - for (curr = new_gdbarch->swap; - curr != NULL; - curr = curr->next) - memcpy (curr->source->data, curr->swap, curr->source->sizeof_data); - current_gdbarch = new_gdbarch; -} - - /* Keep a registry of the architectures known by GDB. */ struct gdbarch_registration @@ -2194,13 +2074,6 @@ find_arch_by_info (struct gdbarch_info i verify_gdbarch (new_gdbarch); new_gdbarch->initialized_p = 1; - /* Initialize any per-architecture swap areas. This phase requires - a valid global CURRENT_GDBARCH. Set it momentarially, and then - swap the entire architecture out. */ - current_gdbarch = new_gdbarch; - current_gdbarch_swap_init_hack (); - current_gdbarch_swap_out_hack (); - if (gdbarch_debug) gdbarch_dump (new_gdbarch, gdb_stdlog); @@ -2210,26 +2083,28 @@ find_arch_by_info (struct gdbarch_info i struct gdbarch * gdbarch_find_by_info (struct gdbarch_info info) { + struct gdbarch *new_gdbarch; + /* Save the previously selected architecture, setting the global to NULL. This stops things like gdbarch->init() trying to use the previous architecture's configuration. The previous architecture may not even be of the same architecture family. The most recent architecture of the same family is found at the head of the rego->arches list. */ - struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack (); + struct gdbarch *old_gdbarch = current_gdbarch; + current_gdbarch = NULL; /* Find the specified architecture. */ - struct gdbarch *new_gdbarch = find_arch_by_info (info); + new_gdbarch = find_arch_by_info (info); /* Restore the existing architecture. */ gdb_assert (current_gdbarch == NULL); - current_gdbarch_swap_in_hack (old_gdbarch); + current_gdbarch = old_gdbarch; return new_gdbarch; } -/* Make the specified architecture current, swapping the existing one - out. */ +/* Make the specified architecture current. */ void deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) @@ -2237,8 +2112,7 @@ deprecated_current_gdbarch_select_hack ( gdb_assert (new_gdbarch != NULL); gdb_assert (current_gdbarch != NULL); gdb_assert (new_gdbarch->initialized_p); - current_gdbarch_swap_out_hack (); - current_gdbarch_swap_in_hack (new_gdbarch); + current_gdbarch = new_gdbarch; architecture_changed_event (); reinit_frame_cache (); } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com