Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [3/3] Remove deprecated_register_gdbarch_swap infrastructure
@ 2007-06-08 23:23 Ulrich Weigand
  2007-06-12 15:35 ` Daniel Jacobowitz
  2007-06-22 12:54 ` Ulrich Weigand
  0 siblings, 2 replies; 6+ messages in thread
From: Ulrich Weigand @ 2007-06-08 23:23 UTC (permalink / raw)
  To: gdb-patches

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 = &current_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 = &current_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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [3/3] Remove deprecated_register_gdbarch_swap infrastructure
  2007-06-08 23:23 [3/3] Remove deprecated_register_gdbarch_swap infrastructure Ulrich Weigand
@ 2007-06-12 15:35 ` Daniel Jacobowitz
  2007-06-22 12:54 ` Ulrich Weigand
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-06-12 15:35 UTC (permalink / raw)
  To: gdb-patches

On Sat, Jun 09, 2007 at 01:23:32AM +0200, Ulrich Weigand wrote:
> Hello,
> 
> after all the preceeding patches have been applied, there is no further user
> of deprecated_register_gdbarch_swap.  This patch finally removes it!

Yay!  This and 2/3 look fine to me.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [3/3] Remove deprecated_register_gdbarch_swap infrastructure
  2007-06-08 23:23 [3/3] Remove deprecated_register_gdbarch_swap infrastructure Ulrich Weigand
  2007-06-12 15:35 ` Daniel Jacobowitz
@ 2007-06-22 12:54 ` Ulrich Weigand
  2007-06-26 18:30   ` Brian Dessent
  1 sibling, 1 reply; 6+ messages in thread
From: Ulrich Weigand @ 2007-06-22 12:54 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches


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

I've now committed the following version of this patch.

Bye,
Ulrich


	* 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.
	* gdbarch.h, gdbarch.c: Regenerate.


diff -urNp gdb-orig/gdb/gdbarch.c gdb-head/gdb/gdbarch.c
--- gdb-orig/gdb/gdbarch.c	2007-06-09 17:20:05.060973165 +0200
+++ gdb-head/gdb/gdbarch.c	2007-06-09 17:26:15.847882154 +0200
@@ -3468,107 +3468,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 = &current_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
@@ -3812,13 +3711,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);
 
@@ -3828,26 +3720,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)
@@ -3855,8 +3749,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-09 17:20:05.105966692 +0200
+++ gdb-head/gdb/gdbarch.h	2007-06-09 17:26:15.902007403 +0200
@@ -1253,25 +1253,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-09 17:20:05.114965398 +0200
+++ gdb-head/gdb/gdbarch.sh	2007-06-09 17:26:15.949000642 +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 = &current_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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [3/3] Remove deprecated_register_gdbarch_swap infrastructure
  2007-06-22 12:54 ` Ulrich Weigand
@ 2007-06-26 18:30   ` Brian Dessent
  2007-06-27  1:10     ` Ulrich Weigand
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Dessent @ 2007-06-26 18:30 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches, insight

Ulrich Weigand wrote:

> I've now committed the following version of this patch.
> 
> Bye,
> Ulrich
> 
>         * 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.
>         * gdbarch.h, gdbarch.c: Regenerate.

Insight is still a user of deprecated_register_gdbarch_swap, so now it's
broken.  What's the proper replacement for the following -

int
Gdbtk_Register_Init (Tcl_Interp *interp)
{
  Tcl_CreateObjCommand (interp, "gdb_reginfo", gdbtk_call_wrapper,
                        gdb_register_info, NULL);

  /* Register/initialize any architecture specific data */
  setup_architecture_data ();

  deprecated_register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
  deprecated_register_gdbarch_swap (&regformat, sizeof (regformat),
NULL);
  deprecated_register_gdbarch_swap (&regtype, sizeof (regtype), NULL);
  deprecated_register_gdbarch_swap (NULL, 0, setup_architecture_data);

  return TCL_OK;
}

Brian


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [3/3] Remove deprecated_register_gdbarch_swap infrastructure
  2007-06-26 18:30   ` Brian Dessent
@ 2007-06-27  1:10     ` Ulrich Weigand
  2007-06-27  6:52       ` Brian Dessent
  0 siblings, 1 reply; 6+ messages in thread
From: Ulrich Weigand @ 2007-06-27  1:10 UTC (permalink / raw)
  To: insight; +Cc: gdb-patches

Brian Dessent wrote:

> Insight is still a user of deprecated_register_gdbarch_swap, so now it's
> broken.  What's the proper replacement for the following -
> 
> int
> Gdbtk_Register_Init (Tcl_Interp *interp)
> {
>   Tcl_CreateObjCommand (interp, "gdb_reginfo", gdbtk_call_wrapper,
>                         gdb_register_info, NULL);
> 
>   /* Register/initialize any architecture specific data */
>   setup_architecture_data ();
> 
>   deprecated_register_gdbarch_swap (&old_regs, sizeof (old_regs), NULL);
>   deprecated_register_gdbarch_swap (&regformat, sizeof (regformat),
> NULL);
>   deprecated_register_gdbarch_swap (&regtype, sizeof (regtype), NULL);
>   deprecated_register_gdbarch_swap (NULL, 0, setup_architecture_data);
> 
>   return TCL_OK;
> }

There's no direct replacement.  You'd have to eliminate those global
variables (old_regs, regformat, regtype), and replace them by something
that explicitly takes the architecture into account.

I've actually never looked at Insight before.  Where's that code
located?

Bye,


-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [3/3] Remove deprecated_register_gdbarch_swap infrastructure
  2007-06-27  1:10     ` Ulrich Weigand
@ 2007-06-27  6:52       ` Brian Dessent
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Dessent @ 2007-06-27  6:52 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: insight, gdb-patches

Ulrich Weigand wrote:

> I've actually never looked at Insight before.  Where's that code
> located?

It's in the same repository as gdb, except using the module name
'insight' instead of 'gdb'.

From looking at the modules file it looks like you could get an insight
checkout by starting with a gdb checkout and then adding the gdb/gdbtk
and gdb/testsuite/gdb.gdbtk directories, plus the tcl/tk stuff:

naked-gdb-guifull -a src/gdb
naked-gdb       -a !src/gdb/gdbtk !src/gdb/testsuite/gdb.gdbtk src/gdb
gdb-support     -a naked-texinfo naked-bfd naked-opcodes \
                naked-readline naked-libiberty naked-include \
                naked-sim naked-cpu src/djunpack.bat naked-intl \
                src-support
# Module reflecting active development.
gdb             -a naked-gdb gdb-support
gdb+dejagnu     -a gdb naked-dejagnu naked-expect naked-tcl
gdb+binutils    -a gdb naked-binutils naked-gas naked-gprof naked-ld
binutils+gdb    -a gdb+binutils
gdb+dejagnu+binutils -a gdb+dejagnu naked-binutils naked-gas naked-gprof
naked-ld
gdb+binutils+dejagnu -a gdb+dejagnu+binutils
binutils+gdb+dejagnu -a gdb+dejagnu+binutils

insight         -a naked-gdb-guifull gdb-support \
                naked-tcl naked-tk naked-itcl naked-tix naked-libgui
insight+dejagnu -a insight naked-dejagnu naked-expect

Brian


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-06-27  1:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08 23:23 [3/3] Remove deprecated_register_gdbarch_swap infrastructure Ulrich Weigand
2007-06-12 15:35 ` Daniel Jacobowitz
2007-06-22 12:54 ` Ulrich Weigand
2007-06-26 18:30   ` Brian Dessent
2007-06-27  1:10     ` Ulrich Weigand
2007-06-27  6:52       ` Brian Dessent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox