diff -u -r -N gdb-5.0/gdb/alpha-nat.c gdb-5.0-osf51/gdb/alpha-nat.c
--- gdb-5.0/gdb/alpha-nat.c	Wed Oct  6 01:07:58 1999
+++ gdb-5.0-osf51/gdb/alpha-nat.c	Sun Apr  1 20:25:02 2001
@@ -27,7 +27,7 @@
 #include <asm/reg.h>
 #include <alpha/ptrace.h>
 #else
-#include <machine/reg.h>
+#include <machine/coreregs.h>
 #endif
 #include <sys/user.h>
 
@@ -101,16 +101,16 @@
      The floating point register values are garbage in OSF/1.2 core files.  */
   static int core_reg_mapping[NUM_REGS] =
   {
-#define EFL (EF_SIZE / 8)
-    EF_V0, EF_T0, EF_T1, EF_T2, EF_T3, EF_T4, EF_T5, EF_T6,
-    EF_T7, EF_S0, EF_S1, EF_S2, EF_S3, EF_S4, EF_S5, EF_S6,
-    EF_A0, EF_A1, EF_A2, EF_A3, EF_A4, EF_A5, EF_T8, EF_T9,
-    EF_T10, EF_T11, EF_RA, EF_T12, EF_AT, EF_GP, EF_SP, -1,
+#define EFL (NCF_REGS)
+    CF_V0, CF_T0, CF_T1, CF_T2, CF_T3, CF_T4, CF_T5, CF_T6,
+    CF_T7, CF_S0, CF_S1, CF_S2, CF_S3, CF_S4, CF_S5, CF_S6,
+    CF_A0, CF_A1, CF_A2, CF_A3, CF_A4, CF_A5, CF_T8, CF_T9,
+    CF_T10, CF_T11, CF_RA, CF_T12, CF_AT, CF_GP, CF_SP, -1,
     EFL + 0, EFL + 1, EFL + 2, EFL + 3, EFL + 4, EFL + 5, EFL + 6, EFL + 7,
     EFL + 8, EFL + 9, EFL + 10, EFL + 11, EFL + 12, EFL + 13, EFL + 14, EFL + 15,
     EFL + 16, EFL + 17, EFL + 18, EFL + 19, EFL + 20, EFL + 21, EFL + 22, EFL + 23,
     EFL + 24, EFL + 25, EFL + 26, EFL + 27, EFL + 28, EFL + 29, EFL + 30, EFL + 31,
-    EF_PC, -1
+    CF_PC, -1
   };
   static char zerobuf[MAX_REGISTER_RAW_SIZE] =
   {0};
diff -u -r -N gdb-5.0/gdb/config/alpha/alpha-osf51.mh gdb-5.0-osf51/gdb/config/alpha/alpha-osf51.mh
--- gdb-5.0/gdb/config/alpha/alpha-osf51.mh	Thu Jan  1 01:00:00 1970
+++ gdb-5.0-osf51/gdb/config/alpha/alpha-osf51.mh	Sun Apr  1 20:25:02 2001
@@ -0,0 +1,7 @@
+# Host: Little-endian Alpha running OSF/5.1 and higher using procfs
+XDEPFILES=
+XM_FILE= xm-alphaosf.h
+NAT_FILE= nm-osf51.h
+NATDEPFILES= infptrace.o inftarg.o corelow.o alpha-nat.o fork-child.o \
+       osfsolib.o procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o
+
diff -u -r -N gdb-5.0/gdb/config/alpha/nm-osf51.h gdb-5.0-osf51/gdb/config/alpha/nm-osf51.h
--- gdb-5.0/gdb/config/alpha/nm-osf51.h	Thu Jan  1 01:00:00 1970
+++ gdb-5.0-osf51/gdb/config/alpha/nm-osf51.h	Sun Apr  1 20:25:02 2001
@@ -0,0 +1,29 @@
+/* Native definitions for alpha running OSF/5.1 and higher, using procfs.
+   Copyright (C) 1995 Free Software Foundation, Inc.
+
+   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., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include "alpha/nm-osf3.h"
+
+/* implementation of the loader changed against osf3
+
+   The link_map list in the loader has slight changes:
+   - the modinfo_addr isn't set.
+   - the first two modules should be ignored, instead of only the first one.
+*/
+#define LDR_OSF51
diff -u -r -N gdb-5.0/gdb/configure.host gdb-5.0-osf51/gdb/configure.host
--- gdb-5.0/gdb/configure.host	Mon May  1 18:30:55 2000
+++ gdb-5.0-osf51/gdb/configure.host	Sun Apr  1 20:25:57 2001
@@ -32,7 +32,9 @@
 
 alpha*-*-osf1*)		gdb_host=alpha-osf1 ;;
 alpha*-*-osf2*)		gdb_host=alpha-osf2 ;;
-alpha*-*-osf[3456789]*)	gdb_host=alpha-osf3 ;;
+alpha*-*-osf[34]*)     gdb_host=alpha-osf3 ;;
+alpha*-*-osf5.0)        gdb_host=alpha-osf3 ;;
+alpha*-*-osf*)          gdb_host=alpha-osf51 ;;
 alpha*-*-linux*)	gdb_host=alpha-linux ;;
 
 arm*-*-linux*)		gdb_host=linux ;;
diff -u -r -N gdb-5.0/gdb/osfsolib.c gdb-5.0-osf51/gdb/osfsolib.c
--- gdb-5.0/gdb/osfsolib.c	Tue Apr  4 04:08:52 2000
+++ gdb-5.0-osf51/gdb/osfsolib.c	Sun Apr  1 20:25:02 2001
@@ -394,6 +394,12 @@
 			     (char *) &next_lm.module_info,
 			     sizeof (ldr_module_info_t)) != 0)
     return lm;
+#ifdef LDR_OSF51
+  /* modinfo_addr isn't set, so do it by hand */
+  next_lm.module_info.modinfo_addr = so_list_ptr->lm.module_info.next;
+  if(next_lm.module_info.module_id == 2) /* ignore first two modules */
+    next_lm.module_info.module_name = NULL;
+#endif
 
   lm = &next_lm;
   lm->l_name = lm->module_info.module_name;
diff -u -r -N gdb-5.0/gdb/symtab.c gdb-5.0-osf51/gdb/symtab.c
--- gdb-5.0/gdb/symtab.c	Tue Apr  4 04:08:52 2000
+++ gdb-5.0-osf51/gdb/symtab.c	Sun Apr  1 20:25:02 2001
@@ -4410,6 +4410,26 @@
   if (sal.line == 0)
     goto nosyms;
 
+#ifdef TM_ALPHA_H
+
+  /* N.B.: If the `sal' we got does not belong to the pc's
+     function we fetch the following `sal'. This is actually
+     a work around a bug in egcs-1.1.[12] since this compiler
+     generates bad line number info for alpha-dec-osf targets. */
+
+  if ((sal.pc < func_addr) || (sal.pc > sal.end))
+    {
+      sal.line = 0;
+
+      if (sal.end < func_end)
+        sal = find_pc_line (sal.end, 0);
+
+      if (sal.line == 0)
+        goto nosyms;
+    }
+
+#endif
+
   /* sal.end is the address of the first instruction past sal.line. */
   if (sal.end > func_addr
       && sal.end <= func_end)	/* Is prologue in function? */
