From 17e78a56e23b8b6b76fa1c83a9818f603c46ddcf Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 23 Mar 2001 00:58:48 +0000 Subject: [PATCH] Obsolete stuff.c and kdb-start.c. --- gdb/ChangeLog | 8 ++ gdb/Makefile.in | 8 -- gdb/NEWS | 5 +- gdb/kdb-start.c | 76 +++++------ gdb/stuff.c | 348 ++++++++++++++++++++++++------------------------ 5 files changed, 224 insertions(+), 221 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5ad26d3ddf7..539007704e4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2001-03-22 Andrew Cagney + + * Makefile.in (NTSSTART): Delete. + (NTSOBS): Delete. + (kdb): Delete target. + * kdb-start.c, stuff.c: Mark as obsolete. + * NEWS: Update. + 2001-03-22 Andrew Cagney * config/pa/xm-hppah.h (HPPA_COMPILER_BUG): Delete. GDB only diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 91bb0772851..0d611fcd580 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -692,10 +692,6 @@ OBS = $(COMMON_OBS) $(ANNOTATE_OBS) TSOBS = inflow.o -NTSOBS = standalone.o - -NTSSTART = kdb-start.o - SUBDIRS = @SUBDIRS@ # For now, shortcut the "configure GDB for fewer languages" stuff. @@ -902,10 +898,6 @@ tm-sun4os4.h: tm-sparc.h xm-vaxult.h: xm-vax.h xm-vaxbsd.h: xm-vax.h -kdb: $(NTSSTART) $(OBS) $(CONFIG_OBS) $(NTSOBS) $(ADD_DEPS) $(CDEPS) - ld -o kdb $(NTSSTART) $(OBS) $(CONFIG_OBS) $(NTSOBS) init.o \ - $(ADD_FILES) -lc $(CLIBS) - # Put the proper machine-specific files first, so M-. on a machine # specific routine gets the one for the correct machine. (FIXME: those # files go in twice; we should be removing them from the main list). diff --git a/gdb/NEWS b/gdb/NEWS index 9e211fed4c3..aed876ca7de 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -12,11 +12,14 @@ x86 FreeBSD 3.x and 4.x i[3456]86*-freebsd[34]* * New targets -* OBSOLETE configurations +* OBSOLETE configurations and files x86 FreeBSD before 2.2 i[3456]86*-freebsd{1,2.[01]}*, Harris/CXUX m88k m88*-harris-cxux* +stuff.c (Program to stuff files into a specially prepared space in kdb) +kdb-start.c (Main loop for the standalone kernel debugger) + Configurations that have been declared obsolete in this release have been commented out. Unless there is activity to revive these configurations, the next release of GDB will have their sources diff --git a/gdb/kdb-start.c b/gdb/kdb-start.c index df054d6f5a2..32d65df7a4a 100644 --- a/gdb/kdb-start.c +++ b/gdb/kdb-start.c @@ -1,38 +1,38 @@ -/* Main loop for the standalone kernel debugger, for GDB, the GNU Debugger. - Copyright 1989, 1991, 1992, 2000 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 "defs.h" - -static char *args[] = -{"kdb", "kdb-symbols", 0}; - -static char *environment[] = -{0}; - -char **environ; - -start (void) -{ - INIT_STACK (kdb_stack_beg, kdb_stack_end); - - environ = environment; - - main (2, args, environment); -} +/* OBSOLETE /* Main loop for the standalone kernel debugger, for GDB, the GNU Debugger. */ +/* OBSOLETE Copyright 1989, 1991, 1992, 2000 Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */ +/* OBSOLETE Boston, MA 02111-1307, USA. */ */ +/* OBSOLETE */ +/* OBSOLETE #include "defs.h" */ +/* OBSOLETE */ +/* OBSOLETE static char *args[] = */ +/* OBSOLETE {"kdb", "kdb-symbols", 0}; */ +/* OBSOLETE */ +/* OBSOLETE static char *environment[] = */ +/* OBSOLETE {0}; */ +/* OBSOLETE */ +/* OBSOLETE char **environ; */ +/* OBSOLETE */ +/* OBSOLETE start (void) */ +/* OBSOLETE { */ +/* OBSOLETE INIT_STACK (kdb_stack_beg, kdb_stack_end); */ +/* OBSOLETE */ +/* OBSOLETE environ = environment; */ +/* OBSOLETE */ +/* OBSOLETE main (2, args, environment); */ +/* OBSOLETE } */ diff --git a/gdb/stuff.c b/gdb/stuff.c index f010c8e0578..7ea32097eca 100644 --- a/gdb/stuff.c +++ b/gdb/stuff.c @@ -1,174 +1,174 @@ -/* Program to stuff files into a specially prepared space in kdb. - Copyright 1986, 1989, 1991, 1992, 1995, 2000 - 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. */ - -/* Written 13-Mar-86 by David Bridgham. */ - -#include -#include -#include -#include "gdb_stat.h" -#include -#include - -main (argc, argv) - int argc; - char *argv[]; -{ - register char *cp; - char *outfile; - register int i; - int offset; - int out_fd, in_fd; - struct stat stat_buf; - int size, pad; - char buf[1024]; - static char zeros[4] = - {0}; - - if (argc < 4) - err ("Not enough arguments\nUsage: %s -o kdb file1 file2 ...\n", - argv[0]); - - outfile = 0; - for (i = 1; i < argc; i++) - { - if (STREQ (argv[i], "-o")) - outfile = argv[++i]; - } - if (outfile == 0) - err ("Output file not specified\n"); - - offset = get_offset (outfile, "_heap"); - - out_fd = open (outfile, O_WRONLY); - if (out_fd < 0) - 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, 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 - * that name the output file. */ - for (i = 1; i < argc; i++) - { - if (STREQ (argv[i], "-o")) - continue; - if ((in_fd = open (argv[i], O_RDONLY)) < 0) - 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], strerror (errno)); - size = strlen (argv[i]); - pad = 4 - (size & 3); - size += pad + stat_buf.st_size + sizeof (int); - write (out_fd, &size, sizeof (int)); - write (out_fd, argv[i], strlen (argv[i])); - write (out_fd, zeros, pad); - while ((size = read (in_fd, buf, sizeof (buf))) > 0) - write (out_fd, buf, size); - close (in_fd); - } - size = 0; - write (out_fd, &size, sizeof (int)); - close (out_fd); - return (0); -} - -/* Read symbol table from file and returns the offset into the file - * where symbol sym_name is located. If error, print message and - * exit. */ -get_offset (char *file, char *sym_name) -{ - int f; - struct exec file_hdr; - struct nlist *symbol_table; - int size; - char *strings; - - f = open (file, O_RDONLY); - if (f < 0) - 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", strerror (errno)); - if (N_BADMAG (file_hdr)) - err ("File %s not an a.out file\n", file); - - /* read in symbol table */ - 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", strerror (errno)); - if (read (f, symbol_table, file_hdr.a_syms) == -1) - 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", 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", strerror (errno)); - - /* Find the core address at which the first byte of kdb text segment - should be loaded into core when kdb is run. */ - origin = find_symbol ("_etext", symbol_table, file_hdr.a_syms, strings) - - file_hdr.a_text; - /* Find the core address at which the heap will appear. */ - coreaddr = find_symbol (sym_name, symbol_table, file_hdr.a_syms, strings); - /* Return address in file of the heap data space. */ - return (N_TXTOFF (file_hdr) + core_addr - origin); -} - -find_symbol (char *sym_name, struct nlist *symbol_table, int length, - char *strings) -{ - register struct nlist *sym; - - /* Find symbol in question */ - for (sym = symbol_table; - sym != (struct nlist *) ((char *) symbol_table + length); - sym++) - { - if ((sym->n_type & N_TYPE) != N_DATA) - continue; - if (sym->n_un.n_strx == 0) - continue; - if (STREQ (sym_name, strings + sym->n_un.n_strx - 4)) - return sym->n_value; - } - err ("Data symbol %s not found in %s\n", sym_name, file); -} - -/* VARARGS */ -void -err (va_alist) - va_dcl -{ - va_list args; - char *string; - - va_start (args); - string = va_arg (args, char *); - vfprintf (gdb_stderr, string, args); - va_end (args); - exit (-1); -} +/* OBSOLETE /* Program to stuff files into a specially prepared space in kdb. */ +/* OBSOLETE Copyright 1986, 1989, 1991, 1992, 1995, 2000 */ +/* OBSOLETE Free Software Foundation, Inc. */ +/* OBSOLETE */ +/* OBSOLETE This file is part of GDB. */ +/* OBSOLETE */ +/* OBSOLETE This program is free software; you can redistribute it and/or modify */ +/* OBSOLETE it under the terms of the GNU General Public License as published by */ +/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */ +/* OBSOLETE (at your option) any later version. */ +/* OBSOLETE */ +/* OBSOLETE This program is distributed in the hope that it will be useful, */ +/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* OBSOLETE GNU General Public License for more details. */ +/* OBSOLETE */ +/* OBSOLETE You should have received a copy of the GNU General Public License */ +/* OBSOLETE along with this program; if not, write to the Free Software */ +/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */ +/* OBSOLETE Boston, MA 02111-1307, USA. */ */ +/* OBSOLETE */ +/* OBSOLETE /* Written 13-Mar-86 by David Bridgham. */ */ +/* OBSOLETE */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE #include "gdb_stat.h" */ +/* OBSOLETE #include */ +/* OBSOLETE #include */ +/* OBSOLETE */ +/* OBSOLETE main (argc, argv) */ +/* OBSOLETE int argc; */ +/* OBSOLETE char *argv[]; */ +/* OBSOLETE { */ +/* OBSOLETE register char *cp; */ +/* OBSOLETE char *outfile; */ +/* OBSOLETE register int i; */ +/* OBSOLETE int offset; */ +/* OBSOLETE int out_fd, in_fd; */ +/* OBSOLETE struct stat stat_buf; */ +/* OBSOLETE int size, pad; */ +/* OBSOLETE char buf[1024]; */ +/* OBSOLETE static char zeros[4] = */ +/* OBSOLETE {0}; */ +/* OBSOLETE */ +/* OBSOLETE if (argc < 4) */ +/* OBSOLETE err ("Not enough arguments\nUsage: %s -o kdb file1 file2 ...\n", */ +/* OBSOLETE argv[0]); */ +/* OBSOLETE */ +/* OBSOLETE outfile = 0; */ +/* OBSOLETE for (i = 1; i < argc; i++) */ +/* OBSOLETE { */ +/* OBSOLETE if (STREQ (argv[i], "-o")) */ +/* OBSOLETE outfile = argv[++i]; */ +/* OBSOLETE } */ +/* OBSOLETE if (outfile == 0) */ +/* OBSOLETE err ("Output file not specified\n"); */ +/* OBSOLETE */ +/* OBSOLETE offset = get_offset (outfile, "_heap"); */ +/* OBSOLETE */ +/* OBSOLETE out_fd = open (outfile, O_WRONLY); */ +/* OBSOLETE if (out_fd < 0) */ +/* OBSOLETE err ("Error opening %s for write: %s\n", outfile, strerror (errno)); */ +/* OBSOLETE if (lseek (out_fd, offset, 0) < 0) */ +/* OBSOLETE err ("Error seeking to heap in %s: %s\n", outfile, strerror (errno)); */ +/* OBSOLETE */ +/* OBSOLETE /* For each file listed on the command line, write it into the */ +/* OBSOLETE * 'heap' of the output file. Make sure to skip the arguments */ +/* OBSOLETE * that name the output file. */ */ +/* OBSOLETE for (i = 1; i < argc; i++) */ +/* OBSOLETE { */ +/* OBSOLETE if (STREQ (argv[i], "-o")) */ +/* OBSOLETE continue; */ +/* OBSOLETE if ((in_fd = open (argv[i], O_RDONLY)) < 0) */ +/* OBSOLETE err ("Error opening %s for read: %s\n", argv[i], */ +/* OBSOLETE strerror (errno)); */ +/* OBSOLETE if (fstat (in_fd, &stat_buf) < 0) */ +/* OBSOLETE err ("Error stat'ing %s: %s\n", argv[i], strerror (errno)); */ +/* OBSOLETE size = strlen (argv[i]); */ +/* OBSOLETE pad = 4 - (size & 3); */ +/* OBSOLETE size += pad + stat_buf.st_size + sizeof (int); */ +/* OBSOLETE write (out_fd, &size, sizeof (int)); */ +/* OBSOLETE write (out_fd, argv[i], strlen (argv[i])); */ +/* OBSOLETE write (out_fd, zeros, pad); */ +/* OBSOLETE while ((size = read (in_fd, buf, sizeof (buf))) > 0) */ +/* OBSOLETE write (out_fd, buf, size); */ +/* OBSOLETE close (in_fd); */ +/* OBSOLETE } */ +/* OBSOLETE size = 0; */ +/* OBSOLETE write (out_fd, &size, sizeof (int)); */ +/* OBSOLETE close (out_fd); */ +/* OBSOLETE return (0); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* Read symbol table from file and returns the offset into the file */ +/* OBSOLETE * where symbol sym_name is located. If error, print message and */ +/* OBSOLETE * exit. */ */ +/* OBSOLETE get_offset (char *file, char *sym_name) */ +/* OBSOLETE { */ +/* OBSOLETE int f; */ +/* OBSOLETE struct exec file_hdr; */ +/* OBSOLETE struct nlist *symbol_table; */ +/* OBSOLETE int size; */ +/* OBSOLETE char *strings; */ +/* OBSOLETE */ +/* OBSOLETE f = open (file, O_RDONLY); */ +/* OBSOLETE if (f < 0) */ +/* OBSOLETE err ("Error opening %s: %s\n", file, strerror (errno)); */ +/* OBSOLETE if (read (f, &file_hdr, sizeof (file_hdr)) < 0) */ +/* OBSOLETE err ("Error reading exec structure: %s\n", strerror (errno)); */ +/* OBSOLETE if (N_BADMAG (file_hdr)) */ +/* OBSOLETE err ("File %s not an a.out file\n", file); */ +/* OBSOLETE */ +/* OBSOLETE /* read in symbol table */ */ +/* OBSOLETE if ((symbol_table = (struct nlist *) malloc (file_hdr.a_syms)) == 0) */ +/* OBSOLETE err ("Couldn't allocate space for symbol table\n"); */ +/* OBSOLETE if (lseek (f, N_SYMOFF (file_hdr), 0) == -1) */ +/* OBSOLETE err ("lseek error: %s\n", strerror (errno)); */ +/* OBSOLETE if (read (f, symbol_table, file_hdr.a_syms) == -1) */ +/* OBSOLETE err ("Error reading symbol table from %s: %s\n", file, */ +/* OBSOLETE strerror (errno)); */ +/* OBSOLETE */ +/* OBSOLETE /* read in string table */ */ +/* OBSOLETE if (read (f, &size, 4) == -1) */ +/* OBSOLETE err ("reading string table size: %s\n", strerror (errno)); */ +/* OBSOLETE if ((strings = (char *) malloc (size)) == 0) */ +/* OBSOLETE err ("Couldn't allocate memory for string table\n"); */ +/* OBSOLETE if (read (f, strings, size - 4) == -1) */ +/* OBSOLETE err ("reading string table: %s\n", strerror (errno)); */ +/* OBSOLETE */ +/* OBSOLETE /* Find the core address at which the first byte of kdb text segment */ +/* OBSOLETE should be loaded into core when kdb is run. */ */ +/* OBSOLETE origin = find_symbol ("_etext", symbol_table, file_hdr.a_syms, strings) */ +/* OBSOLETE - file_hdr.a_text; */ +/* OBSOLETE /* Find the core address at which the heap will appear. */ */ +/* OBSOLETE coreaddr = find_symbol (sym_name, symbol_table, file_hdr.a_syms, strings); */ +/* OBSOLETE /* Return address in file of the heap data space. */ */ +/* OBSOLETE return (N_TXTOFF (file_hdr) + core_addr - origin); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE find_symbol (char *sym_name, struct nlist *symbol_table, int length, */ +/* OBSOLETE char *strings) */ +/* OBSOLETE { */ +/* OBSOLETE register struct nlist *sym; */ +/* OBSOLETE */ +/* OBSOLETE /* Find symbol in question */ */ +/* OBSOLETE for (sym = symbol_table; */ +/* OBSOLETE sym != (struct nlist *) ((char *) symbol_table + length); */ +/* OBSOLETE sym++) */ +/* OBSOLETE { */ +/* OBSOLETE if ((sym->n_type & N_TYPE) != N_DATA) */ +/* OBSOLETE continue; */ +/* OBSOLETE if (sym->n_un.n_strx == 0) */ +/* OBSOLETE continue; */ +/* OBSOLETE if (STREQ (sym_name, strings + sym->n_un.n_strx - 4)) */ +/* OBSOLETE return sym->n_value; */ +/* OBSOLETE } */ +/* OBSOLETE err ("Data symbol %s not found in %s\n", sym_name, file); */ +/* OBSOLETE } */ +/* OBSOLETE */ +/* OBSOLETE /* VARARGS */ */ +/* OBSOLETE void */ +/* OBSOLETE err (va_alist) */ +/* OBSOLETE va_dcl */ +/* OBSOLETE { */ +/* OBSOLETE va_list args; */ +/* OBSOLETE char *string; */ +/* OBSOLETE */ +/* OBSOLETE va_start (args); */ +/* OBSOLETE string = va_arg (args, char *); */ +/* OBSOLETE vfprintf (gdb_stderr, string, args); */ +/* OBSOLETE va_end (args); */ +/* OBSOLETE exit (-1); */ +/* OBSOLETE } */ -- 2.30.2