From: hikichi@srarc2.sra.co.JP (Nobuyuki Hikichi)
Subject: 4.5 my fixes for SONY RISC(mips) NEWS
Reply-To: hikichi@sra.co.jp
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 17 Apr 1992 06:33:16 GMT

>From: sato@sm.sony.co.JP (Kazumi Sato)
>Subject: my fixes for SONY NEWS
Reply-To: sato@sm.sony.co.jp

>I compiled gdb-4.2 on SONY NEWS(m68k machine and r3000 machine) with
>NEWSOS4.1. But I need some fixes. I change some configurations that 'news'
>is for m68k machines and 'risc-news' is for r3000 machines. 
>Here is the fixes.

I had a change for gdb 4.5/Sony RISC(R3000) NEWS 4.1R based above mail
as following.  

					Name: Nobuyuki Hikichi <hikichi@sra.co.jp>
				Office: Software Research Associates, Inc. Japan.

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 04/16/1992 12:31 UTC by hikichi@srarc2
# Source directory /tmp
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   7011 -rw-r--r-- news.diff
#
# ============= news.diff ==============
if test -f 'news.diff' -a X"$1" != X"-c"; then
	echo 'x - skipping news.diff (File already exists)'
else
echo 'x - extracting news.diff (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'news.diff' &&
diff -rNu3 gdb-4.5.org/bfd/config/h-risc-news gdb-4.5/bfd/config/h-risc-news
--- gdb-4.5.org/bfd/config/h-risc-news
+++ gdb-4.5/bfd/config/h-risc-news	Thu Apr 16 16:09:48 1992
@@ -0,0 +1,2 @@
+HDEFINES=-DTRAD_CORE
+HDEPFILES=trad-core.o
diff -rNu3 gdb-4.5.org/bfd/config/risc-news.mh gdb-4.5/bfd/config/risc-news.mh
--- gdb-4.5.org/bfd/config/risc-news.mh
+++ gdb-4.5/bfd/config/risc-news.mh	Thu Apr 16 16:09:49 1992
@@ -0,0 +1,2 @@
+HDEFINES=-DTRAD_CORE
+HDEPFILES=trad-core.o
diff -rNu3 gdb-4.5.org/bfd/config/risc-news.mt gdb-4.5/bfd/config/risc-news.mt
--- gdb-4.5.org/bfd/config/risc-news.mt
+++ gdb-4.5/bfd/config/risc-news.mt	Thu Apr 16 16:09:49 1992
@@ -0,0 +1,2 @@
+# Target:  Sony RISC NEWS
+# Nothing to do for now.
diff -rNu3 gdb-4.5.org/bfd/config/t-risc-news gdb-4.5/bfd/config/t-risc-news
--- gdb-4.5.org/bfd/config/t-risc-news
+++ gdb-4.5/bfd/config/t-risc-news	Thu Apr 16 16:09:49 1992
@@ -0,0 +1,2 @@
+# Target SONY RISC NEWS
+# Nothing to do for now.
diff -rNu3 gdb-4.5.org/bfd/configure.in gdb-4.5/bfd/configure.in
--- gdb-4.5.org/bfd/configure.in	Mon Mar 30 03:45:32 1992
+++ gdb-4.5/bfd/configure.in	Thu Apr 16 14:34:32 1992
@@ -24,6 +24,8 @@
X 		irix4)	my_host=irix4 ;;
X 		esac
X 		;;
+	sony)
+		my_host=risc-news ;;
X 	esac
X 	;;
X 
@@ -129,9 +131,18 @@
X 
X case "${target_vendor}" in
X aout | coff | bout | elf) bfd_target=${target_cpu}-${target_vendor} ;;
-sony)		bfd_target=news ;;
+
X intel)		bfd_target=${target_cpu}-coff ;;	
X stratus | cbm | ncr)	bfd_target=${target_cpu}-elf ;;
+
+sony)
+	case "${target_cpu}" in
+	mips)
+		bfd_target=irix3 ;;
+	*)
+		bfd_target=news ;;
+	esac
+	;;
X 
X unknown)
X 	case "${target_os}" in
diff -rNu3 gdb-4.5.org/bfd/hosts/risc-news.h gdb-4.5/bfd/hosts/risc-news.h
--- gdb-4.5.org/bfd/hosts/risc-news.h
+++ gdb-4.5/bfd/hosts/risc-news.h	Thu Apr 16 14:48:17 1992
@@ -0,0 +1,84 @@
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/file.h>
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+#define SEEK_SET 0
+#define SEEK_CUR 1
+
+#include <sys/param.h>
+#include <machine/vmparam.h>
+#define HOST_PAGE_SIZE	NBPG
+/* #define	HOST_SEGMENT_SIZE	NBPG -- we use HOST_DATA_START_ADDR */
+#define HOST_MACHINE_ARCH	bfd_arch_mips
+/* #define	HOST_MACHINE_MACHINE     */
+
+#define HOST_TEXT_START_ADDR		USRTEXT
+#define HOST_DATA_START_ADDR		USRDATA
+#define HOST_STACK_END_ADDR		USRSTACK
+
+#define	MISSING_VFPRINTF
+
+extern PROTO(int, abort,(void));
+extern PROTO(int, close,(int));
+extern PROTO(int, fcntl,(int des, int cmd, int e));
+extern PROTO(int, fprintf,(FILE *,char *,...));
+extern PROTO(int, printf,(char *,...));
+extern PROTO(int, qsort,(void *data,int els, int siz, int func()));
+extern PROTO(int, exit,(int));
+extern PROTO(int, fseek,(FILE*, int, int));
+extern PROTO(int, fclose,(FILE*));
+extern PROTO(void, bcopy,(char*,char*,int));
+extern PROTO(int, bcmp,(char *, char *, int));
+extern PROTO(void, bzero,(char *, int));
+extern char * strchr();
+extern PROTO(void, perror,(char *));
+extern char *getenv();
+extern char *memchr();
+extern char *strrchr();
+extern int chmod();
+extern int fread();
+extern int fstat();
+extern int fwrite();
+extern int sscanf();
+extern int stat();
+extern int strtol();
+void free();
+char *malloc();
+char *realloc();
+PROTO (void, perror, (char *s));
+extern char *strrchr();
+extern char *ctime();
+extern int _flsbuf();
+extern int fclose();
+extern int time();
+extern int utimes();
+extern int vfprintf();
+extern long atol();
+extern char *getenv();
+extern int fputc();
+extern int unlink();
+
+
+/* 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 -rNu3 gdb-4.5.org/config/mh-risc-news gdb-4.5/config/mh-risc-news
--- gdb-4.5.org/config/mh-risc-news
+++ gdb-4.5/config/mh-risc-news	Thu Apr 16 14:46:14 1992
@@ -0,0 +1 @@
+CC = cc -Wf,-XNg1000
diff -rNu3 gdb-4.5.org/configure.in gdb-4.5/configure.in
--- gdb-4.5.org/configure.in	Sat Apr 11 10:51:46 1992
+++ gdb-4.5/configure.in	Thu Apr 16 14:44:05 1992
@@ -32,6 +32,16 @@
X 			bsd*) host_makefile_frag=config/mh-a68bsd ;;
X 			esac;;
X 		esac ;;
+
+sony)
+	case "${target_cpu}" in
+	mips)
+		host_makefile=irix3 ;;
+	*)
+		host_makefile=news ;;
+	esac
+	;;
+
X esac
X 
X # per-target:
diff -rNu3 gdb-4.5.org/gdb/coredep.c gdb-4.5/gdb/coredep.c
--- gdb-4.5.org/gdb/coredep.c	Wed Mar  4 08:21:54 1992
+++ gdb-4.5/gdb/coredep.c	Thu Apr 16 17:04:10 1992
@@ -67,8 +67,11 @@
X      NOP.  */
X   if (reg_ptr > core_reg_size)
X     reg_ptr -= KERNEL_U_ADDR;
+
+#if 0 /* no ned this code? */
X   if (reg_ptr > core_reg_size)
X     fprintf (stderr, "Can't find registers in core file\n");
+#endif
X 
X   for (regno = 0; regno < NUM_REGS; regno++)
X     {
diff -rNu3 gdb-4.5.org/gdb/findvar.c gdb-4.5/gdb/findvar.c
--- gdb-4.5.org/gdb/findvar.c	Wed Mar  4 08:22:22 1992
+++ gdb-4.5/gdb/findvar.c	Thu Apr 16 17:09:48 1992
@@ -581,6 +581,19 @@
X 	 endian machines.  */
X 
X       /* Copy into the contents section of the value.  */
+
+      /* Mon Aug 19 14:02:04 JST 1991 gamou */
+#if defined(mips) && TARGET_BYTE_ORDER==BIG_ENDIAN 
+      /* On MIPS machine register double stored like little endian into
+         registers regardless machine's endian. So big endian machine
+         must swap values */
+      if (num_storage_locs == 2) {
+        bcopy(value_bytes+4, VALUE_CONTENTS_RAW(v), REGISTER_RAW_SIZE(regnum));
+        bcopy(value_bytes, VALUE_CONTENTS_RAW(v)+4, REGISTER_RAW_SIZE(regnum));
+        return v;
+      }
+#endif
+
X       bcopy (value_bytes, VALUE_CONTENTS_RAW (v), len);
X 
X       return v;
diff -rNu3 gdb-4.5.org/gdb/mips-xdep.c gdb-4.5/gdb/mips-xdep.c
--- gdb-4.5.org/gdb/mips-xdep.c	Wed Mar  4 08:23:46 1992
+++ gdb-4.5/gdb/mips-xdep.c	Thu Apr 16 16:02:55 1992
@@ -23,7 +23,11 @@
X #ifdef sgi
X #include <sys/inst.h>
X #else
+#ifdef sony
+#include <machine/inst.h>
+#else
X #include <mips/inst.h>
+#endif
X #endif
X #include "frame.h"
X #include "inferior.h"
diff -rNu3 gdb-4.5.org/glob/sysdep-obsd.h gdb-4.5/glob/sysdep-obsd.h
--- gdb-4.5.org/glob/sysdep-obsd.h	Sat Nov 23 10:54:31 1991
+++ gdb-4.5/glob/sysdep-obsd.h	Thu Apr 16 15:56:33 1992
@@ -7,5 +7,7 @@
X extern char *alloca ();
X #endif
X 
+#include <sys/types.h>
+
X #include <sys/dir.h>
X typedef struct direct dirent;
diff -rNu3 gdb-4.5.org/readline/sysdep-obsd.h gdb-4.5/readline/sysdep-obsd.h
--- gdb-4.5.org/readline/sysdep-obsd.h	Sat Nov 23 10:49:40 1991
+++ gdb-4.5/readline/sysdep-obsd.h	Thu Apr 16 15:48:26 1992
@@ -7,5 +7,7 @@
X extern char *alloca ();
X #endif
X 
+#include <sys/types.h>
+
X #include <sys/dir.h>
X typedef struct direct dirent;
SHAR_EOF
chmod 0644 news.diff ||
echo 'restore of news.diff failed'
Wc_c="`wc -c < 'news.diff'`"
test 7011 -eq "$Wc_c" ||
	echo 'news.diff: original size 7011, current size' "$Wc_c"
fi
exit 0

Newsgroups: gnu.gdb.bug