From: soenen@lectra.FR (Jean Michel Soenen)
Subject: gdb-4.6 on a new machine
Reply-To: soenen@lectra.fr
Organization: Lectra Systemes ZI Marticot 33610 Cestas, France
              tel (33) 56688000 fax (33) 56788831.
Distribution: gnu
Date: Wed, 30 Sep 1992 10:10:14 GMT

	hi,

We (Lectra-Systemes) are Unix computer makers near Bordeaux (France).
	
	I have ported gdb-4.6 on our computers.

	The characteristics of the Microlec 2030/2032 (it's the name of the 
Lectra computer) are :

		- CPU Motorola 68030   33 Mhz
		- Lectra Unix System V 3.2 (derived from Unisoft 3.2)

Please, if it' s cleanly written, include my changes in the future GDB 
releases.

		thanks,

					jean-michel


 ._______________________________.____________________________. 
+-------------------------------'----------------------------'|
| Jean-Michel SOENEN            | tel   : +33 56 68 80 00    ||
| Lectra Systemes               | fax   : +33 56 78 88 31    ||
| ZI Marticot 33610 CESTAS      |                            ||          
| FRANCE                        | E-mail: soenen@lectra.fr   ||	
`-------------------------------+----------------------------+|  
                                |"Toute connaissance est une ||
                                | re'ponse a` une question." ||
                                |    			     ||          
                                |    Gaston Bachelard 	     ||	
                                `----------------------------'

------------------cut here------cut here ---------------------------

diff -rNc gdb-4.6.orig/bfd/Makefile.in gdb-4.6/bfd/Makefile.in
*** gdb-4.6.orig/bfd/Makefile.in	Mon Sep 28 13:46:07 1992
--- gdb-4.6/bfd/Makefile.in
***************
*** 66,72 ****
  
  # Change this (to MINIMIZE=1) to save space in executables.
  # Currently, all this does is control the target_vector in targets.c.
! MINIMIZE=0
  
  TARGETLIB = libbfd.a
  
--- 66,72 ----
  
  # Change this (to MINIMIZE=1) to save space in executables.
  # Currently, all this does is control the target_vector in targets.c.
! MINIMIZE=1
  
  TARGETLIB = libbfd.a
  
***************
*** 80,86 ****
  BFD_BACKENDS = oasys.o ieee.o srec.o elf.o stab-syms.o\
  	aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o \
  	coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
! 	coff-mips.o coff-rs6000.o coff-h8300.o coff-msym.o hppa.o i386linux.o
  
  OPTIONAL_BACKENDS = trad-core.o
  
--- 80,87 ----
  BFD_BACKENDS = oasys.o ieee.o srec.o elf.o stab-syms.o\
  	aout64.o aout32.o demo64.o sunos.o newsos3.o i386aout.o bout.o \
  	coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
! 	coff-mips.o coff-rs6000.o coff-h8300.o coff-msym.o hppa.o \
! 	i386linux.o coff-lectra.o
  
  OPTIONAL_BACKENDS = trad-core.o
  
***************
*** 94,100 ****
  
  # C source files that correspond to .o's.
  CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
! 	 coff-i386.c aout64.c aout32.c sunos.c demo64.c coff-i960.c srec.c tekhex.c \
  	 oasys.c ieee.c coff-m68k.c coff-a29k.c coff-rs6000.c coff-msym.c \
  	 format.c section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
  	 seclet.c coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c \
--- 95,102 ----
  
  # C source files that correspond to .o's.
  CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c archures.c \
! 	 coff-i386.c aout64.c aout32.c sunos.c demo64.c coff-i960.c \
! 	 srec.c tekhex.c coff-lectra.c \
  	 oasys.c ieee.c coff-m68k.c coff-a29k.c coff-rs6000.c coff-msym.c \
  	 format.c section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
  	 seclet.c coff-m88k.c coff-mips.c trad-core.c newsos3.c i386aout.c \
***************
*** 319,324 ****
--- 321,328 ----
    $(INCDIR)/coff/i960.h $(INCDIR)/coff/internal.h libcoff.h coffcode.h 
  coff-m68k.o: coff-m68k.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
    $(INCDIR)/coff/m68k.h $(INCDIR)/coff/internal.h libcoff.h coffcode.h 
+ coff-lectra.o: coff-lectra.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
+   $(INCDIR)/coff/lectra.h $(INCDIR)/coff/internal.h libcoff.h coffcode.h 
  coff-m88k.o: coff-m88k.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
    $(INCDIR)/coff/m88k.h $(INCDIR)/coff/internal.h libcoff.h coffcode.h 
  coff-mips.o: coff-mips.c $(INCDIR)/bfd.h $(INCDIR)/obstack.h libbfd.h \
diff -rNc gdb-4.6.orig/bfd/coff-lectra.c gdb-4.6/bfd/coff-lectra.c
*** gdb-4.6.orig/bfd/coff-lectra.c
--- gdb-4.6/bfd/coff-lectra.c
***************
*** 0 ****
--- 1,83 ----
+ /* Motorola lectra 68000 COFF back-end for BFD.
+    Copyright (C) 1990-1991 Free Software Foundation, Inc.
+    Written by Cygnus Support.
+ 
+ This file is part of BFD, the Binary File Descriptor library.
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ /* $Id: coff-lectra.c,v 1.17 1992/05/02 01:41:26 sac Exp $ */
+ 
+ #include "bfd.h"
+ #include "sysdep.h"
+ #include "libbfd.h"
+ #include "obstack.h"
+ #include "coff/lectra.h"
+ #include "coff/internal.h"
+ #include "libcoff.h"
+ 
+  reloc_howto_type lectracoff_howto_table[] = 
+ {
+   HOWTO(R_RELBYTE,	       0,  0,  	8,  false, 0, true,  true,0,"8",	true, 0x000000ff,0x000000ff, false),
+   HOWTO(R_RELWORD,	       0,  1, 	16, false, 0, true,  true,0,"16",	true, 0x0000ffff,0x0000ffff, false),
+   HOWTO(R_RELLONG,	       0,  2, 	32, false, 0, true,  true,0,"32",	true, 0xffffffff,0xffffffff, false),
+   HOWTO(R_PCRBYTE,	       0,  0, 	8,  true,  0, false, true,0,"DISP8",    true, 0x000000ff,0x000000ff, false),
+   HOWTO(R_PCRWORD,	       0,  1, 	16, true,  0, false, true,0,"DISP16",   true, 0x0000ffff,0x0000ffff, false),
+   HOWTO(R_PCRLONG,	       0,  2, 	32, true,  0, false, true,0,"DISP32",   true, 0xffffffff,0xffffffff, false),
+ };
+ 
+ 
+ /* Turn a howto into a reloc number */
+ 
+ #define BADMAG(x) LECTRABADMAG(x)
+ #define LECTRA 1		/* Customize coffcode.h */
+ 
+ #define RTYPE2HOWTO(internal, relocentry) \
+     (internal)->howto = ( lectracoff_howto_table + (relocentry)->r_type - R_RELBYTE);
+ 
+ 
+ #include "coffcode.h"
+ 
+ bfd_target lectracoff_vec =
+ {
+   "coff-lectra",		/* name */
+   bfd_target_coff_flavour,
+   true,				/* data byte order is big */
+   true,				/* header byte order is big */
+ 
+   (HAS_RELOC | EXEC_P |		/* object flags */
+    HAS_LINENO | HAS_DEBUG |
+    HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
+ 
+   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+   '/',				/* ar_pad_char */
+   15,				/* ar_max_namelen */
+   3,				/* minimum section alignment */
+ _do_getb64, _do_putb64,  _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
+ _do_getb64, _do_putb64,  _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
+ 
+   {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
+      bfd_generic_archive_p, _bfd_dummy_target},
+   {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
+      bfd_false},
+   {bfd_false, coff_write_object_contents,	/* bfd_write_contents */
+      _bfd_write_archive_contents, bfd_false},
+ 
+   JUMP_TABLE(coff),
+   COFF_SWAP_TABLE
+ };
diff -rNc gdb-4.6.orig/bfd/coffcode.h gdb-4.6/bfd/coffcode.h
*** gdb-4.6.orig/bfd/coffcode.h	Mon Sep 28 13:46:09 1992
--- gdb-4.6/bfd/coffcode.h
***************
*** 850,856 ****
    scnhdr_int->s_relptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_relptr);
    scnhdr_int->s_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
    scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
! #if defined(M88)
    scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
    scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
  #else
--- 850,856 ----
    scnhdr_int->s_relptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_relptr);
    scnhdr_int->s_lnnoptr = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_lnnoptr);
    scnhdr_int->s_flags = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_flags);
! #if defined(M88) || defined(LECTRA) 
    scnhdr_int->s_nreloc = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nreloc);
    scnhdr_int->s_nlnno = bfd_h_get_32(abfd, (bfd_byte *) scnhdr_ext->s_nlnno);
  #else
***************
*** 1076,1081 ****
--- 1076,1090 ----
      machine = 68020;
      break;
  #endif
+ #ifdef LECTRAMAGIC
+   case LECTRAMAGIC:
+     arch = bfd_arch_m68k;
+     machine = 68030;
+     break;
+ #endif
+ 
+ 
+ 
  #ifdef MC88MAGIC
    case MC88MAGIC:
    case MC88DMAGIC:
***************
*** 2096,2101 ****
--- 2105,2111 ----
      return true;
  #endif
  
+ 
  #ifdef MC88MAGIC
      case bfd_arch_m88k:
        *magicp = MC88OMAGIC;
***************
*** 2600,2606 ****
    internal_a.magic = PAGEMAGICBCS;
  #endif				/* M88 */
  
! #if M68 || I386 || MIPS
  #define __A_MAGIC_SET__
    /* Never was anything here for the 68k */
  #endif				/* M88 */
--- 2610,2616 ----
    internal_a.magic = PAGEMAGICBCS;
  #endif				/* M88 */
  
! #if M68 || I386 || MIPS || LECTRA
  #define __A_MAGIC_SET__
    /* Never was anything here for the 68k */
  #endif				/* M88 */
diff -rNc gdb-4.6.orig/bfd/config/lectra.mh gdb-4.6/bfd/config/lectra.mh
*** gdb-4.6.orig/bfd/config/lectra.mh
--- gdb-4.6/bfd/config/lectra.mh
***************
*** 0 ****
--- 1,2 ----
+ HDEFINES=-DTRAD_CORE
+ HDEPFILES=trad-core.o
diff -rNc gdb-4.6.orig/bfd/configure.in gdb-4.6/bfd/configure.in
*** gdb-4.6.orig/bfd/configure.in	Mon Sep 28 13:45:47 1992
--- gdb-4.6/bfd/configure.in
***************
*** 63,68 ****
--- 63,69 ----
   		bsd*)	my_host=apollo68 ;;
  		esac
  		;;
+ 	lectra) my_host=lectra ;;
  	esac
  	;;

diff -rNc gdb-4.6.orig/bfd/hosts/lectra.h gdb-4.6/bfd/hosts/lectra.h
*** gdb-4.6.orig/bfd/hosts/lectra.h
--- gdb-4.6/bfd/hosts/lectra.h
***************
*** 0 ****
--- 1,33 ----
+ /* 
+  *jms lectra 13/08/92 
+  */
+ 
+ #include <stdio.h>
+ #include <sys/types.h>
+ #include <sys/unistd.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <malloc.h>
+ 
+ #ifndef	MAXPATHLEN
+ #define	MAXPATHLEN	1024
+ #endif	/* MAXPATHLEN */
+ 
+ 
+ /* EXACT TYPES */
+ typedef char int8e_type;
+ typedef unsigned char uint8e_type;
+ typedef short int16e_type;
+ typedef unsigned short uint16e_type;
+ typedef int int32e_type;
+ typedef unsigned int uint32e_type;
+ 
+ /* CORRECT SIZE OR GREATER */
+ typedef char int8_type;
+ typedef unsigned char uint8_type;
+ typedef short int16_type;
+ typedef unsigned short uint16_type;
+ typedef int int32_type;
+ typedef unsigned int uint32_type;
+ 
+ #include "fopen-same.h"
diff -rNc gdb-4.6.orig/bfd/targets.c gdb-4.6/bfd/targets.c
*** gdb-4.6.orig/bfd/targets.c	Mon Sep 28 13:46:02 1992
--- gdb-4.6/bfd/targets.c
***************
*** 387,392 ****
--- 387,393 ----
  extern bfd_target oasys_vec;
  extern bfd_target m88kbcs_vec;
  extern bfd_target m68kcoff_vec;
+ extern bfd_target lectracoff_vec;
  extern bfd_target i386coff_vec;
  extern bfd_target i386aout_vec;
  extern bfd_target i386linux_vec;
***************
*** 443,448 ****
--- 444,450 ----
  	&b_out_vec_little_host,
  	&b_out_vec_big_host,
  	&m68kcoff_vec,
+ 	&lectracoff_vec,
  	&a29kcoff_big_vec,
  	&rs6000coff_vec,
  #ifdef hp9000s800
diff -rNc gdb-4.6.orig/bfd/trad-core.c gdb-4.6/bfd/trad-core.c
*** gdb-4.6.orig/bfd/trad-core.c	Mon Sep 28 13:46:03 1992
--- gdb-4.6/bfd/trad-core.c
***************
*** 36,42 ****
--- 36,52 ----
  #include <sys/param.h>
  #include <sys/dir.h>
  #include <signal.h>
+ #ifndef lectra
  #include <machine/reg.h>
+ #else
+ #include <sys/reg.h>
+ #include <sys/time.h>
+ #define NBPG NBPC
+ #define UPAGES USIZE
+ #define STACK_END_ADDR    USRSTACK  /* see gdb/tm-lectra.h and sys/param.h*/
+ #define HOST_STACK_END_ADDR     STACK_END_ADDR
+ #define HOST_DATA_START_ADDR    u.u_exdata.ux_datorg
+ #endif /* jms lectra */
  
  #include <sys/user.h>		/* After a.out.h  */
  #include <sys/file.h>
diff -rNc gdb-4.6.orig/config/mh-lectra gdb-4.6/config/mh-lectra
*** gdb-4.6.orig/config/mh-lectra
--- gdb-4.6/config/mh-lectra
***************
*** 0 ****
--- 1,6 ----
+ # Define SYSV as -DSYSV if you are using a System V operating system.
+ SYSV = -DSYSV
+ RANLIB = true
+ CFLAGS = -Dlectra -DUSG -traditional -O
+ CC = /usr/local/bin/gcc
+ INSTALL = ginstall -c
\ No newline at end of file
diff -rNc gdb-4.6.orig/config.sub gdb-4.6/config.sub
*** gdb-4.6.orig/config.sub	Mon Sep 28 13:45:29 1992
--- gdb-4.6/config.sub
***************
*** 466,471 ****
--- 466,475 ----
  		basic_machine=sparclitefrwcompat-fujitsu
  		os=-none
  		;;
+ 	lectra)
+ 		basic_machine=m68k-lectra
+ 		os=-sysv
+ 		;;
  
  	none)
  		basic_machine=none-none
diff -rNc gdb-4.6.orig/configure.in gdb-4.6/configure.in
*** gdb-4.6.orig/configure.in	Mon Sep 28 13:47:25 1992
--- gdb-4.6/configure.in
***************
*** 34,39 ****
--- 34,41 ----
  			bsd*) host_makefile_frag=config/mh-a68bsd ;;
  			esac;;
  		esac ;;
+ lectra*)	host_makefile_frag=config/mh-lectra ;;
+ 
  ncr*)		case "${host_os}" in
  		sysv4*) host_makefile_frag=config/mh-ncr3000 ;;
  		esac ;;
diff -rNc gdb-4.6.orig/gdb/config/lectra.mh gdb-4.6/gdb/config/lectra.mh
*** gdb-4.6.orig/gdb/config/lectra.mh
--- gdb-4.6/gdb/config/lectra.mh
***************
*** 0 ****
--- 1,7 ----
+ # Host: lectra m68k SYSV 3.2
+ # 
+ 
+ REGEX=regex.o
+ REGEX1=regex.o
+ XDEPFILES= infptrace.o coredep.o lectra-xdep.o
+ XM_FILE= xm-lectra.h
diff -rNc gdb-4.6.orig/gdb/config/lectra.mt gdb-4.6/gdb/config/lectra.mt
*** gdb-4.6.orig/gdb/config/lectra.mt
--- gdb-4.6/gdb/config/lectra.mt
***************
*** 0 ****
--- 1,4 ----
+ # Target: lectra m68k SYSV 3.2 
+ # jms
+ TDEPFILES= exec.o m68k-pinsn.o m68k-tdep.o
+ TM_FILE= tm-lectra.h
diff -rNc gdb-4.6.orig/gdb/configure.in gdb-4.6/gdb/configure.in
*** gdb-4.6.orig/gdb/configure.in	Mon Sep 28 13:43:44 1992
--- gdb-4.6/gdb/configure.in
***************
*** 47,52 ****
--- 47,53 ----
  		*)	gdb_host=sun3 ;;
  		esac
  		;;
+ 	lectra) gdb_host=lectra ;;
  	esac
  	;;
  
***************
*** 214,224 ****
--- 215,228 ----
  	wrs)	gdb_target=vxworks68 ;;
  	isi)	gdb_target=isi ;;
  	sony)	gdb_target=news ;;
+ 	lectra) gdb_target=lectra ;;
  	esac
  	case "${target_os}" in
  	os68k)	gdb_target=os68k ;;
  	esac
  	;;
+ 	
+ 
  
  m68000)
  	case "${target_vendor}" in
diff -rNc gdb-4.6.orig/gdb/coredep.c gdb-4.6/gdb/coredep.c
*** gdb-4.6.orig/gdb/coredep.c	Mon Sep 28 13:42:17 1992
--- gdb-4.6/gdb/coredep.c
***************
*** 71,82 ****
    for (regno = 0; regno < NUM_REGS; regno++)
      {
        addr = register_addr (regno, reg_ptr);
        if (addr >= core_reg_size) {
  	if (bad_reg < 0)
  	  bad_reg = regno;
!       } else {
  	supply_register (regno, core_reg_sect + addr);
        }
      }
    if (bad_reg >= 0)
      {
--- 71,87 ----
    for (regno = 0; regno < NUM_REGS; regno++)
      {
        addr = register_addr (regno, reg_ptr);
+ #ifndef lectra
        if (addr >= core_reg_size) {
  	if (bad_reg < 0)
  	  bad_reg = regno;
!       } else 
! 	  {
  	supply_register (regno, core_reg_sect + addr);
        }
+ #else
+       supply_register (regno, core_reg_sect + addr);
+ #endif /* jms lectra */
      }
    if (bad_reg >= 0)
      {
diff -rNc gdb-4.6.orig/gdb/dwarfread.c gdb-4.6/gdb/dwarfread.c
*** gdb-4.6.orig/gdb/dwarfread.c	Mon Sep 28 13:42:00 1992
--- gdb-4.6/gdb/dwarfread.c
***************
*** 880,886 ****
  	  list -> field.bitpos = 8 * locval (mbr.at_location);
  	  /* Handle bit fields. */
  	  list -> field.bitsize = mbr.at_bit_size;
! #if BITS_BIG_ENDIAN
  	  /* For big endian bits, the at_bit_offset gives the additional
  	     bit offset from the MSB of the containing anonymous object to
  	     the MSB of the field.  We don't have to do anything special
--- 880,886 ----
  	  list -> field.bitpos = 8 * locval (mbr.at_location);
  	  /* Handle bit fields. */
  	  list -> field.bitsize = mbr.at_bit_size;
! #ifdef BITS_BIG_ENDIAN
  	  /* For big endian bits, the at_bit_offset gives the additional
  	     bit offset from the MSB of the containing anonymous object to
  	     the MSB of the field.  We don't have to do anything special
diff -rNc gdb-4.6.orig/gdb/infptrace.c gdb-4.6/gdb/infptrace.c
*** gdb-4.6.orig/gdb/infptrace.c	Mon Sep 28 13:42:30 1992
--- gdb-4.6/gdb/infptrace.c
***************
*** 17,26 ****
--- 17,31 ----
  along with this program; if not, write to the Free Software
  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
+ 
  #include "defs.h"
  #include "frame.h"
  #include "inferior.h"
  #include "target.h"
+ 
+ #ifdef lectra
+ #include <sys/time.h> 
+ #endif /* jms lectra */
  
  #ifdef USG
  #include <sys/types.h>
diff -rNc gdb-4.6.orig/gdb/lectra-xdep.c gdb-4.6/gdb/lectra-xdep.c
*** gdb-4.6.orig/gdb/lectra-xdep.c
--- gdb-4.6/gdb/lectra-xdep.c
***************
*** 0 ****
--- 1,205 ----
+ /* Low level interface to ptrace, for GDB when running under Unix.
+    Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+  */   
+ 
+ #include "defs.h"
+ #include "tm.h"
+ #include "inferior.h"
+ 
+ #include <sys/time.h>
+ #include <sys/param.h>
+ 
+ #ifdef USG
+ #include <sys/types.h>
+ #endif
+ 
+ #include <stdio.h>
+ #include <sys/dir.h>
+ #include <signal.h>
+ #include <sys/user.h>
+ 
+ #include <sys/reg.h>
+ 
+ extern int inferior_pid;
+ 
+ 
+ #ifndef PT_READ_U
+ #define PT_READ_U 3
+ #define PT_WRITE_U 6
+ #endif 
+ 
+ #ifndef SP_REAL
+ #define SP_REAL (-1)
+ #endif 
+ 
+ #define U_REGS_OFFSET \
+           ptrace(PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0) \
+                  - KERNEL_U_ADDR;
+ 
+ 
+ /* Fetch all registers, or just one, from the child process.  */
+ 
+ void
+ fetch_inferior_registers (regno)
+      int regno;
+ {
+   if (regno == -1)
+     for (regno = 0; regno < NUM_REGS; regno++)
+       fetch_register (regno);
+   else
+     fetch_register (regno);
+ }
+ 
+ 
+ /* Fetch one register.  */
+ 
+ static void
+ fetch_register (regno)
+      int regno;
+ {
+   unsigned int regaddr;
+   char buf[MAX_REGISTER_RAW_SIZE];
+   char mess[128];				/* For messages */
+   register int i;
+ 
+   /* Offset of registers within the u area.  */
+   unsigned int offset;
+ 
+ 
+   offset = U_REGS_OFFSET;
+ 
+   regaddr = register_addr (regno, offset);
+ 
+   if (regno != SP_REGNUM)
+       {
+ 	  for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
+ 	      {
+ 		  errno = 0;
+ 		  *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid,
+ 					     (PTRACE_ARG3_TYPE) regaddr, 0);
+ 		  regaddr += sizeof (int);
+ 		  if (errno != 0 )
+ 		      if (regno < FP0_REGNUM)
+ 			  {
+ 			      sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno);
+ 			      perror_with_name (mess);  
+ 			  }
+ 		      else	
+ 			  {
+ /* on our station, we can't read or write floating point registers if we
+    don't use them, but it's NOT really an error. put zero in them.
+    jms lectra  */
+ 			      bzero (buf, REGISTER_RAW_SIZE (regno));
+ 			      break;
+ 			  }
+ 	      }
+ 	  supply_register (regno, buf);
+       }
+   else
+       {
+ 	  errno = 0;
+ 	  *(int *)&buf[0] = ptrace(3, inferior_pid, ((int *)offset) + SP_REAL, 0);
+ 	  if (errno != 0 )
+ 	      {
+ 		  sprintf (mess, "reading register %s (#%d)", reg_names[regno], regno);
+ 		  perror_with_name (mess);  
+ 	      }
+ 	  supply_register(SP_REGNUM, buf);
+       }
+ }
+ 
+ 
+ /* Store our register values back into the inferior.
+    If REGNO is -1, do this for all registers.
+    Otherwise, REGNO specifies which register (so we can save time).  */
+ 
+ void
+ store_inferior_registers (regno)
+      int regno;
+ {
+   register unsigned int regaddr;
+   extern char registers[];
+   char buf[80];
+   register int i;
+ 
+   unsigned int offset = U_REGS_OFFSET;
+ 
+ 
+ 
+   if (regno >= 0)
+       if (regno == SP_REGNUM) 
+ 	  {
+ 	      errno = 0;
+ 	      ptrace (PT_WRITE_U, inferior_pid, ((int *)offset)+SP_REAL, read_register (regno));
+ 	      if (errno != 0)
+ 		  {
+ 		      sprintf (buf, "writing register number %d", regno);
+ 		      perror_with_name (buf);  
+ 		  }
+ 	  }
+       else
+ 	  {
+ 	      regaddr = register_addr (regno, offset);
+ 	      for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ 		  {
+ 		      errno = 0;
+ 		      ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ 			      *(int *) &registers[REGISTER_BYTE (regno) + i]);
+ 		      if (errno != 0)
+ 			  if (regno < FP0_REGNUM)
+ 			      {
+ 				  sprintf (buf, "writing register number %d", regno);
+ 				  perror_with_name (buf);  
+ 			      }
+ 			  else	
+ 			      {
+ /* on our station, we can't read or write floating point registers if we
+    don't use them, but it's NOT really an error. put zero in them.
+    jms lectra  */
+ 				  bzero (buf, REGISTER_RAW_SIZE (regno));
+ 				  break;
+ 			      }
+ 		      regaddr += sizeof(int);
+ 		  }
+ 	  }
+   else
+       for (regno = 0; regno < NUM_REGS; regno++)
+ 	  if (regno == SP_REGNUM) 
+ 	      {
+ 		  errno = 0;
+ 		  ptrace (PT_WRITE_U, inferior_pid, ((int *)offset)+SP_REAL, read_register (regno));
+ 		  if (errno != 0)
+ 		      {
+ 			  sprintf (buf, "writing register number %d", regno);
+ 			  perror_with_name (buf);  
+ 		      }
+ 	      }
+ 	  else
+ 	      {
+ 		  regaddr = register_addr (regno, offset);
+ 		  for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ 		      {
+ 			  errno = 0;
+ 			  ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ 				  *(int *) &registers[REGISTER_BYTE (regno) + i]);
+ 			  if (errno != 0)
+ 			      if (regno < FP0_REGNUM)
+ 				  {
+ 				      sprintf (buf, "writing register number %d", regno);
+ 				      perror_with_name (buf);  
+ 				  }
+ 			      else	
+ 				  {
+ /* on our station, we can't read or write floating point registers if we
+    don't use them, but it's NOT really an error. put zero in them.
+    jms lectra  */
+ 				      bzero (buf, REGISTER_RAW_SIZE (regno));
+ 				      break;
+ 				  }
+ 
+ 			  regaddr += sizeof(int);
+ 		      }
+ 	      }
+ }
+ 
+ 
diff -rNc gdb-4.6.orig/gdb/tm-lectra.h gdb-4.6/gdb/tm-lectra.h
*** gdb-4.6.orig/gdb/tm-lectra.h
--- gdb-4.6/gdb/tm-lectra.h
***************
*** 0 ****
--- 1,424 ----
+ /* Parameters for Lectra Systeme M2030  target machines, for M68030 on SYSV 3.2
+    for GDB, the GNU debugger.
+    Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
+    Contributed by Soenen Jean-Michel (soenen@lectra.fr)
+ 
+ This file is part of GDB.
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ 
+ /* #define IEEE_FLOAT 1 jms lectra */
+ 
+ 
+ /* Define the bit, byte, and word ordering of the machine.  */
+ #define BITS_BIG_ENDIAN
+ #define BYTES_BIG_ENDIAN
+ #define WORDS_BIG_ENDIAN
+ 
+ /* Define the bit, byte, and word ordering of the machine.  */
+ #define TARGET_BYTE_ORDER BIG_ENDIAN
+ 
+ #define COFF_NO_LONG_FILE_NAMES
+ 
+ /* define if you are using sys5 */
+ #ifndef USG
+ #define USG
+ #endif 
+ #define vfork() fork()
+ #define MAXPATHLEN 1024
+ #define HAVE_TERMIO
+ 
+ /* Get rid of any system-imposed stack limit if possible.  */
+ 
+ /* #define SET_STACK_LIMIT_HUGE */
+ 
+ /* Define this if the C compiler puts an underscore at the front
+    of external names before giving them to the linker.  */
+ 
+ /* #define NAMES_HAVE_UNDERSCORE */
+ 
+ /* Debugger information will be in DBX format.  */
+ 
+ /* #define READ_DBX_FORMAT */
+ #define COFF_FORMAT
+ 
+ /* Offset from address of function to start of its code.
+    Zero on most machines.  */
+ 
+ #define FUNCTION_START_OFFSET 0
+ 
+ /* Advance PC across any function entry prologue instructions
+    to reach some "real" code.  */
+ 
+ #if !defined(SKIP_PROLOGUE)
+ #define SKIP_PROLOGUE(ip)   {(ip) = m68k_skip_prologue(ip);}
+ extern CORE_ADDR m68k_skip_prologue PARAMS ((CORE_ADDR ip));
+ #endif
+ 
+ /* Immediately after a function call, return the saved pc.
+    Can't go through the frames for this because on some machines
+    the new frame is not set up until the new function executes
+    some instructions.  */
+ 
+ #define SAVED_PC_AFTER_CALL(frame) \
+ read_memory_integer (read_register (SP_REGNUM), 4)
+ 
+ /* This is the amount to subtract from u.u_ar0
+    to get the offset in the core file of the register values.  */
+ 
+ #define KERNEL_U_ADDR 0x50000000
+ 
+ /* Address of end of stack space.  */
+ 
+ /* #define STACK_END_ADDR 0x1FFFF00 jms lectra */
+ 
+ /* Stack grows downward.  */
+ 
+ #define INNER_THAN <
+ 
+ /* Sequence of bytes for breakpoint instruction.  */
+ 
+ #define BREAKPOINT {0x4e, 0x45}
+ 
+ 
+ /* Amount PC must be decremented by after a breakpoint.
+    This is often the number of bytes in BREAKPOINT
+    but not always.  */
+ 
+ #define DECR_PC_AFTER_BREAK 0
+ 
+ /* Nonzero if instruction at PC is a return instruction.  */
+ /* Allow any of the return instructions, including a trapv and a return
+    from interupt.  */
+ 
+ #define ABOUT_TO_RETURN(pc) ((read_memory_integer (pc, 2) & ~0x3) == 0x4e74) /* jms lectra */
+ 
+ /* Return 1 if P points to an invalid floating point value.  */
+ 
+ #define INVALID_FLOAT(p, len) 0   /* Just a first guess; not checked */
+ 
+ /* Largest integer type */
+ #define LONGEST long
+ 
+ /* Name of the builtin type for the LONGEST type above. */
+ #define BUILTIN_TYPE_LONGEST builtin_type_long
+ 
+ /* Say how long (ordinary) registers are.  */
+ 
+ #define REGISTER_TYPE long
+ 
+ /* Number of machine registers */
+ 
+ #define NUM_REGS 29
+ 
+ /* Initializer for an array of names of registers.
+    There should be NUM_REGS strings in this initializer.  */
+ 
+ #define REGISTER_NAMES  \
+  {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
+   "a0", "a1", "a2", "a3", "a4", "a5", "fp", "ps", \
+   "pc", "sp",  \
+   "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", \
+   "fpcontrol", "fpstatus", "fpiaddr" }
+ 
+ /* Register numbers of various important registers.
+    Note that some of these values are "real" register numbers,
+    and correspond to the general registers of the machine,
+    and some are "phony" register numbers which are too large
+    to be actual register numbers as far as the user is concerned
+    but do serve to get the desired values when passed to read_register.  */
+ 
+ #define FP_REGNUM 14		/* Contains address of executing stack frame */
+ #define PS_REGNUM 15		/* Contains address of top of stack */
+ #define PC_REGNUM 16		/* Contains processor status */
+ #define SP_REGNUM 17		/* Contains program counter */
+ #define FP0_REGNUM 18		/* Floating point register 0 */
+ #define FPC_REGNUM 26		/* 68881 control register */
+ #define FPS_REGNUM 27		/* 68881 status register */
+ #define FPI_REGNUM 28		/* 68881 iaddr register */
+ 
+ /* Total amount of space needed to store our copies of the machine's
+    register state, the array `registers'.  */
+ #define REGISTER_BYTES (16*4+8*12+8+12)
+ 
+ /* Index within `registers' of the first byte of the space for
+    register N.  */
+ 
+ #define REGISTER_BYTE(N)  \
+  ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 168	\
+   : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 72	\
+   : (N) * 4)
+ 
+ /* Number of bytes of storage in the actual machine representation
+    for register N.  On the 68000, all regs are 4 bytes
+    except the floating point regs which are 12 bytes.  */
+ 
+ #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4)
+ 
+ /* Number of bytes of storage in the program's representation
+    for register N.  On the 68000, all regs are 4 bytes
+    except the floating point regs which are 8-byte doubles.  */
+ 
+ #define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 8 : 4)
+ 
+ /* Largest value REGISTER_RAW_SIZE can have.  */
+ 
+ #define MAX_REGISTER_RAW_SIZE 12
+ 
+ /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
+ 
+ #define MAX_REGISTER_VIRTUAL_SIZE 8
+ 
+ /* Nonzero if register N requires conversion
+    from raw format to virtual format.  */
+ 
+ #define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8)
+ 
+ /* Put the declaration out here because if it's in the macros, PCC
+    will complain.  */
+ extern const struct ext_format ext_format_68881;
+ 
+ /* Convert data from raw format for register REGNUM
+    to virtual format for register REGNUM.  */
+ 
+ #define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO)	\
+ { \
+   if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM)	\
+     ieee_extended_to_double (&ext_format_68881, (FROM), (double *)(TO)); \
+   else					\
+     memcpy ((TO), (FROM), 4);	\
+ }
+ 
+ /* Convert data from virtual format for register REGNUM
+    to raw format for register REGNUM.  */
+ 
+ #define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO)	\
+ { \
+   if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM)	\
+     double_to_ieee_extended (&ext_format_68881, (double *)(FROM), (TO)); \
+   else					\
+     memcpy ((TO), (FROM), 4);	\
+ }
+ 
+ /* Return the GDB type object for the "standard" data type
+    of data in register N.  */
+ 
+ #define REGISTER_VIRTUAL_TYPE(N) \
+  (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : builtin_type_int)
+ 
+ /* Store the address of the place in which to copy the structure the
+    subroutine will return.  This is called from call_function. */
+ 
+ #define STORE_STRUCT_RETURN(ADDR, SP) \
+   { write_register (9, (ADDR)); }		/* 9 -> A1_REGNUM jms lectra */
+ 
+ /* Extract from an array REGBUF containing the (raw) register state
+    a function return value of type TYPE, and copy that, in virtual format,
+    into VALBUF.  */
+ 
+ #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+   bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
+ 
+ /* Write into appropriate registers a function return value
+    of type TYPE, given in virtual format.  */
+ 
+ #define STORE_RETURN_VALUE(TYPE,VALBUF) \
+   write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
+ 
+ /* Extract from an array REGBUF containing the (raw) register state
+    the address in which a function should return its structure value,
+    as a CORE_ADDR (or an expression that can be used as one).  */
+ 
+ #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
+ 
+ 
+ /* Describe the pointer in each stack frame to the previous stack frame
+    (its caller).  */
+ 
+ /* FRAME_CHAIN takes a frame's nominal address
+    and produces the frame's chain-pointer.
+ 
+    FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
+    and produces the nominal address of the caller frame.
+ 
+    However, if FRAME_CHAIN_VALID returns zero,
+    it means the given frame is the outermost one and has no caller.
+    In that case, FRAME_CHAIN_COMBINE is not used.  */
+ 
+ /* In the case of the 68000, the frame's nominal address
+    is the address of a 4-byte word containing the calling frame's address.  */
+ 
+ 
+ #define FRAME_CHAIN(thisframe)  \
+   (!inside_entry_file ((thisframe)->pc) ? \
+    read_memory_integer ((thisframe)->frame, 4) :\
+    0)
+ #define FRAME_CHAIN_VALID(chain, thisframe) \
+   (chain != 0 && (!inside_entry_file (FRAME_SAVED_PC (thisframe))))
+ 
+ #define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
+ 
+ /* Define other aspects of the stack frame.  */
+ 
+ /* A macro that tells us whether the function invocation represented
+    by FI does not have a frame on the stack associated with it.  If it
+    does not, FRAMELESS is set to 1, else 0.  */
+ 
+ #define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
+   (FRAMELESS) = frameless_look_for_prologue(FI)
+ 
+ #define FRAME_SAVED_PC(FRAME) (read_memory_integer ((FRAME)->frame + 4, 4))
+ 
+ #define FRAME_ARGS_ADDRESS(fi) ((fi)->frame)
+ 
+ #define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+ 
+ /* Set VAL to the number of args passed to frame described by FI.
+    Can set VAL to -1, meaning no way to tell.  */
+ 
+ /* We can't tell how many args there are
+    now that the C compiler delays popping them.  */
+ #define FRAME_NUM_ARGS(val,fi) (val = -1)
+ 
+ /* Return number of bytes at start of arglist that are not really args.  */
+ /* |          | ARGN-1
+    |__________| ARGN
+    |__________| PC save
+    |__________| FP save    <- frame points here */
+ 
+ #define FRAME_ARGS_SKIP 8
+ 
+ /* Put here the code to store, into a struct frame_saved_regs,
+    the addresses of the saved registers of frame described by FRAME_INFO.
+    This includes special registers such as pc and fp saved in special
+    ways in the stack frame.  sp is even more special:
+    the address we return for it IS the sp for the next frame.  */
+ 
+ #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)		\
+ { register int regnum;							\
+   register int regmask;							\
+   register CORE_ADDR next_addr;						\
+   register CORE_ADDR pc;						\
+   int nextinsn;								\
+   bzero (&frame_saved_regs, sizeof frame_saved_regs);			\
+   if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 8*12 - 4 \
+       && (frame_info)->pc <= (frame_info)->frame)			\
+     { next_addr = (frame_info)->frame;					\
+       pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 8*12 - 4; }\
+   else   								\
+     { pc = get_pc_function_start ((frame_info)->pc); 			\
+       /* Verify we have a link a6 instruction next;			\
+ 	 if not we lose.  If we win, find the address above the saved   \
+ 	 regs using the amount of storage from the link instruction.  */\
+       if (044016 == read_memory_integer (pc, 2))			\
+ 	next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4; \
+       else if (047126 == read_memory_integer (pc, 2))			\
+ 	next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2; \
+       else goto lose;							\
+       /* If have an addal #-n, sp next, adjust next_addr.  */		\
+       if ((0177777 & read_memory_integer (pc, 2)) == 0157774)		\
+ 	next_addr += read_memory_integer (pc += 2, 4), pc += 4;		\
+     }									\
+   /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */	\
+   regmask = read_memory_integer (pc + 2, 2);				\
+   /* But before that can come an fmovem.  Check for it.  */		\
+   nextinsn = 0xffff & read_memory_integer (pc, 2);			\
+   if (0xf227 == nextinsn						\
+       && (regmask & 0xff00) == 0xe000)					\
+     { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */ \
+       for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)		\
+ 	if (regmask & 1)						\
+           (frame_saved_regs).regs[regnum] = (next_addr -= 12);		\
+       regmask = read_memory_integer (pc + 2, 2); }			\
+   if (0044327 == read_memory_integer (pc, 2))				\
+     { pc += 4; /* Regmask's low bit is for register 0, the first written */ \
+       for (regnum = 0; regnum < 16; regnum++, regmask >>= 1)		\
+ 	if (regmask & 1)						\
+           (frame_saved_regs).regs[regnum] = (next_addr += 4) - 4; }	\
+   else if (0044347 == read_memory_integer (pc, 2))			\
+     { pc += 4; /* Regmask's low bit is for register 15, the first pushed */ \
+       for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1)		\
+ 	if (regmask & 1)						\
+           (frame_saved_regs).regs[regnum] = (next_addr -= 4); }		\
+   else if (0x2f00 == 0xfff0 & read_memory_integer (pc, 2))		\
+     { regnum = 0xf & read_memory_integer (pc, 2); pc += 2;		\
+       (frame_saved_regs).regs[regnum] = (next_addr -= 4); }		\
+   /* fmovemx to index of sp may follow.  */				\
+   regmask = read_memory_integer (pc + 2, 2);				\
+   nextinsn = 0xffff & read_memory_integer (pc, 2);			\
+   if (0xf236 == nextinsn						\
+       && (regmask & 0xff00) == 0xf000)					\
+     { pc += 10; /* Regmask's low bit is for register fp0, the first written */ \
+       for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)		\
+ 	if (regmask & 1)						\
+           (frame_saved_regs).regs[regnum] = (next_addr += 12) - 12;	\
+       regmask = read_memory_integer (pc + 2, 2); }			\
+   /* clrw -(sp); movw ccr,-(sp) may follow.  */				\
+   if (0x426742e7 == read_memory_integer (pc, 4))			\
+     (frame_saved_regs).regs[PS_REGNUM] = (next_addr -= 4);		\
+   lose: ;								\
+   (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 8;		\
+   (frame_saved_regs).regs[FP_REGNUM] = (frame_info)->frame;		\
+   (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4;		\
+ }
+ 
+ /* Things needed for making the inferior call functions.  */
+ 
+ /* Push an empty stack frame, to record the current PC, etc.  */
+ 
+ #define PUSH_DUMMY_FRAME	{ m68k_push_dummy_frame (); }
+ 
+ extern void m68k_push_dummy_frame PARAMS ((void));
+ extern void m68k_pop_frame PARAMS ((void));
+ 
+ /* Discard from the stack the innermost frame, 
+    restoring all saved registers.  */
+ 
+ #define POP_FRAME		{ m68k_pop_frame (); }
+ 
+ /* This sequence of words is the instructions
+      fmovem 0xff,-(sp)
+      moveml 0xfffc,-(sp)
+      clrw -(sp)
+      movew ccr,-(sp)
+      /..* The arguments are pushed at this point by GDB;
+ 	no code is needed in the dummy for this.
+ 	The CALL_DUMMY_START_OFFSET gives the position of 
+ 	the following jsr instruction.  *../
+      jsr @#32323232
+      addl #69696969,sp
+      bpt
+      nop
+ Note this is 28 bytes.
+ We actually start executing at the jsr, since the pushing of the
+ registers is done by PUSH_DUMMY_FRAME.  If this were real code,
+ the arguments for the function called by the jsr would be pushed
+ between the moveml and the jsr, and we could allow it to execute through.
+ But the arguments have to be pushed by GDB after the PUSH_DUMMY_FRAME is done,
+ and we cannot allow the moveml to push the registers again lest they be
+ taken for the arguments.  */
+ 
+ #define CALL_DUMMY {0xf227e0ff, 0x48e7fffc, 0x426742e7, 0x4eb93232, 0x3232dffc, 0x69696969, 0x4e454e71}
+ #define CALL_DUMMY_LENGTH 28
+ #define CALL_DUMMY_START_OFFSET 12
+ 
+ /* Insert the specified number of args and function address
+    into a call sequence of the above form stored at DUMMYNAME.  */
+ 
+ #define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p)     \
+ { _do_putb32 (fun,     (char *) dummyname + CALL_DUMMY_START_OFFSET + 2);  \
+   _do_putb32 (nargs*4, (char *) dummyname + CALL_DUMMY_START_OFFSET + 8); }
+ 
diff -rNc gdb-4.6.orig/gdb/values.c gdb-4.6/gdb/values.c
*** gdb-4.6.orig/gdb/values.c	Mon Sep 28 13:41:48 1992
--- gdb-4.6/gdb/values.c
***************
*** 1224,1230 ****
  
    /* Extract bits.  See comment above. */
  
! #if BITS_BIG_ENDIAN
    lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
  #else
    lsbcount = (bitpos % 8);
--- 1224,1230 ----
  
    /* Extract bits.  See comment above. */
  
! #ifdef BITS_BIG_ENDIAN
    lsbcount = (sizeof val * 8 - bitpos % 8 - bitsize);
  #else
    lsbcount = (bitpos % 8);
***************
*** 1272,1278 ****
    SWAP_TARGET_AND_HOST (&oword, sizeof oword);		/* To host format */
  
    /* Shifting for bit field depends on endianness of the target machine.  */
! #if BITS_BIG_ENDIAN
    bitpos = sizeof (oword) * 8 - bitpos - bitsize;
  #endif
  
--- 1272,1278 ----
    SWAP_TARGET_AND_HOST (&oword, sizeof oword);		/* To host format */
  
    /* Shifting for bit field depends on endianness of the target machine.  */
! #ifdef BITS_BIG_ENDIAN
    bitpos = sizeof (oword) * 8 - bitpos - bitsize;
  #endif
  
diff -rNc gdb-4.6.orig/gdb/xm-lectra.h gdb-4.6/gdb/xm-lectra.h
*** gdb-4.6.orig/gdb/xm-lectra.h
--- gdb-4.6/gdb/xm-lectra.h
***************
*** 0 ****
--- 1,87 ----
+ /* Macro definitions for running gdb on a Lectra Systeme M2030 
+ with m68030 cpu's on SYSV 3,2 
+ Contributed by Jean-Michel Soenen  (soenen@lectra.fr)
+ 
+ This file is part of GDB.
+ 
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+ 
+ 
+ #define MEM_FNS_DECLARED
+ 
+ #define FETCH_INFERIOR_REGISTERS
+ 
+ #define REGISTER_U_ADDR(addr, blockend, regno) \
+     { addr = (blockend) + (regno) * 4; }
+     
+ 
+ /* Define the bit, byte, and word ordering of the machine.  */
+ #define HOST_BYTE_ORDER BIG_ENDIAN
+ 
+ 
+ /* Interface definitions for kernel debugger KDB.  */
+ 
+ /* Map machine fault codes into signal numbers.
+    First subtract 0, divide by 4, then index in a table.
+    Faults for which the entry in this table is 0
+    are not handled by KDB; the program's own trap handler
+    gets to handle then.  */
+ 
+ #define FAULT_CODE_ORIGIN 0
+ #define FAULT_CODE_UNITS 4
+ #define FAULT_TABLE    \
+ { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
+   0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
+   0, 0, 0, 0, 0, 0, 0, 0, \
+   SIGILL }
+ 
+ 
+ /* Start running with a stack stretching from BEG to END.
+    BEG and END should be symbols meaningful to the assembler.
+    This is used only for kdb.  */
+ 
+ #define INIT_STACK(beg, end)						\
+ { asm ("global end");							\
+   asm ("mov.l &end,%sp");						\
+   asm ("sub.l %a6,%a6"); }
+ 
+ /* Push the frame pointer register on the stack.  */
+ #define PUSH_FRAME_PTR							\
+   asm ("mov.l %fp,-(%sp)");
+ 
+ /* Copy the top-of-stack to the frame pointer register.  */
+ #define POP_FRAME_PTR							\
+   asm ("mov.l (%sp),%fp");
+ 
+ /* After KDB is entered by a fault, push all registers
+    that GDB thinks about (all NUM_REGS of them),
+    so that they appear in order of ascending GDB register number.
+    The fault code will be on the stack beyond the last register.  */
+ 
+ #define PUSH_REGISTERS							\
+ { asm ("clr.w -(%sp)");							\
+   asm ("pea 10(%sp)");							\
+   asm ("movm.l &0xfffe,-(%sp)"); }
+ 
+ /* Assuming the registers (including processor status) have been
+    pushed on the stack in order of ascending GDB register number,
+    restore them and return to the address in the saved PC register.  */
+ 
+ #define POP_REGISTERS							\
+ { asm ("sub.l &8,28(%sp)");						\
+   asm ("movm.l (%sp),&0xffff");						\
+   asm ("rte"); }
+ 
+ 
diff -rNc gdb-4.6.orig/include/coff/lectra.h gdb-4.6/include/coff/lectra.h
*** gdb-4.6.orig/include/coff/lectra.h
--- gdb-4.6/include/coff/lectra.h
***************
*** 0 ****
--- 1,194 ----
+ /*** coff information for lectra m68k SYSV 3.2 */
+  
+ /********************** FILE HEADER **********************/
+ 
+ struct external_filehdr {
+ 	char f_magic[2];	/* magic number			*/
+ 	char f_nscns[2];	/* number of sections		*/
+ 	char f_timdat[4];	/* time & date stamp		*/
+ 	char f_symptr[4];	/* file pointer to symtab	*/
+ 	char f_nsyms[4];	/* number of symtab entries	*/
+ 	char f_opthdr[2];	/* sizeof(optional hdr)		*/
+ 	char f_flags[2];	/* flags			*/
+ };
+ 
+ 
+ /* Motorola 68000/68008/68010/68020 */
+ #define LECTRAMAGIC	0554    /* jms lectra voir /etc/magic */
+ 
+ #define LECTRABADMAG(x) ((x).f_magic!=LECTRAMAGIC)
+ 
+ #define OMAGIC LECTRAMAGIC			
+ 
+ #define	FILHDR	struct external_filehdr
+ #define	FILHSZ	sizeof(FILHDR)
+ 
+ 
+ /********************** AOUT "OPTIONAL HEADER" **********************/
+ 
+ 
+ typedef struct 
+ {
+   char 	magic[2];		/* type of file				*/
+   char	vstamp[2];		/* version stamp			*/
+   char	tsize[4];		/* text size in bytes, padded to FW bdry*/
+   char	dsize[4];		/* initialized data "  "		*/
+   char	bsize[4];		/* uninitialized data "   "		*/
+   char	entry[4];		/* entry pt.				*/
+   char 	text_start[4];		/* base of text used for this file */
+   char 	data_start[4];		/* base of data used for this file */
+ }
+ AOUTHDR;
+ 
+ #define AOUTSZ (sizeof(AOUTHDR))
+ 
+ 
+ 
+ /********************** SECTION HEADER **********************/
+ 
+ 
+ struct external_scnhdr {
+ 	char		s_name[8];	/* section name			*/
+ 	char		s_paddr[4];	/* physical address, aliased s_nlib */
+ 	char		s_vaddr[4];	/* virtual address		*/
+ 	char		s_size[4];	/* section size			*/
+ 	char		s_scnptr[4];	/* file ptr to raw data for section */
+ 	char		s_relptr[4];	/* file ptr to relocation	*/
+ 	char		s_lnnoptr[4];	/* file ptr to line numbers	*/
+ 	char		s_nreloc[4];	/* number of relocation entries	*/
+ 	char		s_nlnno[4];	/* number of line number entries jms lectra*/
+ 	char		s_flags[4];	/* flags			*/
+ };
+ 
+ /*
+  * names of "special" sections
+  */
+ #define _TEXT	".text"
+ #define _DATA	".data"
+ #define _BSS	".bss"
+ 
+ 
+ #define	SCNHDR	struct external_scnhdr
+ #define	SCNHSZ	sizeof(SCNHDR)
+ 
+ 
+ /********************** LINE NUMBERS **********************/
+ 
+ /* 1 line number entry for every "breakpointable" source line in a section.
+  * Line numbers are grouped on a per function basis; first entry in a function
+  * grouping will have l_lnno = 0 and in place of physical address will be the
+  * symbol table index of the function name.
+  */
+ struct external_lineno {
+ 	union {
+ 		char l_symndx[4];	/* function name symbol index, iff l_lnno == 0*/
+ 		char l_paddr[4];	/* (physical) address of line number	*/
+ 	} l_addr;
+ 	char l_lnno[2];	/* line number		*/
+ };
+ 
+ 
+ #define	LINENO	struct external_lineno
+ #define	LINESZ	sizeof(LINENO) 
+ 
+ 
+ /********************** SYMBOLS **********************/
+ 
+ #define E_SYMNMLEN	8	/* # characters in a symbol name	*/
+ #define E_FILNMLEN	14	/* # characters in a file name		*/
+ #define E_DIMNUM	4	/* # array dimensions in auxiliary entry */
+ 
+ struct external_syment 
+ {
+   union {
+     char e_name[E_SYMNMLEN];
+     struct {
+       char e_zeroes[4];
+       char e_offset[4];
+     } e;
+   } e;
+   char e_value[4];
+   char e_scnum[2];
+   char e_type[2];
+   char e_sclass[1];
+   char e_numaux[1];
+ };
+ 
+ 
+ 
+ #define N_BTMASK	(017)
+ #define N_TMASK		(060)
+ #define N_BTSHFT	(4)
+ #define N_TSHIFT	(2)
+   
+ 
+ union external_auxent {
+ 	struct {
+ 		char x_tagndx[4];	/* str, un, or enum tag indx */
+ 		union {
+ 			struct {
+ 			    char  x_lnno[2]; /* declaration line number */
+ 			    char  x_size[2]; /* str/union/array size */
+ 			} x_lnsz;
+ 			char x_fsize[4];	/* size of function */
+ 		} x_misc;
+ 		union {
+ 			struct {		/* if ISFCN, tag, or .bb */
+ 			    char x_lnnoptr[4];	/* ptr to fcn line # */
+ 			    char x_endndx[4];	/* entry ndx past block end */
+ 			} x_fcn;
+ 			struct {		/* if ISARY, up to 4 dimen. */
+ 			    char x_dimen[E_DIMNUM][2];
+ 			} x_ary;
+ 		} x_fcnary;
+ 		char x_tvndx[2];		/* tv index */
+ 	} x_sym;
+ 	
+ 	union {
+ 		char x_fname[E_FILNMLEN];
+ 		struct {
+ 			char x_zeroes[4];
+ 			char x_offset[4];
+ 		} x_n;
+ 	} x_file;
+ 
+ 	struct {
+ 		char x_scnlen[4];			/* section length */
+ 		char x_nreloc[2];	/* # relocation entries */
+ 		char x_nlinno[2];	/* # line numbers */
+ 	} x_scn;
+ 
+         struct {
+ 		char x_tvfill[4];	/* tv fill value */
+ 		char x_tvlen[2];	/* length of .tv */
+ 		char x_tvran[2][2];	/* tv range */
+ 	} x_tv;		/* info about .tv section (in auxent of symbol .tv)) */
+ 
+ 
+ };
+ 
+ #define	SYMENT	struct external_syment
+ #define	SYMESZ	18	
+ #define	AUXENT	union external_auxent
+ #define	AUXESZ	18
+ 
+ 
+ 
+ /********************** RELOCATION DIRECTIVES **********************/
+ 
+ 
+ struct external_reloc {
+   char r_vaddr[4];
+   char r_symndx[4];
+   char r_type[2];
+ };
+ 
+ 
+ #define RELOC struct external_reloc
+ #define RELSZ 10
+ 
+ #define DEFAULT_DATA_SECTION_ALIGNMENT 4
+ #define DEFAULT_BSS_SECTION_ALIGNMENT 4
+ #define DEFAULT_TEXT_SECTION_ALIGNMENT 4
+ /* For new sections we havn't heard of before */
+ #define DEFAULT_SECTION_ALIGNMENT 4




Newsgroups: gnu.gdb.bug