Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Add ABI variant infrastructure to Alpha target
@ 2002-04-21 11:24 Jason R Thorpe
  2002-04-21 12:06 ` Andrew Cagney
  2002-04-21 17:19 ` David S. Miller
  0 siblings, 2 replies; 8+ messages in thread
From: Jason R Thorpe @ 2002-04-21 11:24 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Cloned from arm-tdep.c, committed per the mult-arch rule.

        * alpha-tdep.c (alpha_abi_handler): New structure to describe
        an Alpha ABI variant. 
        (alpha_abi_handler_list): Declare. 
        (alpha_gdbarch_register_os_abi): New function.
        (alpha_gdbarch_init): Give registered ABI variant handlers a
        chance to tweak the gdbarch once we have set up defaults.
        * alpha-tdep.h: Prototype alpha_gdbarch_register_os_abi.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

[-- Attachment #2: alpha-patch --]
[-- Type: text/plain, Size: 3662 bytes --]

Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.23
diff -u -r1.23 alpha-tdep.c
--- alpha-tdep.c	21 Apr 2002 17:54:49 -0000	1.23
+++ alpha-tdep.c	21 Apr 2002 18:16:42 -0000
@@ -1902,6 +1902,44 @@
   return ALPHA_ABI_UNKNOWN;
 }
 
+struct alpha_abi_handler
+{
+  struct alpha_abi_handler *next;
+  enum alpha_abi abi;
+  void (*init_abi)(struct gdbarch_info, struct gdbarch *);
+};
+
+struct alpha_abi_handler *alpha_abi_handler_list = NULL;
+
+void
+alpha_gdbarch_register_os_abi (enum alpha_abi abi,
+                               void (*init_abi)(struct gdbarch_info,
+						struct gdbarch *))
+{
+  struct alpha_abi_handler **handler_p;
+
+  for (handler_p = &alpha_abi_handler_list; *handler_p != NULL;
+       handler_p = &(*handler_p)->next)
+    {
+      if ((*handler_p)->abi == abi)
+	{
+	  internal_error
+	    (__FILE__, __LINE__,
+	     "alpha_gdbarch_register_os_abi: A handler for this ABI variant "
+	     "(%d) has already been registered", (int) abi);
+	  /* If user wants to continue, override previous definition.  */
+	  (*handler_p)->init_abi = init_abi;
+	  return;
+	}
+    }
+
+  (*handler_p)
+    = (struct alpha_abi_handler *) xmalloc (sizeof (struct alpha_abi_handler));
+  (*handler_p)->next = NULL;
+  (*handler_p)->abi = abi;
+  (*handler_p)->init_abi = init_abi;
+}
+
 /* Initialize the current architecture based on INFO.  If possible, re-use an
    architecture from ARCHES, which is a list of architectures already created
    during this debugging session.
@@ -1915,6 +1953,7 @@
   struct gdbarch_tdep *tdep;
   struct gdbarch *gdbarch;
   enum alpha_abi alpha_abi = ALPHA_ABI_UNKNOWN;
+  struct alpha_abi_handler *abi_handler;
 
   /* Try to determine the ABI of the object we are loading.  */
 
@@ -2064,6 +2103,40 @@
 
   set_gdbarch_decr_pc_after_break (gdbarch, 4);
   set_gdbarch_frame_args_skip (gdbarch, 0);
+
+  /* Hook in ABI-specific overrides, if they have been registered.  */
+  if (alpha_abi == ALPHA_ABI_UNKNOWN)
+    {
+      /* Don't complain about not knowing the ABI variant if we don't
+	 have an inferior.  */
+      if (info.abfd)
+	fprintf_filtered
+	  (gdb_stderr, "GDB doesn't recognize the ABI of the inferior.  "
+	   "Attempting to continue with the default Alpha settings");
+    }
+  else
+    {
+      for (abi_handler = alpha_abi_handler_list; abi_handler != NULL;
+	   abi_handler = abi_handler->next)
+	if (abi_handler->abi == alpha_abi)
+	  break;
+
+      if (abi_handler)
+	abi_handler->init_abi (info, gdbarch);
+      else
+	{
+	  /* We assume that if GDB_MULTI_ARCH is less than
+	     GDB_MULTI_ARCH_TM that an ABI variant can be supported by
+	     overriding definitions in this file.  */
+	  if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
+	    fprintf_filtered
+	      (gdb_stderr,
+	       "A handler for the ABI variant \"%s\" is not built into this "
+	       "configuration of GDB.  "
+	       "Attempting to continue with the default Alpha settings",
+	       alpha_abi_names[alpha_abi]);
+	}
+    }
 
   return gdbarch;
 }
Index: alpha-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.h,v
retrieving revision 1.2
diff -u -r1.2 alpha-tdep.h
--- alpha-tdep.h	21 Apr 2002 17:30:07 -0000	1.2
+++ alpha-tdep.h	21 Apr 2002 18:16:43 -0000
@@ -98,4 +98,8 @@
   CORE_ADDR vm_min_address;	/* used by heuristic_proc_start */
 };
 
+void alpha_gdbarch_register_os_abi (enum alpha_abi,
+                                    void (*init_abi)(struct gdbarch_info,
+						     struct gdbarch *));
+
 #endif /* ALPHA_TDEP_H */

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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 11:24 [PATCH] Add ABI variant infrastructure to Alpha target Jason R Thorpe
@ 2002-04-21 12:06 ` Andrew Cagney
  2002-04-21 17:19 ` David S. Miller
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2002-04-21 12:06 UTC (permalink / raw)
  To: thorpej; +Cc: gdb-patches

> Cloned from arm-tdep.c, committed per the mult-arch rule.
> 
>         * alpha-tdep.c (alpha_abi_handler): New structure to describe
>         an Alpha ABI variant. 
>         (alpha_abi_handler_list): Declare. 
>         (alpha_gdbarch_register_os_abi): New function.
>         (alpha_gdbarch_init): Give registered ABI variant handlers a
>         chance to tweak the gdbarch once we have set up defaults.
>         * alpha-tdep.h: Prototype alpha_gdbarch_register_os_abi.
> 

Hmm,

It might be time to think about pushing this upstream into gdbarch.[shc].

Want to create a bug report for the task?

Andrew


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 11:24 [PATCH] Add ABI variant infrastructure to Alpha target Jason R Thorpe
  2002-04-21 12:06 ` Andrew Cagney
@ 2002-04-21 17:19 ` David S. Miller
  2002-04-21 17:57   ` Jason R Thorpe
  2002-04-21 17:59   ` Andrew Cagney
  1 sibling, 2 replies; 8+ messages in thread
From: David S. Miller @ 2002-04-21 17:19 UTC (permalink / raw)
  To: thorpej; +Cc: gdb-patches

   From: Jason R Thorpe <thorpej@wasabisystems.com>
   Date: Sun, 21 Apr 2002 11:24:18 -0700

   Cloned from arm-tdep.c, committed per the mult-arch rule.
   
What is the multi-arch rule?  Do my sparc OS ABI changes fall under
it?


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 17:19 ` David S. Miller
@ 2002-04-21 17:57   ` Jason R Thorpe
  2002-04-21 17:59   ` Andrew Cagney
  1 sibling, 0 replies; 8+ messages in thread
From: Jason R Thorpe @ 2002-04-21 17:57 UTC (permalink / raw)
  To: David S. Miller; +Cc: gdb-patches

On Sun, Apr 21, 2002 at 05:10:29PM -0700, David S. Miller wrote:

 > What is the multi-arch rule?  Do my sparc OS ABI changes fall under
 > it?

From the various discussions on the mailing lists, I understand the
rule to be:

	Mechanical changes needed to multi-arch a target are
	considered obvious.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 17:19 ` David S. Miller
  2002-04-21 17:57   ` Jason R Thorpe
@ 2002-04-21 17:59   ` Andrew Cagney
  2002-04-21 18:02     ` David S. Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-04-21 17:59 UTC (permalink / raw)
  To: David S. Miller; +Cc: thorpej, gdb-patches

>  From: Jason R Thorpe <thorpej@wasabisystems.com>
> Date: Sun, 21 Apr 2002 11:24:18 -0700
> 
>    Cloned from arm-tdep.c, committed per the mult-arch rule.
>    
> What is the multi-arch rule?

It is the ``obvious fix rule'' interpreted liberally in the multi-arch 
context.  A multi-arch conversion is largely slog work, consisting of a 
sequence of mechanical (but separate) changes.
http://sources.redhat.com/gdb/papers/multi-arch/howto.html

> Do my sparc OS ABI changes fall under
> it?

I'd tend to suspect that the other SPARC developers are going to take 
the oportunity to review that proposal.

Andrew


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 17:59   ` Andrew Cagney
@ 2002-04-21 18:02     ` David S. Miller
  2002-04-21 19:49       ` Andrew Cagney
  0 siblings, 1 reply; 8+ messages in thread
From: David S. Miller @ 2002-04-21 18:02 UTC (permalink / raw)
  To: ac131313; +Cc: thorpej, gdb-patches

   From: Andrew Cagney <ac131313@cygnus.com>
   Date: Sun, 21 Apr 2002 20:59:16 -0400

   > Do my sparc OS ABI changes fall under
   > it?
   
   I'd tend to suspect that the other SPARC developers are going to take 
   the oportunity to review that proposal.
   
Oh crap, based upon Jason's explanation of the multi-arch rule I just
checked in the Sparc OS abi changes....

Do I need to revert them now?


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 18:02     ` David S. Miller
@ 2002-04-21 19:49       ` Andrew Cagney
  2002-04-21 20:51         ` David S. Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2002-04-21 19:49 UTC (permalink / raw)
  To: David S. Miller; +Cc: thorpej, gdb-patches

>  From: Andrew Cagney <ac131313@cygnus.com>
> Date: Sun, 21 Apr 2002 20:59:16 -0400
> 
>    > Do my sparc OS ABI changes fall under
>    > it?
>    
>    I'd tend to suspect that the other SPARC developers are going to take 
>    the oportunity to review that proposal.
>    
> Oh crap, based upon Jason's explanation of the multi-arch rule I just
> checked in the Sparc OS abi changes....

> Do I need to revert them now?

Yes.

Andrew


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

* Re: [PATCH] Add ABI variant infrastructure to Alpha target
  2002-04-21 19:49       ` Andrew Cagney
@ 2002-04-21 20:51         ` David S. Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David S. Miller @ 2002-04-21 20:51 UTC (permalink / raw)
  To: ac131313; +Cc: thorpej, gdb-patches

   From: Andrew Cagney <ac131313@cygnus.com>
   Date: Sun, 21 Apr 2002 22:49:36 -0400

   > Do I need to revert them now?
   
   Yes.
   
Sigh, done...


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

end of thread, other threads:[~2002-04-22  3:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-21 11:24 [PATCH] Add ABI variant infrastructure to Alpha target Jason R Thorpe
2002-04-21 12:06 ` Andrew Cagney
2002-04-21 17:19 ` David S. Miller
2002-04-21 17:57   ` Jason R Thorpe
2002-04-21 17:59   ` Andrew Cagney
2002-04-21 18:02     ` David S. Miller
2002-04-21 19:49       ` Andrew Cagney
2002-04-21 20:51         ` David S. Miller

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