diff options
author | Fred Fish <fnf@specifix.com> | 1992-04-22 16:46:47 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1992-04-22 16:46:47 +0000 |
commit | 4ace50a5102f0839b7838993401520d90ee268d2 (patch) | |
tree | 632965d9d3c1131a7174ae6ce02f5bbe673fba60 /gdb | |
parent | be2d8c134a174732a53bb6b6e2d4095054c18897 (diff) | |
download | gdb-4ace50a5102f0839b7838993401520d90ee268d2.zip gdb-4ace50a5102f0839b7838993401520d90ee268d2.tar.gz gdb-4ace50a5102f0839b7838993401520d90ee268d2.tar.bz2 |
Remove now obsolete signame.c and signame.h; functionality is handled by
libiberty/strsignal.c. Widespread changes to use libiberty/strerror.c
functions for errno manipulations and libiberty/strsignal.c for signo
(signals) manipulations.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 64 | ||||
-rw-r--r-- | gdb/Makefile.in | 8 | ||||
-rw-r--r-- | gdb/convex-tdep.c | 4 | ||||
-rw-r--r-- | gdb/convex-xdep.c | 5 | ||||
-rw-r--r-- | gdb/core.c | 14 | ||||
-rwxr-xr-x | gdb/depend | 9 | ||||
-rw-r--r-- | gdb/i960-tdep.c | 4 | ||||
-rw-r--r-- | gdb/mach386-xdep.c | 1 | ||||
-rw-r--r-- | gdb/procfs.c | 421 | ||||
-rw-r--r-- | gdb/stuff.c | 24 | ||||
-rw-r--r-- | gdb/sun386-xdep.c | 6 | ||||
-rw-r--r-- | gdb/umax-xdep.c | 5 | ||||
-rw-r--r-- | gdb/utils.c | 62 | ||||
-rw-r--r-- | gdb/valprint.c | 37 | ||||
-rw-r--r-- | gdb/xm-apollo68v.h | 3 | ||||
-rw-r--r-- | gdb/xm-ultra3.h | 3 |
16 files changed, 193 insertions, 477 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9a00f65..a920f52 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,67 @@ +Wed Apr 22 09:42:15 1992 Fred Fish (fnf@cygnus.com) + + * signame.c, signame.h: Remove, replaced by strsignal.c in + libiberty. + * i960-tdep.c, infrun.c, mach386-xdep.c, procfs.c, sparc-tdep.c, + sun386-xdep.c: Remove include of signame.h + * Makefile.in (SFILES_MAINDIR): Remove signame.c + * Makefile.in (HFILES): Remove signame.h + * Makefile.in (OBS): Remove signame.o + * defs.h (safe_strerror, safe_strsignal, strerrno, strsigno, + errno_max, signo_max, strtoerrno, strtosigno, strsignal, + psignal, perror): Add prototypes. + * defs.h, xm-apollo68v.h, xm-ultra3.h (SYS_SIGLIST_MISSING): + Remove define. + * depend: Manually remove signame.[cho] references. + * convex-tdep.c (subsig_name): Replace use of sys_siglist with + strsignal. + * convex-xdep.c (core_file_command): Replace use of sys_siglist + with safe_strsignal. + * core.c (core_open): Replace use of sys_siglist with + safe_strsignal. + * core.c (memory_error): Replace use of sys_errlist with + safe_strerror. + * i960-tdep.c (print_fault): Replace use of sys_siglist with + safe_strsignal. + * infcmd.c (program_info): Replace use of sys_siglist with + safe_strsignal. + * infrun.c (signal_stop, signal_print, signal_program): + Allocate dynamically based on dynamic determination of number + of signals to support. + * infrun.c (child_create_inferior): Replace use of sys_errlist + with safe_strerror. + * infrun.c (wait_for_inferior): Replace use of sys_siglist with + safe_strsignal. + * infrun.c (sig_print_info): Replace use of sig_abbrev with + strsigno and sys_siglist with safe_strsignal. + * infrun.c (handle_command): Call signo_max to find number of + signals. Replace sig_number with strtosigno and sig_abbrev with + strsigno. + * infrun.c (signals_info): Replace sig_number with strtosigno. + * infrun.c (_initialize_infrun): Call signo_max to find number of + signals. Dynamically allocate signal_{stop,print,program}. + * procfs.c (errno_table): Remove, now in libiberty/strerror.c. + * procfs.c (errnoname): Add function and prototype. + * procfs.c (info_proc_siginfo): Call errnoname, replace use + of sys_siglist with safe_strsignal. + * procfs.c (info_proc_stop, info_proc_signals): Replace use of + sys_siglist with safe_strsignal. + * procfs.c (info_proc_stop): Call errnoname. + * procfs.c (signalname): Replace sig_abbrev with strsigno. + * stuff.c (main, get_offset): Replace use of sys_errlist with + strerror. + * sun386-xdep.c (core_file_command): Replace use of sys_siglist + with safe_strsignal. + * umax-xdep.c (core_file_command): Replace use of sys_siglist + with safe_strsignal. + * utils.c (safe_strerror, safe_strsignal): Add functions that + call strerror and strsignal respectively, and deal with NULL + returns. + * utils.c (perror_with_name, print_sys_errmsg): Replace use of + sys_errlist with safe_strerror. + * valprint.c (val_print): Replace use of sys_errlist with + safe_strerror. + Tue Apr 21 12:00:47 1992 K. Richard Pixley (rich@cygnus.com) * Makefile.in: rework CFLAGS so that they can be set from the diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 7b4a2d6..dfbeaa0 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -184,7 +184,7 @@ SFILES_MAINDIR = \ main.c printcmd.c gdbtypes.c \ remote.c source.c stack.c symmisc.c symtab.c symfile.c \ utils.c valarith.c valops.c valprint.c values.c c-exp.y m2-exp.y \ - signame.c cplus-dem.c mem-break.c target.c inftarg.c \ + cplus-dem.c mem-break.c target.c inftarg.c \ dbxread.c coffread.c elfread.c dwarfread.c xcoffread.c \ ieee-float.c language.c parse.c buildsym.c objfiles.c \ minsyms.c mipsread.c @@ -232,7 +232,7 @@ SFILES_KGDB = $(SFILES) stuff.c kdb-start.c HFILES= breakpoint.h buildsym.h call-cmds.h command.h defs.h environ.h \ expression.h frame.h gdbcmd.h gdbcore.h gdbtypes.h \ ieee-float.h inferior.h minimon.h objfiles.h partial-stab.h \ - signals.h signame.h symfile.h symtab.h solib.h xcoffsolib.h \ + signals.h symfile.h symtab.h solib.h xcoffsolib.h \ target.h terminal.h tm-68k.h tm-i960.h tm-sunos.h tm-sysv4.h \ xm-m68k.h xm-sysv4.h language.h parser-defs.h value.h xm-vax.h @@ -270,7 +270,7 @@ OBS = main.o blockframe.o breakpoint.o findvar.o stack.o source.o \ values.o eval.o valops.o valarith.o valprint.o printcmd.o \ symtab.o symfile.o symmisc.o infcmd.o infrun.o remote.o \ command.o utils.o expprint.o environ.o version.o gdbtypes.o \ - copying.o $(DEPFILES) signame.o cplus-dem.o mem-break.o target.o \ + copying.o $(DEPFILES) cplus-dem.o mem-break.o target.o \ inftarg.o ieee-float.o putenv.o parse.o language.o $(YYOBJ) \ buildsym.o objfiles.o minsyms.o \ dbxread.o coffread.o elfread.o dwarfread.o xcoffread.o mipsread.o @@ -539,7 +539,7 @@ make-proto-gdb-1: ${TARFILES} ${TARDIRS} gdb.info chmod og=u `find . -print` clean: - rm -f *.o ${ADD_FILES} + rm -f *.o ${ADD_FILES} *~ rm -f init.c version.c rm -f gdb core gdb.tar gdb.tar.Z make.log rm -f gdb[0-9] diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c index 774bbcb..ac213ae 100644 --- a/gdb/convex-tdep.c +++ b/gdb/convex-tdep.c @@ -664,8 +664,10 @@ subsig_name (signo, subcode) {0, 0, 0, 0, subsig4, subsig5, 0, 0, subsig8, 0, subsig10, subsig11, 0}; int i; - char *p = signo < NSIG ? sys_siglist[signo] : "unknown"; + char *p; + if ((p = strsignal (signo)) == NULL) + p = "unknown"; if (signo >= (sizeof subsig_list / sizeof *subsig_list) || !subsig_list[signo]) return p; diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c index c078d9e..6bd57ab 100644 --- a/gdb/convex-xdep.c +++ b/gdb/convex-xdep.c @@ -212,7 +212,6 @@ static void psw_info (); static sig_noop (); static ptr_cmp (); -extern char *sys_siglist[]; /* Execute ptrace. Convex V7 replaced ptrace with pattach. Allow ptrace (0) as a no-op. */ @@ -950,9 +949,7 @@ core_file_command (filename, from_tty) printf_filtered ("thread %d received signal %d, %s\n", n, thread_signal[n], - thread_signal[n] < NSIG - ? sys_siglist[thread_signal[n]] - : "(undocumented)"); + safe_strsignal (thread_signal[n])); } /* Select an interesting thread -- also-rans died with SIGKILL, @@ -49,10 +49,6 @@ get_core_registers PARAMS ((int)); static void core_files_info PARAMS ((struct target_ops *)); -extern int sys_nerr; -extern char *sys_errlist[]; -extern char *sys_siglist[]; - extern char registers[]; /* Hook for `exec_file_command' command to call. */ @@ -176,7 +172,7 @@ core_open (filename, from_tty) siggy = bfd_core_file_failing_signal (core_bfd); if (siggy > 0) printf ("Program terminated with signal %d, %s.\n", siggy, - siggy < NSIG ? sys_siglist[siggy] : "(undocumented)"); + safe_strsignal (siggy)); if (ontop) { /* Fetch all registers from core file */ @@ -312,12 +308,8 @@ memory_error (status, memaddr) } else { - if (status >= sys_nerr || status < 0) - error ("Error accessing memory address %s: unknown error (%d).", - local_hex_string(memaddr), status); - else - error ("Error accessing memory address %s: %s.", - local_hex_string(memaddr), sys_errlist[status]); + error ("Error accessing memory address %s: %s.", + local_hex_string (memaddr), safe_strerror (status)); } } @@ -98,7 +98,7 @@ i387-tdep.o : i387-tdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.sta i960-pinsn.o : i960-pinsn.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h \ inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h expression.h i960-tdep.o : i960-tdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h \ - ${srcdir}/../include/obstack.h value.h gdbtypes.h expression.h frame.h signame.h ieee-float.h + ${srcdir}/../include/obstack.h value.h gdbtypes.h expression.h frame.h ieee-float.h ieee-float.o : ieee-float.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status ieee-float.h infcmd.o : infcmd.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h ${srcdir}/../include/obstack.h \ gdbtypes.h frame.h inferior.h breakpoint.h value.h expression.h environ.h gdbcmd.h \ @@ -111,7 +111,7 @@ infptrace.o : infptrace.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.sta target.h ${srcdir}/../include/bfd.h gdbcore.h infrun.o : infrun.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h ${srcdir}/../include/obstack.h \ frame.h inferior.h breakpoint.h value.h gdbtypes.h expression.h ${srcdir}/../include/wait.h \ - gdbcore.h ${srcdir}/../include/bfd.h signame.h command.h terminal.h target.h + gdbcore.h ${srcdir}/../include/bfd.h command.h terminal.h target.h inftarg.o : inftarg.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h inferior.h \ symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h expression.h \ target.h ${srcdir}/../include/bfd.h ${srcdir}/../include/wait.h gdbcore.h ieee-float.h @@ -135,7 +135,7 @@ m88k-xdep.o : m88k-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.sta gdbcore.h ${srcdir}/../include/bfd.h /usr/include/setjmp.h mach386-xdep.o : mach386-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h \ inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h expression.h \ - signame.h gdbcore.h ${srcdir}/../include/bfd.h + gdbcore.h ${srcdir}/../include/bfd.h main.o : main.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status gdbcmd.h command.h \ call-cmds.h symtab.h ${srcdir}/../include/obstack.h inferior.h breakpoint.h frame.h \ value.h gdbtypes.h expression.h signals.h target.h ${srcdir}/../include/bfd.h language.h \ @@ -213,7 +213,6 @@ rs6000-tdep.o : rs6000-tdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config rs6000-xdep.o : rs6000-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h \ inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h expression.h \ target.h ${srcdir}/../include/bfd.h -signame.o : signame.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status signame.h solib.o : solib.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status symtab.h ${srcdir}/../include/obstack.h \ ${srcdir}/../include/bfd.h symfile.h objfiles.h gdbcore.h command.h target.h frame.h \ regex.h inferior.h breakpoint.h value.h gdbtypes.h expression.h @@ -225,7 +224,7 @@ sparc-pinsn.o : sparc-pinsn.c defs.h ${srcdir}/../include/ansidecl.h xm.h config /usr/include/string.h target.h sparc-tdep.o : sparc-tdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm.h config.status frame.h \ inferior.h symtab.h ${srcdir}/../include/obstack.h breakpoint.h value.h gdbtypes.h expression.h \ - signame.h target.h ${srcdir}/../include/bfd.h ieee-float.h gdbcore.h + target.h ${srcdir}/../include/bfd.h ieee-float.h gdbcore.h sparc-xdep.o : sparc-xdep.c defs.h ${srcdir}/../include/ansidecl.h xm.h config.status tm-sparc.h inferior.h \ symtab.h ${srcdir}/../include/obstack.h breakpoint.h frame.h value.h gdbtypes.h expression.h \ target.h ${srcdir}/../include/bfd.h gdbcore.h diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c index 35c145d..eab040a 100644 --- a/gdb/i960-tdep.c +++ b/gdb/i960-tdep.c @@ -27,7 +27,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "symtab.h" #include "value.h" #include "frame.h" -#include "signame.h" #include "ieee-float.h" /* Structure of i960 extended floating point format. */ @@ -619,8 +618,7 @@ print_fault( siggnal ) if (siggnal < NSIG) { printf ("\nProgram received signal %d, %s\n", - siggnal, - sys_siglist[siggnal]); + siggnal, safe_strsignal (siggnal)); } else { /* The various target_wait()s bias the 80960 "signal number" by adding NSIG to it, so it won't get confused with any diff --git a/gdb/mach386-xdep.c b/gdb/mach386-xdep.c index b12cf5a..1077785 100644 --- a/gdb/mach386-xdep.c +++ b/gdb/mach386-xdep.c @@ -20,7 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "frame.h" #include "inferior.h" -#include "signame.h" #include "gdbcore.h" #if defined (GDB_TARGET_IS_MACH386) diff --git a/gdb/procfs.c b/gdb/procfs.c index a53a451..6da85a7 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -43,7 +43,6 @@ regardless of whether or not the actual target has floating point hardware. #include "inferior.h" #include "target.h" -#include "signame.h" #define MAX_SYSCALLS 256 /* Maximum number of syscalls for table */ @@ -338,380 +337,6 @@ static struct sigcode { 0, 0, NULL, NULL }; -/* Translation table for errno values. See intro(2) in most UNIX systems - Programmers Reference Manuals. - - Note that some systems provide a function (strerror) that returns the - error message string, or a global variable that is the base address of the - array of character pointers. Perhaps we should try to make use of these - provided strings if they are present, but at least this is more portable. - (FIXME?) */ - -static struct trans errno_table[] = -{ -#if defined (EPERM) - EPERM, "EPERM", "Not super-user", -#endif -#if defined (ENOENT) - ENOENT, "ENOENT", "No such file or directory", -#endif -#if defined (ESRCH) - ESRCH, "ESRCH", "No such process", -#endif -#if defined (EINTR) - EINTR, "EINTR", "Interrupted system call", -#endif -#if defined (EIO) - EIO, "EIO", "I/O error", -#endif -#if defined (ENXIO) - ENXIO, "ENXIO", "No such device or address", -#endif -#if defined (E2BIG) - E2BIG, "E2BIG", "Arg list too long", -#endif -#if defined (ENOEXEC) - ENOEXEC, "ENOEXEC", "Exec format error", -#endif -#if defined (EBADF) - EBADF, "EBADF", "Bad file number", -#endif -#if defined (ECHILD) - ECHILD, "ECHILD", "No child process", -#endif -#if defined (EAGAIN) - EAGAIN, "EAGAIN", "No more processes", -#endif -#if defined (ENOMEM) - ENOMEM, "ENOMEM", "Not enough space", -#endif -#if defined (EACCES) - EACCES, "EACCES", "Permission denied", -#endif -#if defined (EFAULT) - EFAULT, "EFAULT", "Bad address", -#endif -#if defined (ENOTBLK) - ENOTBLK, "ENOTBLK", "Block device required", -#endif -#if defined (EBUSY) - EBUSY, "EBUSY", "Device busy", -#endif -#if defined (EEXIST) - EEXIST, "EEXIST", "File exists", -#endif -#if defined (EXDEV) - EXDEV, "EXDEV", "Cross-device link", -#endif -#if defined (ENODEV) - ENODEV, "ENODEV", "No such device", -#endif -#if defined (ENOTDIR) - ENOTDIR, "ENOTDIR", "Not a directory", -#endif -#if defined (EISDIR) - EISDIR, "EISDIR", "Is a directory", -#endif -#if defined (EINVAL) - EINVAL, "EINVAL", "Invalid argument", -#endif -#if defined (ENFILE) - ENFILE, "ENFILE", "File table overflow", -#endif -#if defined (EMFILE) - EMFILE, "EMFILE", "Too many open files", -#endif -#if defined (ENOTTY) - ENOTTY, "ENOTTY", "Not a typewriter", -#endif -#if defined (ETXTBSY) - ETXTBSY, "ETXTBSY", "Text file busy", -#endif -#if defined (EFBIG) - EFBIG, "EFBIG", "File too large", -#endif -#if defined (ENOSPC) - ENOSPC, "ENOSPC", "No space left on device", -#endif -#if defined (ESPIPE) - ESPIPE, "ESPIPE", "Illegal seek", -#endif -#if defined (EROFS) - EROFS, "EROFS", "Read only file system", -#endif -#if defined (EMLINK) - EMLINK, "EMLINK", "Too many links", -#endif -#if defined (EPIPE) - EPIPE, "EPIPE", "Broken pipe", -#endif -#if defined (EDOM) - EDOM, "EDOM", "Math argument out of domain of func", -#endif -#if defined (ERANGE) - ERANGE, "ERANGE", "Math result not representable", -#endif -#if defined (ENOMSG) - ENOMSG, "ENOMSG", "No message of desired type", -#endif -#if defined (EIDRM) - EIDRM, "EIDRM", "Identifier removed", -#endif -#if defined (ECHRNG) - ECHRNG, "ECHRNG", "Channel number out of range", -#endif -#if defined (EL2NSYNC) - EL2NSYNC, "EL2NSYNC", "Level 2 not synchronized", -#endif -#if defined (EL3HLT) - EL3HLT, "EL3HLT", "Level 3 halted", -#endif -#if defined (EL3RST) - EL3RST, "EL3RST", "Level 3 reset", -#endif -#if defined (ELNRNG) - ELNRNG, "ELNRNG", "Link number out of range", -#endif -#if defined (EUNATCH) - EUNATCH, "EUNATCH", "Protocol driver not attached", -#endif -#if defined (ENOCSI) - ENOCSI, "ENOCSI", "No CSI structure available", -#endif -#if defined (EL2HLT) - EL2HLT, "EL2HLT", "Level 2 halted", -#endif -#if defined (EDEADLK) - EDEADLK, "EDEADLK", "Deadlock condition", -#endif -#if defined (ENOLCK) - ENOLCK, "ENOLCK", "No record locks available", -#endif -#if defined (EBADE) - EBADE, "EBADE", "Invalid exchange", -#endif -#if defined (EBADR) - EBADR, "EBADR", "Invalid request descriptor", -#endif -#if defined (EXFULL) - EXFULL, "EXFULL", "Exchange full", -#endif -#if defined (ENOANO) - ENOANO, "ENOANO", "No anode", -#endif -#if defined (EBADRQC) - EBADRQC, "EBADRQC", "Invalid request code", -#endif -#if defined (EBADSLT) - EBADSLT, "EBADSLT", "Invalid slot", -#endif -#if defined (EDEADLOCK) - EDEADLOCK, "EDEADLOCK", "File locking deadlock error", -#endif -#if defined (EBFONT) - EBFONT, "EBFONT", "Bad font file fmt", -#endif -#if defined (ENOSTR) - ENOSTR, "ENOSTR", "Device not a stream", -#endif -#if defined (ENODATA) - ENODATA, "ENODATA", "No data available", -#endif -#if defined (ETIME) - ETIME, "ETIME", "Timer expired", -#endif -#if defined (ENOSR) - ENOSR, "ENOSR", "Out of streams resources", -#endif -#if defined (ENONET) - ENONET, "ENONET", "Machine is not on the network", -#endif -#if defined (ENOPKG) - ENOPKG, "ENOPKG", "Package not installed", -#endif -#if defined (EREMOTE) - EREMOTE, "EREMOTE", "Object is remote", -#endif -#if defined (ENOLINK) - ENOLINK, "ENOLINK", "Link has been severed", -#endif -#if defined (EADV) - EADV, "EADV", "Advertise error", -#endif -#if defined (ESRMNT) - ESRMNT, "ESRMNT", "Srmount error", -#endif -#if defined (ECOMM) - ECOMM, "ECOMM", "Communication error on send", -#endif -#if defined (EPROTO) - EPROTO, "EPROTO", "Protocol error", -#endif -#if defined (EMULTIHOP) - EMULTIHOP, "EMULTIHOP", "Multihop attempted", -#endif -#if defined (EDOTDOT) - EDOTDOT, "EDOTDOT", "RFS specific error", -#endif -#if defined (EBADMSG) - EBADMSG, "EBADMSG", "Not a data message", -#endif -#if defined (ENAMETOOLONG) - ENAMETOOLONG, "ENAMETOOLONG", "File name too long", -#endif -#if defined (EOVERFLOW) - EOVERFLOW, "EOVERFLOW", "Value too large for defined data type", -#endif -#if defined (ENOTUNIQ) - ENOTUNIQ, "ENOTUNIQ", "Name not unique on network", -#endif -#if defined (EBADFD) - EBADFD, "EBADFD", "File descriptor in bad state", -#endif -#if defined (EREMCHG) - EREMCHG, "EREMCHG", "Remote address changed", -#endif -#if defined (ELIBACC) - ELIBACC, "ELIBACC", "Cannot access a needed shared library", -#endif -#if defined (ELIBBAD) - ELIBBAD, "ELIBBAD", "Accessing a corrupted shared library", -#endif -#if defined (ELIBSCN) - ELIBSCN, "ELIBSCN", ".lib section in a.out corrupted", -#endif -#if defined (ELIBMAX) - ELIBMAX, "ELIBMAX", "Attempting to link in too many shared libraries", -#endif -#if defined (ELIBEXEC) - ELIBEXEC, "ELIBEXEC", "Cannot exec a shared library directly", -#endif -#if defined (EILSEQ) - EILSEQ, "EILSEQ", "Illegal byte sequence", -#endif -#if defined (ENOSYS) - ENOSYS, "ENOSYS", "Operation not applicable", -#endif -#if defined (ELOOP) - ELOOP, "ELOOP", "Too many symbolic links encountered", -#endif -#if defined (ERESTART) - ERESTART, "ERESTART", "Interrupted system call should be restarted", -#endif -#if defined (ESTRPIPE) - ESTRPIPE, "ESTRPIPE", "Streams pipe error", -#endif -#if defined (ENOTEMPTY) - ENOTEMPTY, "ENOTEMPTY", "Directory not empty", -#endif -#if defined (EUSERS) - EUSERS, "EUSERS", "Too many users", -#endif -#if defined (ENOTSOCK) - ENOTSOCK, "ENOTSOCK", "Socket operation on non-socket", -#endif -#if defined (EDESTADDRREQ) - EDESTADDRREQ, "EDESTADDRREQ", "Destination address required", -#endif -#if defined (EMSGSIZE) - EMSGSIZE, "EMSGSIZE", "Message too long", -#endif -#if defined (EPROTOTYPE) - EPROTOTYPE, "EPROTOTYPE", "Protocol wrong type for socket", -#endif -#if defined (ENOPROTOOPT) - ENOPROTOOPT, "ENOPROTOOPT", "Protocol not available", -#endif -#if defined (EPROTONOSUPPORT) - EPROTONOSUPPORT, "EPROTONOSUPPORT", "Protocol not supported", -#endif -#if defined (ESOCKTNOSUPPORT) - ESOCKTNOSUPPORT, "ESOCKTNOSUPPORT", "Socket type not supported", -#endif -#if defined (EOPNOTSUPP) - EOPNOTSUPP, "EOPNOTSUPP", "Operation not supported on transport endpoint ", -#endif -#if defined (EPFNOSUPPORT) - EPFNOSUPPORT, "EPFNOSUPPORT", "Protocol family not supported", -#endif -#if defined (EAFNOSUPPORT) - EAFNOSUPPORT, "EAFNOSUPPORT", "Address family not supported by protocol", -#endif -#if defined (EADDRINUSE) - EADDRINUSE, "EADDRINUSE", "Address already in use", -#endif -#if defined (EADDRNOTAVAIL) - EADDRNOTAVAIL, "EADDRNOTAVAIL","Cannot assign requested address", -#endif -#if defined (ENETDOWN) - ENETDOWN, "ENETDOWN", "Network is down", -#endif -#if defined (ENETUNREACH) - ENETUNREACH, "ENETUNREACH", "Network is unreachable", -#endif -#if defined (ENETRESET) - ENETRESET, "ENETRESET", "Network dropped connection because of reset", -#endif -#if defined (ECONNABORTED) - ECONNABORTED, "ECONNABORTED", "Software caused connection abort", -#endif -#if defined (ECONNRESET) - ECONNRESET, "ECONNRESET", "Connection reset by peer", -#endif -#if defined (ENOBUFS) - ENOBUFS, "ENOBUFS", "No buffer space available", -#endif -#if defined (EISCONN) - EISCONN, "EISCONN", "Transport endpoint is already connected", -#endif -#if defined (ENOTCONN) - ENOTCONN, "ENOTCONN", "Transport endpoint is not connected", -#endif -#if defined (ESHUTDOWN) - ESHUTDOWN, "ESHUTDOWN", "Cannot send after transport endpoint shutdown", -#endif -#if defined (ETOOMANYREFS) - ETOOMANYREFS, "ETOOMANYREFS", "Too many references: cannot splice", -#endif -#if defined (ETIMEDOUT) - ETIMEDOUT, "ETIMEDOUT", "Connection timed out", -#endif -#if defined (ECONNREFUSED) - ECONNREFUSED, "ECONNREFUSED", "Connection refused", -#endif -#if defined (EHOSTDOWN) - EHOSTDOWN, "EHOSTDOWN", "Host is down", -#endif -#if defined (EHOSTUNREACH) - EHOSTUNREACH, "EHOSTUNREACH", "No route to host", -#endif -#if defined (EWOULDBLOCK) - EWOULDBLOCK, "EWOULDBLOCK", "Operation already in progress", -#endif -#if defined (EINPROGRESS) - EINPROGRESS, "EINPROGRESS", "Operation now in progress", -#endif -#if defined (ESTALE) - ESTALE, "ESTALE", "Stale NFS file handle", -#endif -#if defined (EUCLEAN) - EUCLEAN, "EUCLEAN", "Structure needs cleaning", -#endif -#if defined (ENOTNAM) - ENOTNAM, "ENOTNAM", "Not a XENIX named type file", -#endif -#if defined (ENAVAIL) - ENAVAIL, "ENAVAIL", "No XENIX semaphores available", -#endif -#if defined (EISNAM) - EISNAM, "EISNAM", "Is a named type file", -#endif -#if defined (EREMOTEIO) - EREMOTEIO, "EREMOTEIO", "Remote I/O error", -#endif - 0, NULL, NULL -}; - static char *syscall_table[MAX_SYSCALLS]; /* Prototypes for local functions */ @@ -728,6 +353,9 @@ syscallname PARAMS ((int)); static char * signalname PARAMS ((int)); +static char * +errnoname PARAMS ((int)); + static int proc_address_to_fd PARAMS ((CORE_ADDR, int)); @@ -2742,7 +2370,7 @@ info_proc_stop (pip, summary) else { printf_filtered ("\t%-16s %s.\n", signalname (what), - sys_siglist[what]); + safe_strsignal (what)); } break; case PR_SYSENTRY: @@ -2803,8 +2431,7 @@ info_proc_siginfo (pip, summary) printf_filtered ("%s ", signalname (sip -> si_signo)); if (sip -> si_errno > 0) { - printf_filtered ("%s ", lookupname (errno_table, - sip -> si_errno, "errno")); + printf_filtered ("%s ", errnoname (sip -> si_errno)); } if (sip -> si_code <= 0) { @@ -2837,13 +2464,12 @@ info_proc_siginfo (pip, summary) { printf_filtered ("\n\n"); printf_filtered ("\t%-16s %s.\n", signalname (sip -> si_signo), - sys_siglist[sip -> si_signo]); + safe_strsignal (sip -> si_signo)); if (sip -> si_errno > 0) { printf_filtered ("\t%-16s %s.\n", - lookupname (errno_table, - sip -> si_errno, "errno"), - lookupdesc (errno_table, sip -> si_errno)); + errnoname (sip -> si_errno), + safe_strerror (sip -> si_errno)); } if (sip -> si_code <= 0) { @@ -2954,17 +2580,36 @@ static char * signalname (signo) int signo; { - char *abbrev; + char *name; + static char locbuf[32]; + + name = strsigno (signo); + if (name == NULL) + { + sprintf (locbuf, "Signal %d", signo); + } + else + { + sprintf (locbuf, "%s (%d)", name, signo); + } + return (locbuf); +} + +static char * +errnoname (errnum) + int errnum; +{ + char *name; static char locbuf[32]; - abbrev = sig_abbrev (signo); - if (abbrev == NULL) + name = strerrno (errnum); + if (name == NULL) { - sprintf (locbuf, "signal %d", signo); + sprintf (locbuf, "Errno %d", errnum); } else { - sprintf (locbuf, "SIG%s (%d)", abbrev, signo); + sprintf (locbuf, "%s (%d)", name, errnum); } return (locbuf); } @@ -3000,7 +2645,7 @@ info_proc_signals (pip, summary) printf_filtered ("%-8s ", prismember (&pip -> prstatus.pr_sigpend, signo) ? "yes" : "no"); - printf_filtered (" %s\n", sys_siglist[signo]); + printf_filtered (" %s\n", safe_strsignal (signo)); } printf_filtered ("\n"); } diff --git a/gdb/stuff.c b/gdb/stuff.c index a28511d..c30f1df 100644 --- a/gdb/stuff.c +++ b/gdb/stuff.c @@ -26,8 +26,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <sys/file.h> #include <varargs.h> -extern char *sys_errlist[]; - main (argc, argv) int argc; char *argv[]; @@ -59,9 +57,9 @@ main (argc, argv) out_fd = open (outfile, O_WRONLY); if (out_fd < 0) - err ("Error opening %s for write: %s\n", outfile, sys_errlist[errno]); + err ("Error opening %s for write: %s\n", outfile, strerror (errno)); if (lseek (out_fd, offset, 0) < 0) - err ("Error seeking to heap in %s: %s\n", outfile, sys_errlist[errno]); + err ("Error seeking to heap in %s: %s\n", outfile, strerror (errno)); /* For each file listed on the command line, write it into the * 'heap' of the output file. Make sure to skip the arguments @@ -71,9 +69,10 @@ main (argc, argv) if (strcmp (argv[i], "-o") == 0) continue; if ((in_fd = open (argv[i], O_RDONLY)) < 0) - err ("Error opening %s for read: %s\n", argv[i], sys_errlist[errno]); + err ("Error opening %s for read: %s\n", argv[i], + strerror (errno)); if (fstat (in_fd, &stat_buf) < 0) - err ("Error stat'ing %s: %s\n", argv[i], sys_errlist[errno]); + err ("Error stat'ing %s: %s\n", argv[i], strerror (errno)); size = strlen (argv[i]); pad = 4 - (size & 3); size += pad + stat_buf.st_size + sizeof (int); @@ -105,9 +104,9 @@ get_offset (file, sym_name) f = open (file, O_RDONLY); if (f < 0) - err ("Error opening %s: %s\n", file, sys_errlist[errno]); + err ("Error opening %s: %s\n", file, strerror (errno)); if (read (f, &file_hdr, sizeof (file_hdr)) < 0) - err ("Error reading exec structure: %s\n", sys_errlist[errno]); + err ("Error reading exec structure: %s\n", strerror (errno)); if (N_BADMAG (file_hdr)) err ("File %s not an a.out file\n", file); @@ -115,17 +114,18 @@ get_offset (file, sym_name) if ((symbol_table = (struct nlist *)malloc (file_hdr.a_syms)) == 0) err ("Couldn't allocate space for symbol table\n"); if (lseek (f, N_SYMOFF (file_hdr), 0) == -1) - err ("lseek error: %s\n", sys_errlist[errno]); + err ("lseek error: %s\n", strerror (errno)); if (read (f, symbol_table, file_hdr.a_syms) == -1) - err ("Error reading symbol table from %s: %s\n", file, sys_errlist[errno]); + err ("Error reading symbol table from %s: %s\n", file, + strerror (errno)); /* read in string table */ if (read (f, &size, 4) == -1) - err ("reading string table size: %s\n", sys_errlist[errno]); + err ("reading string table size: %s\n", strerror (errno)); if ((strings = (char *)malloc (size)) == 0) err ("Couldn't allocate memory for string table\n"); if (read (f, strings, size - 4) == -1) - err ("reading string table: %s\n", sys_errlist[errno]); + err ("reading string table: %s\n", strerror (errno)); /* Find the core address at which the first byte of kdb text segment should be loaded into core when kdb is run. */ diff --git a/gdb/sun386-xdep.c b/gdb/sun386-xdep.c index 15f9d99..e241114 100644 --- a/gdb/sun386-xdep.c +++ b/gdb/sun386-xdep.c @@ -24,7 +24,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "defs.h" #include "frame.h" #include "inferior.h" -#include "signame.h" #include "gdbcore.h" #include <sys/param.h> @@ -186,10 +185,7 @@ core_file_command (filename, from_tty) printf ("Core file is from \"%s\".\n", corestr.c_cmdname); if (corestr.c_signo > 0) printf ("Program terminated with signal %d, %s.\n", - corestr.c_signo, - corestr.c_signo < NSIG - ? sys_siglist[corestr.c_signo] - : "(undocumented)"); + corestr.c_signo, safe_strsignal (corestr.c_signo)); } if (filename[0] == '/') corefile = savestring (filename, strlen (filename)); diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c index ce74023..31abfff 100644 --- a/gdb/umax-xdep.c +++ b/gdb/umax-xdep.c @@ -94,10 +94,7 @@ core_file_command (filename, from_tty) printf ("Core file is from \"%s\".\n", u.pt_comm); if (u.pt_signal > 0) printf ("Program terminated with signal %d, %s.\n", - u.pt_signal, - u.pt_signal < NSIG - ? sys_siglist[u.pt_signal] - : "(undocumented)"); + u.pt_signal, safe_strsignal (u.pt_signal)); /* Read the register values out of the core file and store them where `read_register' will find them. */ diff --git a/gdb/utils.c b/gdb/utils.c index e4e7bed..554cb6a 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -309,6 +309,45 @@ fatal_dump_core (va_alist) exit (1); } +/* The strerror() function can return NULL for errno values that are + out of range. Provide a "safe" version that always returns a + printable string. */ + +char * +safe_strerror (errnum) + int errnum; +{ + char *msg; + static char buf[32]; + + if ((msg = strerror (errnum)) == NULL) + { + sprintf (buf, "(undocumented errno %d)", errnum); + msg = buf; + } + return (msg); +} + +/* The strsignal() function can return NULL for signal values that are + out of range. Provide a "safe" version that always returns a + printable string. */ + +char * +safe_strsignal (signo) + int signo; +{ + char *msg; + static char buf[32]; + + if ((msg = strsignal (signo)) == NULL) + { + sprintf (buf, "(undocumented signal %d)", signo); + msg = buf; + } + return (msg); +} + + /* Print the system error message for errno, and also mention STRING as the file name for which the error was encountered. Then return to command level. */ @@ -317,16 +356,10 @@ void perror_with_name (string) char *string; { - extern int sys_nerr; - extern char *sys_errlist[]; char *err; char *combined; - if (errno < sys_nerr) - err = sys_errlist[errno]; - else - err = "unknown error"; - + err = safe_strerror (errno); combined = (char *) alloca (strlen (err) + strlen (string) + 3); strcpy (combined, string); strcat (combined, ": "); @@ -349,16 +382,10 @@ print_sys_errmsg (string, errcode) char *string; int errcode; { - extern int sys_nerr; - extern char *sys_errlist[]; char *err; char *combined; - if (errcode < sys_nerr) - err = sys_errlist[errcode]; - else - err = "unknown error"; - + err = safe_strerror (errcode); combined = (char *) alloca (strlen (err) + strlen (string) + 3); strcpy (combined, string); strcat (combined, ": "); @@ -422,7 +449,10 @@ mrealloc (md, ptr, size) PTR ptr; long size; { - return (realloc (ptr, size)); + if (ptr == 0) /* Guard against old realloc's */ + return malloc (size); + else + return realloc (ptr, size); } void @@ -1325,7 +1355,7 @@ _initialize_utils () #if defined(SIGWINCH) && defined(SIGWINCH_HANDLER) - /* If tere is a better way to determine window size, use it. */ + /* If there is a better way to determine the window size, use it. */ SIGWINCH_HANDLER (); #endif diff --git a/gdb/valprint.c b/gdb/valprint.c index 114c06b..1675eb1 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -79,9 +79,6 @@ is_vtbl_ptr_type PARAMS ((struct type *)); static void print_hex_chars PARAMS ((FILE *, unsigned char *, unsigned)); -extern int sys_nerr; -extern char *sys_errlist[]; - extern int demangle; /* whether to print C++ syms raw or source-form */ /* Maximum number of chars to print for a string pointer value @@ -1018,12 +1015,8 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty) } else { - if (errcode >= sys_nerr || errcode < 0) - error ("Error reading memory address 0x%x: unknown error (%d).", - addr + i, errcode); - else - error ("Error reading memory address 0x%x: %s.", - addr + i, sys_errlist[errcode]); + error ("Error reading memory address 0x%x: %s.", + addr + i, safe_strerror (errcode)); } } @@ -1672,18 +1665,16 @@ type_print_base (type, stream, show, level) QUIT; wrap_here (" "); - if (type == 0) + if (type == NULL) { - fprintf_filtered (stream, "<type unknown>"); + fputs_filtered ("<type unknown>", stream); return; } - /* If the type is a fundamental type, then always print the type name - directly from the type. Also print the type name directly whenever - SHOW drops to zero and there is a valid type name to print. */ + /* When SHOW is zero or less, and there is a valid type name, then always + just print the type name directly from the type. */ - if ((TYPE_FLAGS (type) & TYPE_FLAG_FUND_TYPE) || - ((show <= 0) && (TYPE_NAME (type) != NULL))) + if ((show <= 0) && (TYPE_NAME (type) != NULL)) { fputs_filtered (TYPE_NAME (type), stream); return; @@ -1881,7 +1872,19 @@ type_print_base (type, stream, show, level) break; default: - error ("Invalid type code in symbol table."); + /* Handle types not explicitly handled by the other cases, + such as fundamental types. For these, just print whatever + the type name is, as recorded in the type itself. If there + is no type name, then complain. */ + if (TYPE_NAME (type) != NULL) + { + fputs_filtered (TYPE_NAME (type), stream); + } + else + { + error ("Invalid type code (%d) in symbol table.", TYPE_CODE (type)); + } + break; } } diff --git a/gdb/xm-apollo68v.h b/gdb/xm-apollo68v.h index 49068e4..e510e99 100644 --- a/gdb/xm-apollo68v.h +++ b/gdb/xm-apollo68v.h @@ -43,6 +43,3 @@ on those where it does, it occurs quite reliably. */ #define HAVE_TERMIO #define FETCH_INFERIOR_REGISTERS - -#define SYS_SIGLIST_MISSING 0 /* we have it on the apollo */ - diff --git a/gdb/xm-ultra3.h b/gdb/xm-ultra3.h index deafa23..48e4999 100644 --- a/gdb/xm-ultra3.h +++ b/gdb/xm-ultra3.h @@ -56,9 +56,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ this is the right value for U_REGS_OFFSET. */ #define U_REGS_OFFSET 0 -/* System doesn't provide a list of signal names. */ -#define SYS_SIGLIST_MISSING 1 - /* System doesn't provide siginterrupt(). */ #define NO_SIGINTERRUPT |