#include <asm/reg.h>
#else
#include <machine/reg.h>
---- gdb-5.3/gdb/gdbserver/utils.c.orig 2003-08-20 08:34:18.000000000 -0600
-+++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:35:00.000000000 -0600
-@@ -40,9 +40,8 @@
+diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c
+--- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c 2002-07-09 11:38:58.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/gdbreplay.c 2003-08-20 08:44:20.000000000 -0600
+@@ -54,14 +54,15 @@
+ perror_with_name (char *string)
+ {
+ #ifndef STDC_HEADERS
+- extern int sys_nerr;
+ extern char *sys_errlist[];
+ extern int errno;
+ #endif
+ const char *err;
+ char *combined;
+
+- err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";
++ err = strerror (errno);
++ if (err == NULL)
++ err = "unknown error";
+ combined = (char *) alloca (strlen (err) + strlen (string) + 3);
+ strcpy (combined, string);
+ strcat (combined, ": ");
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c
+--- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-hppabsd.c 2003-08-20 08:46:04.000000000 -0600
+@@ -61,7 +61,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c
+--- gdb-5.3/gdb/gdbserver.orig/low-lynx.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-lynx.c 2003-08-20 08:46:18.000000000 -0600
+@@ -79,7 +79,7 @@
+
+ fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n",
+ getpid (), program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c
+--- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-nbsd.c 2003-08-20 08:46:27.000000000 -0600
+@@ -137,7 +137,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c
+--- gdb-5.3/gdb/gdbserver.orig/low-sparc.c 2002-01-17 14:13:50.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-sparc.c 2003-08-20 08:46:38.000000000 -0600
+@@ -44,7 +44,6 @@
+ #include <sys/ptrace.h>
+ #include <sys/reg.h>
+
+-extern int sys_nerr;
+ extern char **sys_errlist;
+ extern int errno;
+
+@@ -67,7 +66,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c
+--- gdb-5.3/gdb/gdbserver.orig/low-sun3.c 2002-01-17 14:13:50.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-sun3.c 2003-08-20 08:46:51.000000000 -0600
+@@ -41,7 +41,6 @@
+ #include <sys/ptrace.h>
+ #include <machine/reg.h>
+
+-extern int sys_nerr;
+ extern char **sys_errlist;
+ extern int errno;
+
+@@ -64,7 +63,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c
+--- gdb-5.3/gdb/gdbserver.orig/utils.c 2003-08-20 08:47:56.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:48:15.000000000 -0600
+@@ -33,16 +33,13 @@
+ perror_with_name (char *string)
+ {
+ #ifndef STDC_HEADERS
+- extern int sys_nerr;
+- extern char *sys_errlist[];
+ extern int errno;
+ #endif
const char *err;
char *combined;
err = "unknown error";
combined = (char *) alloca (strlen (err) + strlen (string) + 3);
+diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig
+--- gdb-5.3/gdb/gdbserver.orig/linux-low.c 2003-08-20 08:40:27.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/linux-low.c 2003-08-20 08:44:54.000000000 -0600
+@@ -175,8 +175,7 @@
+ if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
+ {
+ fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error",
+- errno);
++ strerror (errno), errno);
+ fflush (stderr);
+
+ /* If we fail to attach to an LWP, just return. */
+