[gnu.gcc.bug] Symmetry GCC 1.35 register numbering

fubar@UUNET.UU.NET (10/11/89)

	GDB fails to find register variables in GCC-compiled programs
on the Symmetry, since GCC uses a different register numbering scheme.
The following addition to config/tm-seq386.h will make GCC use the
same numbering scheme as Dynix cc, and fixes the problem in all cases
except one.  The case that still fails is a "register double" in the
%ecx/%ebx register pair; the other register pairs that GCC uses happen
to come one after the other in the register order (and thus pointers
into the register array in GDB happen to do the right thing), this
pair does not.

	-J

---
	-Jay Vosburgh, Sequent Computer Systems, Inc; uunet!sequent!fubar


*** config/tm-seq386.B	Sat Sep 16 19:24:01 1989
--- config/tm-seq386.h	Tue Oct 10 14:05:06 1989
***************
*** 23,28 ****
--- 23,44 ----
  
  #include "tm-bsd386.h"
  
+ /* The following makes gcc and Dynix cc use the same numbers,
+  * this saves complication in gdb.
+  */
+ 
+ #undef DBX_REGISTER_NUMBER
+ 
+ /* gcc order is ax, dx, cx, bx, si, di, bp, sp, st, st(1), st(2)...st(7)
+  * dbx order is ax, dx, cx, st(0), st(1), bx, si, di, st(2), st(3),
+  * 		st(4), st(5), st(6), st(7), sp, bp
+  *
+  * This macro assumes that st(2) ... st(7) comes after st(1)
+  */
+ #define DBX_REGISTER_NUMBER(n) \
+ ((n)==0?0 :(n)==1?1 :(n)==2?2 :(n)==3?5 :(n)==4?6 :(n)==5?7 :(n)==6?15 \
+  :(n)==7?14 :(n)==8?3 :(n)==9?4 :(n-2))
+ 
  /* By default, target has a 80387.  */
  
  #define TARGET_DEFAULT 1