From: Andrew Cagney Date: Tue, 16 Jul 2002 15:19:19 +0000 (+0000) Subject: Obsolete i[3456]86-*-os9k. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a99a9e1bc43b7dd85d928d5654b45f1b789f9ec0;p=binutils-gdb.git Obsolete i[3456]86-*-os9k. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb3ed2f7be3..e4fd18fa6b7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +2002-07-16 Andrew Cagney + + * NEWS: Mention that the i[34]86-*-os9k has been made obsolete. + * stabsread.c: Make os9k sections of the code obsolete. + * configure.tgt: Make i[3456]86-*-os9k target obsolete. + * config/i386/i386os9k.mt: Make file obsolete. + * Makefile.in (ALLDEPFILES): Remove remote-os9k.c. + (COMMON_OBS): Remove os9kread.o + (SFILES): Remove os9kread.c. + (os9kread.o, remote-os9k.o): Make target obsolete. + * remote-os9k.c: Make file obsolete. + * os9kread.c: Make file obsolete. + * Makefile.in + 2002-07-16 Andrew Cagney * NEWS: Mention that the FR30 has been made obsolete. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 1919ee55ffc..09f2e2d8413 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -544,7 +544,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c blockframe.c breakpoint.c \ scm-valprint.c source.c stabsread.c stack.c symfile.c \ symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \ typeprint.c utils.c valarith.c valops.c valprint.c values.c \ - serial.c ser-unix.c mdebugread.c os9kread.c \ + serial.c ser-unix.c mdebugread.c \ tui/tui.c tui/tui.h tui/tuiCommand.c tui/tuiCommand.h \ tui/tuiData.c tui/tuiData.h tui/tuiDataWin.c tui/tuiDataWin.h \ tui/tuiDisassem.c tui/tuiDisassem.h tui/tuiGeneralWin.c \ @@ -743,7 +743,7 @@ COMMON_OBS = version.o blockframe.o breakpoint.o findvar.o regcache.o \ scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o \ c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o \ c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o \ - nlmread.o serial.o mdebugread.o os9kread.o top.o utils.o \ + nlmread.o serial.o mdebugread.o top.o utils.o \ ui-file.o \ frame.o doublest.o \ gnu-v2-abi.o gnu-v3-abi.o hpacc-abi.o cp-abi.o @@ -1238,7 +1238,7 @@ ALLDEPFILES = a68v-nat.c \ procfs.c \ remote-array.c remote-bug.c remote-e7000.c \ remote-es.c remote-hms.c remote-mips.c \ - remote-nindy.c remote-os9k.c remote-rdp.c remote-sim.c \ + remote-nindy.c remote-rdp.c remote-sim.c \ remote-st.c remote-utils.c dcache.c \ remote-vx.c \ rs6000-nat.c rs6000-tdep.c \ @@ -1797,14 +1797,14 @@ mdebugread.o: mdebugread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ mipsm3-nat.o: mipsm3-nat.c $(defs_h) $(inferior_h) $(regcache_h) -# os9kread assumes that sizeof(char*) <= sizeof(int). This looses on -# 64 bit targets where often, sizeof(int)=4 but sizeof(char*)=9. -os9kread.o: os9kread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ - $(expression_h) $(gdb_stabs_h) $(gdbcore_h) $(gdbtypes_h) \ - $(language_h) $(objfiles_h) $(stabsread_h) $(symfile_h) \ - $(symtab_h) $(target_h) $(gdb_string_h) - $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \ - $(srcdir)/os9kread.c +# OBSOLETE # os9kread assumes that sizeof(char*) <= sizeof(int). This looses on +# OBSOLETE # 64 bit targets where often, sizeof(int)=4 but sizeof(char*)=9. +# OBSOLETE os9kread.o: os9kread.c $(buildsym_h) $(complaints_h) $(bfd_h) $(defs_h) \ +# OBSOLETE $(expression_h) $(gdb_stabs_h) $(gdbcore_h) $(gdbtypes_h) \ +# OBSOLETE $(language_h) $(objfiles_h) $(stabsread_h) $(symfile_h) \ +# OBSOLETE $(symtab_h) $(target_h) $(gdb_string_h) +# OBSOLETE $(CC) -c $(INTERNAL_WARN_CFLAGS) $(NO_WERROR_CFLAGS) \ +# OBSOLETE $(srcdir)/os9kread.c mem-break.o: mem-break.c $(defs_h) $(symtab_h) $(breakpoint_h) $(inferior_h) \ $(target_h) @@ -2004,9 +2004,9 @@ remote-nindy.o: remote-nindy.c $(floatformat_h) $(command_h) \ nindy-share/env.h nindy-share/stop.h $(remote_utils_h) \ $(symfile_h) $(regcache_h) -remote-os9k.o: remote-os9k.c $(defs_h) $(gdbcore_h) \ - $(command_h) $(monitor_h) $(remote_utils_h) $(symtab_h) $(symfile_h) \ - $(objfiles_h) $(gdb_stabs_h) $(gdb_string_h) $(regcache_h) +# OBSOLETE remote-os9k.o: remote-os9k.c $(defs_h) $(gdbcore_h) \ +# OBSOLETE $(command_h) $(monitor_h) $(remote_utils_h) $(symtab_h) $(symfile_h) \ +# OBSOLETE $(objfiles_h) $(gdb_stabs_h) $(gdb_string_h) $(regcache_h) remote-sds.o: remote-sds.c $(bfd_h) $(defs_h) $(gdbcmd_h) \ $(inferior_h) $(remote_utils_h) $(symfile_h) $(terminal_h) \ diff --git a/gdb/NEWS b/gdb/NEWS index f4e6dc9abff..b923924b3cd 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -61,6 +61,7 @@ configurations, the next release of GDB will have their sources permanently REMOVED. Mitsubishi D30V d30v-*-* +OS/9000 i[34]86-*-os9k Fujitsu FR30 fr30-*-elf* * REMOVED configurations and files diff --git a/gdb/config/i386/i386os9k.mt b/gdb/config/i386/i386os9k.mt index 5a8794db58f..939e9e216a3 100644 --- a/gdb/config/i386/i386os9k.mt +++ b/gdb/config/i386/i386os9k.mt @@ -1,3 +1,3 @@ -# Target: Intel 386 running OS9000 -TDEPFILES= i386-tdep.o remote-os9k.o -TM_FILE= tm-i386os9k.h +# OBSOLETE # Target: Intel 386 running OS9000 +# OBSOLETE TDEPFILES= i386-tdep.o remote-os9k.o +# OBSOLETE TM_FILE= tm-i386os9k.h diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 6ef9d071503..f61b7ef70df 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -96,7 +96,7 @@ i[3456]86-*-freebsd*) gdb_target=fbsd ;; i[3456]86-*-netbsdelf*) gdb_target=nbsdelf ;; i[3456]86-*-netbsd* | i[3456]86-*-openbsd*) gdb_target=nbsdaout ;; -i[3456]86-*-os9k) gdb_target=i386os9k ;; +# OBSOLETE i[3456]86-*-os9k) gdb_target=i386os9k ;; i[3456]86-*-go32*) gdb_target=i386aout ;; i[3456]86-*-msdosdjgpp*) gdb_target=go32 ;; i[3456]86-*-lynxos*) gdb_target=i386lynx ;; diff --git a/gdb/os9kread.c b/gdb/os9kread.c index b36e7185cc7..767d6845642 100644 --- a/gdb/os9kread.c +++ b/gdb/os9kread.c @@ -1,1621 +1,1621 @@ -/* Read os9/os9k symbol tables and convert to internal format, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001 - 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. */ - -/* This module provides three functions: os9k_symfile_init, - which initializes to read a symbol file; os9k_new_init, which - discards existing cached information when all symbols are being - discarded; and os9k_symfile_read, which reads a symbol table - from a file. - - os9k_symfile_read only does the minimum work necessary for letting the - user "name" things symbolically; it does not read the entire symtab. - Instead, it reads the external and static symbols and puts them in partial - symbol tables. When more extensive information is requested of a - file, the corresponding partial symbol table is mutated into a full - fledged symbol table by going back and reading the symbols - for real. os9k_psymtab_to_symtab() is the function that does this */ - -#include "defs.h" -#include "gdb_string.h" -#include "gdb_assert.h" -#include - -#if defined(USG) || defined(__CYGNUSCLIB__) -#include -#include -#endif - -#include "obstack.h" -#include "gdb_stat.h" -#include "symtab.h" -#include "breakpoint.h" -#include "command.h" -#include "target.h" -#include "gdbcore.h" /* for bfd stuff */ -#include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */ -#include "symfile.h" -#include "objfiles.h" -#include "buildsym.h" -#include "gdb-stabs.h" -#include "demangle.h" -#include "language.h" /* Needed inside partial-stab.h */ -#include "complaints.h" -#include "os9k.h" -#include "stabsread.h" - -extern void _initialize_os9kread (void); - -/* Each partial symbol table entry contains a pointer to private data for the - read_symtab() function to use when expanding a partial symbol table entry - to a full symbol table entry. - - For dbxread this structure contains the offset within the file symbol table - of first local symbol for this file, and count of the section - of the symbol table devoted to this file's symbols (actually, the section - bracketed may contain more than just this file's symbols). It also contains - further information needed to locate the symbols if they are in an ELF file. - - If ldsymcnt is 0, the only reason for this thing's existence is the - dependency list. Nothing else will happen when it is read in. */ - -#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff) -#define LDSYMCNT(p) (((struct symloc *)((p)->read_symtab_private))->ldsymnum) - -struct symloc - { - int ldsymoff; - int ldsymnum; - }; - -/* Remember what we deduced to be the source language of this psymtab. */ -static enum language psymtab_language = language_unknown; - -/* keep partial symbol table file nested depth */ -static int psymfile_depth = 0; - -/* keep symbol table file nested depth */ -static int symfile_depth = 0; - -extern int previous_stab_code; - -/* Name of last function encountered. Used in Solaris to approximate - object file boundaries. */ -static char *last_function_name; - -/* Complaints about the symbols we have encountered. */ -extern struct complaint lbrac_complaint; - -extern struct complaint unknown_symtype_complaint; - -extern struct complaint unknown_symchar_complaint; - -extern struct complaint lbrac_rbrac_complaint; - -extern struct complaint repeated_header_complaint; - -extern struct complaint repeated_header_name_complaint; - -#if 0 -static struct complaint lbrac_unmatched_complaint = -{"unmatched Increment Block Entry before symtab pos %d", 0, 0}; - -static struct complaint lbrac_mismatch_complaint = -{"IBE/IDE symbol mismatch at symtab pos %d", 0, 0}; -#endif - -/* Local function prototypes */ - -static void read_minimal_symbols (struct objfile *); - -static void os9k_read_ofile_symtab (struct partial_symtab *); - -static void os9k_psymtab_to_symtab (struct partial_symtab *); - -static void os9k_psymtab_to_symtab_1 (struct partial_symtab *); - -static void read_os9k_psymtab (struct objfile *, CORE_ADDR, int); - -static int fill_sym (FILE *, bfd *); - -static void os9k_symfile_init (struct objfile *); - -static void os9k_new_init (struct objfile *); - -static void os9k_symfile_read (struct objfile *, int); - -static void os9k_symfile_finish (struct objfile *); - -static void os9k_process_one_symbol (int, int, CORE_ADDR, char *, - struct section_offsets *, - struct objfile *); - -static struct partial_symtab *os9k_start_psymtab (struct objfile *, char *, - CORE_ADDR, int, int, - struct partial_symbol **, - struct partial_symbol **); - -static struct partial_symtab *os9k_end_psymtab (struct partial_symtab *, - char **, int, int, CORE_ADDR, - struct partial_symtab **, - int); - -static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *); - -#define HANDLE_RBRAC(val) \ - if ((val) > pst->texthigh) pst->texthigh = (val); - -#define SWAP_STBHDR(hdrp, abfd) \ - { \ - (hdrp)->fmtno = bfd_get_16(abfd, (unsigned char *)&(hdrp)->fmtno); \ - (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \ - (hdrp)->offset = bfd_get_32(abfd, (unsigned char *)&(hdrp)->offset); \ - (hdrp)->nsym = bfd_get_32(abfd, (unsigned char *)&(hdrp)->nsym); \ - } -#define SWAP_STBSYM(symp, abfd) \ - { \ - (symp)->value = bfd_get_32(abfd, (unsigned char *)&(symp)->value); \ - (symp)->type = bfd_get_16(abfd, (unsigned char *)&(symp)->type); \ - (symp)->stroff = bfd_get_32(abfd, (unsigned char *)&(symp)->stroff); \ - } -#define N_DATA 0 -#define N_BSS 1 -#define N_RDATA 2 -#define N_IDATA 3 -#define N_TEXT 4 -#define N_ABS 6 - -static void -record_minimal_symbol (char *name, CORE_ADDR address, int type, - struct objfile *objfile) -{ - enum minimal_symbol_type ms_type; - - switch (type) - { - case N_TEXT: - ms_type = mst_text; - address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - break; - case N_DATA: - ms_type = mst_data; - break; - case N_BSS: - ms_type = mst_bss; - break; - case N_RDATA: - ms_type = mst_bss; - break; - case N_IDATA: - ms_type = mst_data; - break; - case N_ABS: - ms_type = mst_abs; - break; - default: - ms_type = mst_unknown; - break; - } - - prim_record_minimal_symbol (name, address, ms_type, objfile); -} - -/* read and process .stb file and store in minimal symbol table */ -typedef char mhhdr[80]; -struct stbhdr - { - mhhdr comhdr; - char *name; - short fmtno; - int crc; - int offset; - int nsym; - char *pad; - }; -struct stbsymbol - { - int value; - short type; - int stroff; - }; -#define STBSYMSIZE 10 - -static void -read_minimal_symbols (struct objfile *objfile) -{ - FILE *fp; - bfd *abfd; - struct stbhdr hdr; - struct stbsymbol sym; - int ch, i, j, off; - char buf[64], buf1[128]; - - fp = objfile->auxf1; - if (fp == NULL) - return; - abfd = objfile->obfd; - fread (&hdr.comhdr[0], sizeof (mhhdr), 1, fp); - i = 0; - ch = getc (fp); - while (ch != -1) - { - buf[i] = (char) ch; - i++; - if (ch == 0) - break; - ch = getc (fp); - }; - if (i % 2) - ch = getc (fp); - hdr.name = &buf[0]; - - fread (&hdr.fmtno, sizeof (hdr.fmtno), 1, fp); - fread (&hdr.crc, sizeof (hdr.crc), 1, fp); - fread (&hdr.offset, sizeof (hdr.offset), 1, fp); - fread (&hdr.nsym, sizeof (hdr.nsym), 1, fp); - SWAP_STBHDR (&hdr, abfd); - - /* read symbols */ - init_minimal_symbol_collection (); - off = hdr.offset; - for (i = hdr.nsym; i > 0; i--) - { - fseek (fp, (long) off, 0); - fread (&sym.value, sizeof (sym.value), 1, fp); - fread (&sym.type, sizeof (sym.type), 1, fp); - fread (&sym.stroff, sizeof (sym.stroff), 1, fp); - SWAP_STBSYM (&sym, abfd); - fseek (fp, (long) sym.stroff, 0); - j = 0; - ch = getc (fp); - while (ch != -1) - { - buf1[j] = (char) ch; - j++; - if (ch == 0) - break; - ch = getc (fp); - }; - record_minimal_symbol (buf1, sym.value, sym.type & 7, objfile); - off += STBSYMSIZE; - }; - install_minimal_symbols (objfile); - return; -} - -/* Scan and build partial symbols for a symbol file. - We have been initialized by a call to os9k_symfile_init, which - put all the relevant info into a "struct os9k_symfile_info", - hung off the objfile structure. - - MAINLINE is true if we are reading the main symbol - table (as opposed to a shared lib or dynamically loaded file). */ - -static void -os9k_symfile_read (struct objfile *objfile, int mainline) -{ - bfd *sym_bfd; - struct cleanup *back_to; - - sym_bfd = objfile->obfd; - /* If we are reinitializing, or if we have never loaded syms yet, init */ - if (mainline - || (objfile->global_psymbols.size == 0 - && objfile->static_psymbols.size == 0)) - init_psymbol_list (objfile, DBX_SYMCOUNT (objfile)); - - free_pending_blocks (); - back_to = make_cleanup (really_free_pendings, 0); - - make_cleanup_discard_minimal_symbols (); - read_minimal_symbols (objfile); - - /* Now that the symbol table data of the executable file are all in core, - process them and define symbols accordingly. */ - read_os9k_psymtab (objfile, - DBX_TEXT_ADDR (objfile), - DBX_TEXT_SIZE (objfile)); - - do_cleanups (back_to); -} - -/* Initialize anything that needs initializing when a completely new - symbol file is specified (not just adding some symbols from another - file, e.g. a shared library). */ - -static void -os9k_new_init (struct objfile *ignore) -{ - stabsread_new_init (); - buildsym_new_init (); - psymfile_depth = 0; -/* - init_header_files (); - */ -} - -/* os9k_symfile_init () - It is passed a struct objfile which contains, among other things, - the BFD for the file whose symbols are being read, and a slot for a pointer - to "private data" which we fill with goodies. - - Since BFD doesn't know how to read debug symbols in a format-independent - way (and may never do so...), we have to do it ourselves. We will never - be called unless this is an a.out (or very similar) file. - FIXME, there should be a cleaner peephole into the BFD environment here. */ - -static void -os9k_symfile_init (struct objfile *objfile) -{ - bfd *sym_bfd = objfile->obfd; - char *name = bfd_get_filename (sym_bfd); - char dbgname[512], stbname[512]; - FILE *symfile = 0; - FILE *minfile = 0; - asection *text_sect; - - strcpy (dbgname, name); - strcat (dbgname, ".dbg"); - strcpy (stbname, name); - strcat (stbname, ".stb"); - - if ((symfile = fopen (dbgname, "r")) == NULL) - { - warning ("Symbol file %s not found", dbgname); - } - objfile->auxf2 = symfile; - - if ((minfile = fopen (stbname, "r")) == NULL) - { - warning ("Symbol file %s not found", stbname); - } - objfile->auxf1 = minfile; - - /* Allocate struct to keep track of the symfile */ - objfile->sym_stab_info = (struct dbx_symfile_info *) - xmmalloc (objfile->md, sizeof (struct dbx_symfile_info)); - DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL; - - text_sect = bfd_get_section_by_name (sym_bfd, ".text"); - if (!text_sect) - error ("Can't find .text section in file"); - DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect); - DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect); - - DBX_SYMBOL_SIZE (objfile) = 0; /* variable size symbol */ - DBX_SYMCOUNT (objfile) = 0; /* used to be bfd_get_symcount(sym_bfd) */ - DBX_SYMTAB_OFFSET (objfile) = 0; /* used to be SYMBOL_TABLE_OFFSET */ -} - -/* Perform any local cleanups required when we are done with a particular - objfile. I.E, we are in the process of discarding all symbol information - for an objfile, freeing up all memory held for it, and unlinking the - objfile struct from the global list of known objfiles. */ - -static void -os9k_symfile_finish (struct objfile *objfile) -{ - if (objfile->sym_stab_info != NULL) - { - xmfree (objfile->md, objfile->sym_stab_info); - } -/* - free_header_files (); - */ -} - - -struct st_dbghdr -{ - int sync; - short rev; - int crc; - short os; - short cpu; -}; -#define SYNC (int)0xefbefeca - -#define SWAP_DBGHDR(hdrp, abfd) \ - { \ - (hdrp)->sync = bfd_get_32(abfd, (unsigned char *)&(hdrp)->sync); \ - (hdrp)->rev = bfd_get_16(abfd, (unsigned char *)&(hdrp)->rev); \ - (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \ - (hdrp)->os = bfd_get_16(abfd, (unsigned char *)&(hdrp)->os); \ - (hdrp)->cpu = bfd_get_16(abfd, (unsigned char *)&(hdrp)->cpu); \ - } - -#define N_SYM_CMPLR 0 -#define N_SYM_SLINE 1 -#define N_SYM_SYM 2 -#define N_SYM_LBRAC 3 -#define N_SYM_RBRAC 4 -#define N_SYM_SE 5 - -struct internal_symstruct - { - short n_type; - short n_desc; - long n_value; - char *n_strx; - }; -static struct internal_symstruct symbol; -static struct internal_symstruct *symbuf = &symbol; -static char strbuf[4096]; -static struct st_dbghdr dbghdr; -static short cmplrid; - -#define VER_PRE_ULTRAC ((short)4) -#define VER_ULTRAC ((short)5) - -static int -fill_sym (FILE *dbg_file, bfd *abfd) -{ - short si, nmask; - long li; - int ii; - char *p; - - int nbytes = fread (&si, sizeof (si), 1, dbg_file); - if (nbytes == 0) - return 0; - if (nbytes < 0) - perror_with_name ("reading .dbg file."); - symbuf->n_desc = 0; - symbuf->n_value = 0; - symbuf->n_strx = NULL; - symbuf->n_type = bfd_get_16 (abfd, (unsigned char *) &si); - symbuf->n_type = 0xf & symbuf->n_type; - switch (symbuf->n_type) - { - case N_SYM_CMPLR: - fread (&si, sizeof (si), 1, dbg_file); - symbuf->n_desc = bfd_get_16 (abfd, (unsigned char *) &si); - cmplrid = symbuf->n_desc & 0xff; - break; - case N_SYM_SLINE: - fread (&li, sizeof (li), 1, dbg_file); - symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); - fread (&li, sizeof (li), 1, dbg_file); - li = bfd_get_32 (abfd, (unsigned char *) &li); - symbuf->n_strx = (char *) (li >> 12); - symbuf->n_desc = li & 0xfff; - break; - case N_SYM_SYM: - fread (&li, sizeof (li), 1, dbg_file); - symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); - si = 0; - do - { - ii = getc (dbg_file); - strbuf[si++] = (char) ii; - } - while (ii != 0 || si % 2 != 0); - symbuf->n_strx = strbuf; - p = (char *) strchr (strbuf, ':'); - if (!p) - break; - if ((p[1] == 'F' || p[1] == 'f') && cmplrid == VER_PRE_ULTRAC) - { - fread (&si, sizeof (si), 1, dbg_file); - nmask = bfd_get_16 (abfd, (unsigned char *) &si); - for (ii = 0; ii < nmask; ii++) - fread (&si, sizeof (si), 1, dbg_file); - } - break; - case N_SYM_LBRAC: - fread (&li, sizeof (li), 1, dbg_file); - symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); - break; - case N_SYM_RBRAC: - fread (&li, sizeof (li), 1, dbg_file); - symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); - break; - case N_SYM_SE: - break; - } - return 1; -} - -/* Given pointers to an a.out symbol table in core containing dbx - style data, setup partial_symtab's describing each source file for - which debugging information is available. - SYMFILE_NAME is the name of the file we are reading from. */ - -static void -read_os9k_psymtab (struct objfile *objfile, CORE_ADDR text_addr, int text_size) -{ - register struct internal_symstruct *bufp = 0; /* =0 avoids gcc -Wall glitch */ - register char *namestring; - int past_first_source_file = 0; - CORE_ADDR last_o_file_start = 0; -#if 0 - struct cleanup *back_to; -#endif - bfd *abfd; - FILE *fp; - - /* End of the text segment of the executable file. */ - static CORE_ADDR end_of_text_addr; - - /* Current partial symtab */ - static struct partial_symtab *pst = 0; - - /* List of current psymtab's include files */ - char **psymtab_include_list; - int includes_allocated; - int includes_used; - - /* Index within current psymtab dependency list */ - struct partial_symtab **dependency_list; - int dependencies_used, dependencies_allocated; - - includes_allocated = 30; - includes_used = 0; - psymtab_include_list = (char **) alloca (includes_allocated * - sizeof (char *)); - - dependencies_allocated = 30; - dependencies_used = 0; - dependency_list = - (struct partial_symtab **) alloca (dependencies_allocated * - sizeof (struct partial_symtab *)); - - last_source_file = NULL; - -#ifdef END_OF_TEXT_DEFAULT - end_of_text_addr = END_OF_TEXT_DEFAULT; -#else - end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)) - + text_size; /* Relocate */ -#endif - - abfd = objfile->obfd; - fp = objfile->auxf2; - if (!fp) - return; - - fread (&dbghdr.sync, sizeof (dbghdr.sync), 1, fp); - fread (&dbghdr.rev, sizeof (dbghdr.rev), 1, fp); - fread (&dbghdr.crc, sizeof (dbghdr.crc), 1, fp); - fread (&dbghdr.os, sizeof (dbghdr.os), 1, fp); - fread (&dbghdr.cpu, sizeof (dbghdr.cpu), 1, fp); - SWAP_DBGHDR (&dbghdr, abfd); - - symnum = 0; - while (1) - { - int ret; - long cursymoffset; - - /* Get the symbol for this run and pull out some info */ - QUIT; /* allow this to be interruptable */ - cursymoffset = ftell (objfile->auxf2); - ret = fill_sym (objfile->auxf2, abfd); - if (ret <= 0) - break; - else - symnum++; - bufp = symbuf; - - /* Special case to speed up readin. */ - if (bufp->n_type == (short) N_SYM_SLINE) - continue; - -#define CUR_SYMBOL_VALUE bufp->n_value - /* partial-stab.h */ - - switch (bufp->n_type) - { - char *p; - - case N_SYM_CMPLR: - continue; - - case N_SYM_SE: - CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - if (psymfile_depth == 1 && pst) - { - os9k_end_psymtab (pst, psymtab_include_list, includes_used, - symnum, CUR_SYMBOL_VALUE, - dependency_list, dependencies_used); - pst = (struct partial_symtab *) 0; - includes_used = 0; - dependencies_used = 0; - } - psymfile_depth--; - continue; - - case N_SYM_SYM: /* Typedef or automatic variable. */ - namestring = bufp->n_strx; - p = (char *) strchr (namestring, ':'); - if (!p) - continue; /* Not a debugging symbol. */ - - /* Main processing section for debugging symbols which - the initial read through the symbol tables needs to worry - about. If we reach this point, the symbol which we are - considering is definitely one we are interested in. - p must also contain the (valid) index into the namestring - which indicates the debugging type symbol. */ - - switch (p[1]) - { - case 'S': - { - unsigned long valu; - enum language tmp_language; - char *str, *p; - int n; - - valu = CUR_SYMBOL_VALUE; - if (valu) - valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - past_first_source_file = 1; - - p = strchr (namestring, ':'); - if (p) - n = p - namestring; - else - n = strlen (namestring); - str = alloca (n + 1); - strncpy (str, namestring, n); - str[n] = '\0'; - - if (psymfile_depth == 0) - { - if (!pst) - pst = os9k_start_psymtab (objfile, - str, valu, - cursymoffset, - symnum - 1, - objfile->global_psymbols.next, - objfile->static_psymbols.next); - } - else - { /* this is a include file */ - tmp_language = deduce_language_from_filename (str); - if (tmp_language != language_unknown - && (tmp_language != language_c - || psymtab_language != language_cplus)) - psymtab_language = tmp_language; - -/* - if (pst && STREQ (str, pst->filename)) - continue; - { - register int i; - for (i = 0; i < includes_used; i++) - if (STREQ (str, psymtab_include_list[i])) - { - i = -1; - break; - } - if (i == -1) - continue; - } - */ - - psymtab_include_list[includes_used++] = str; - if (includes_used >= includes_allocated) - { - char **orig = psymtab_include_list; - - psymtab_include_list = (char **) - alloca ((includes_allocated *= 2) * sizeof (char *)); - memcpy ((PTR) psymtab_include_list, (PTR) orig, - includes_used * sizeof (char *)); - } - - } - psymfile_depth++; - continue; - } - - case 'v': - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_STATIC, - &objfile->static_psymbols, - 0, CUR_SYMBOL_VALUE, - psymtab_language, objfile); - continue; - case 'V': - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_STATIC, - &objfile->global_psymbols, - 0, CUR_SYMBOL_VALUE, - psymtab_language, objfile); - continue; - - case 'T': - if (p != namestring) /* a name is there, not just :T... */ - { - add_psymbol_to_list (namestring, p - namestring, - STRUCT_NAMESPACE, LOC_TYPEDEF, - &objfile->static_psymbols, - CUR_SYMBOL_VALUE, 0, - psymtab_language, objfile); - if (p[2] == 't') - { - /* Also a typedef with the same name. */ - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_TYPEDEF, - &objfile->static_psymbols, - CUR_SYMBOL_VALUE, 0, psymtab_language, - objfile); - p += 1; - } - /* The semantics of C++ state that "struct foo { ... }" - also defines a typedef for "foo". Unfortuantely, cfront - never makes the typedef when translating from C++ to C. - We make the typedef here so that "ptype foo" works as - expected for cfront translated code. */ - else if (psymtab_language == language_cplus) - { - /* Also a typedef with the same name. */ - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_TYPEDEF, - &objfile->static_psymbols, - CUR_SYMBOL_VALUE, 0, psymtab_language, - objfile); - } - } - goto check_enum; - case 't': - if (p != namestring) /* a name is there, not just :T... */ - { - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_TYPEDEF, - &objfile->static_psymbols, - CUR_SYMBOL_VALUE, 0, - psymtab_language, objfile); - } - check_enum: - /* If this is an enumerated type, we need to - add all the enum constants to the partial symbol - table. This does not cover enums without names, e.g. - "enum {a, b} c;" in C, but fortunately those are - rare. There is no way for GDB to find those from the - enum type without spending too much time on it. Thus - to solve this problem, the compiler needs to put out the - enum in a nameless type. GCC2 does this. */ - - /* We are looking for something of the form - ":" ("t" | "T") [ "="] "e" - { ":" ","} ";". */ - - /* Skip over the colon and the 't' or 'T'. */ - p += 2; - /* This type may be given a number. Also, numbers can come - in pairs like (0,26). Skip over it. */ - while ((*p >= '0' && *p <= '9') - || *p == '(' || *p == ',' || *p == ')' - || *p == '=') - p++; - - if (*p++ == 'e') - { - /* We have found an enumerated type. skip size */ - while (*p >= '0' && *p <= '9') - p++; - /* According to comments in read_enum_type - a comma could end it instead of a semicolon. - I don't know where that happens. - Accept either. */ - while (*p && *p != ';' && *p != ',') - { - char *q; - - /* Check for and handle cretinous dbx symbol name - continuation! - if (*p == '\\') - p = next_symbol_text (objfile); - */ - - /* Point to the character after the name - of the enum constant. */ - for (q = p; *q && *q != ':'; q++) - ; - /* Note that the value doesn't matter for - enum constants in psymtabs, just in symtabs. */ - add_psymbol_to_list (p, q - p, - VAR_NAMESPACE, LOC_CONST, - &objfile->static_psymbols, 0, - 0, psymtab_language, objfile); - /* Point past the name. */ - p = q; - /* Skip over the value. */ - while (*p && *p != ',') - p++; - /* Advance past the comma. */ - if (*p) - p++; - } - } - continue; - case 'c': - /* Constant, e.g. from "const" in Pascal. */ - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_CONST, - &objfile->static_psymbols, CUR_SYMBOL_VALUE, - 0, psymtab_language, objfile); - continue; - - case 'f': - CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - if (pst && pst->textlow == 0) - pst->textlow = CUR_SYMBOL_VALUE; - - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_BLOCK, - &objfile->static_psymbols, CUR_SYMBOL_VALUE, - 0, psymtab_language, objfile); - continue; - - case 'F': - CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); - if (pst && pst->textlow == 0) - pst->textlow = CUR_SYMBOL_VALUE; - - add_psymbol_to_list (namestring, p - namestring, - VAR_NAMESPACE, LOC_BLOCK, - &objfile->global_psymbols, CUR_SYMBOL_VALUE, - 0, psymtab_language, objfile); - continue; - - case 'p': - case 'l': - case 's': - continue; - - case ':': - /* It is a C++ nested symbol. We don't need to record it - (I don't think); if we try to look up foo::bar::baz, - then symbols for the symtab containing foo should get - read in, I think. */ - /* Someone says sun cc puts out symbols like - /foo/baz/maclib::/usr/local/bin/maclib, - which would get here with a symbol type of ':'. */ - continue; - - default: - /* Unexpected symbol descriptor. The second and subsequent stabs - of a continued stab can show up here. The question is - whether they ever can mimic a normal stab--it would be - nice if not, since we certainly don't want to spend the - time searching to the end of every string looking for - a backslash. */ - - complain (&unknown_symchar_complaint, p[1]); - continue; - } - - case N_SYM_RBRAC: - CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); -#ifdef HANDLE_RBRAC - HANDLE_RBRAC (CUR_SYMBOL_VALUE); - continue; -#endif - case N_SYM_LBRAC: - continue; - - default: - /* If we haven't found it yet, ignore it. It's probably some - new type we don't know about yet. */ - complain (&unknown_symtype_complaint, - local_hex_string ((unsigned long) bufp->n_type)); - continue; - } - } - - DBX_SYMCOUNT (objfile) = symnum; - - /* If there's stuff to be cleaned up, clean it up. */ - if (DBX_SYMCOUNT (objfile) > 0 -/*FIXME, does this have a bug at start address 0? */ - && last_o_file_start - && objfile->ei.entry_point < bufp->n_value - && objfile->ei.entry_point >= last_o_file_start) - { - objfile->ei.entry_file_lowpc = last_o_file_start; - objfile->ei.entry_file_highpc = bufp->n_value; - } - - if (pst) - { - os9k_end_psymtab (pst, psymtab_include_list, includes_used, - symnum, end_of_text_addr, - dependency_list, dependencies_used); - } -/* - do_cleanups (back_to); - */ -} - -/* Allocate and partially fill a partial symtab. It will be - completely filled at the end of the symbol list. - - SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR - is the address relative to which its symbols are (incremental) or 0 - (normal). */ - - -static struct partial_symtab * -os9k_start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow, - int ldsymoff, int ldsymcnt, - struct partial_symbol **global_syms, - struct partial_symbol **static_syms) -{ - struct partial_symtab *result = - start_psymtab_common (objfile, objfile->section_offsets, - filename, textlow, global_syms, static_syms); - - result->read_symtab_private = (char *) - obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); - - LDSYMOFF (result) = ldsymoff; - LDSYMCNT (result) = ldsymcnt; - result->read_symtab = os9k_psymtab_to_symtab; - - /* Deduce the source language from the filename for this psymtab. */ - psymtab_language = deduce_language_from_filename (filename); - return result; -} - -/* Close off the current usage of PST. - Returns PST or NULL if the partial symtab was empty and thrown away. - FIXME: List variables and peculiarities of same. */ - -static struct partial_symtab * -os9k_end_psymtab (struct partial_symtab *pst, char **include_list, - int num_includes, int capping_symbol_cnt, - CORE_ADDR capping_text, - struct partial_symtab **dependency_list, - int number_dependencies) -{ - int i; - struct partial_symtab *p1; - struct objfile *objfile = pst->objfile; - - if (capping_symbol_cnt != -1) - LDSYMCNT (pst) = capping_symbol_cnt - LDSYMCNT (pst); - - /* Under Solaris, the N_SO symbols always have a value of 0, - instead of the usual address of the .o file. Therefore, - we have to do some tricks to fill in texthigh and textlow. - The first trick is in partial-stab.h: if we see a static - or global function, and the textlow for the current pst - is still 0, then we use that function's address for - the textlow of the pst. - - Now, to fill in texthigh, we remember the last function seen - in the .o file (also in partial-stab.h). Also, there's a hack in - bfd/elf.c and gdb/elfread.c to pass the ELF st_size field - to here via the misc_info field. Therefore, we can fill in - a reliable texthigh by taking the address plus size of the - last function in the file. - - Unfortunately, that does not cover the case where the last function - in the file is static. See the paragraph below for more comments - on this situation. - - Finally, if we have a valid textlow for the current file, we run - down the partial_symtab_list filling in previous texthighs that - are still unknown. */ - - if (pst->texthigh == 0 && last_function_name) - { - char *p; - int n; - struct minimal_symbol *minsym; - - p = strchr (last_function_name, ':'); - if (p == NULL) - p = last_function_name; - n = p - last_function_name; - p = alloca (n + 1); - strncpy (p, last_function_name, n); - p[n] = 0; - - minsym = lookup_minimal_symbol (p, NULL, objfile); - - if (minsym) - { - pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + (long) MSYMBOL_INFO (minsym); - } - else - { - /* This file ends with a static function, and it's - difficult to imagine how hard it would be to track down - the elf symbol. Luckily, most of the time no one will notice, - since the next file will likely be compiled with -g, so - the code below will copy the first fuction's start address - back to our texthigh variable. (Also, if this file is the - last one in a dynamically linked program, texthigh already - has the right value.) If the next file isn't compiled - with -g, then the last function in this file winds up owning - all of the text space up to the next -g file, or the end (minus - shared libraries). This only matters for single stepping, - and even then it will still work, except that it will single - step through all of the covered functions, instead of setting - breakpoints around them as it usualy does. This makes it - pretty slow, but at least it doesn't fail. - - We can fix this with a fairly big change to bfd, but we need - to coordinate better with Cygnus if we want to do that. FIXME. */ - } - last_function_name = NULL; - } - - /* this test will be true if the last .o file is only data */ - if (pst->textlow == 0) - pst->textlow = pst->texthigh; - - /* If we know our own starting text address, then walk through all other - psymtabs for this objfile, and if any didn't know their ending text - address, set it to our starting address. Take care to not set our - own ending address to our starting address, nor to set addresses on - `dependency' files that have both textlow and texthigh zero. */ - if (pst->textlow) - { - ALL_OBJFILE_PSYMTABS (objfile, p1) - { - if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst) - { - p1->texthigh = pst->textlow; - /* if this file has only data, then make textlow match texthigh */ - if (p1->textlow == 0) - p1->textlow = p1->texthigh; - } - } - } - - /* End of kludge for patching Solaris textlow and texthigh. */ - - pst->n_global_syms = - objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); - pst->n_static_syms = - objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset); - - pst->number_of_dependencies = number_dependencies; - if (number_dependencies) - { - pst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, - number_dependencies * sizeof (struct partial_symtab *)); - memcpy (pst->dependencies, dependency_list, - number_dependencies * sizeof (struct partial_symtab *)); - } - else - pst->dependencies = 0; - - for (i = 0; i < num_includes; i++) - { - struct partial_symtab *subpst = - allocate_psymtab (include_list[i], objfile); - - subpst->section_offsets = pst->section_offsets; - subpst->read_symtab_private = - (char *) obstack_alloc (&objfile->psymbol_obstack, - sizeof (struct symloc)); - LDSYMOFF (subpst) = - LDSYMCNT (subpst) = - subpst->textlow = - subpst->texthigh = 0; - - /* We could save slight bits of space by only making one of these, - shared by the entire set of include files. FIXME-someday. */ - subpst->dependencies = (struct partial_symtab **) - obstack_alloc (&objfile->psymbol_obstack, - sizeof (struct partial_symtab *)); - subpst->dependencies[0] = pst; - subpst->number_of_dependencies = 1; - - subpst->globals_offset = - subpst->n_global_syms = - subpst->statics_offset = - subpst->n_static_syms = 0; - - subpst->readin = 0; - subpst->symtab = 0; - subpst->read_symtab = pst->read_symtab; - } - - sort_pst_symbols (pst); - - /* If there is already a psymtab or symtab for a file of this name, - remove it. - (If there is a symtab, more drastic things also happen.) - This happens in VxWorks. */ - free_named_symtabs (pst->filename); - - if (num_includes == 0 - && number_dependencies == 0 - && pst->n_global_syms == 0 - && pst->n_static_syms == 0) - { - /* Throw away this psymtab, it's empty. We can't deallocate it, since - it is on the obstack, but we can forget to chain it on the list. */ - /* Indicate that psymtab was thrown away. */ - - discard_psymtab (pst); - - pst = (struct partial_symtab *) NULL; - } - return pst; -} - -static void -os9k_psymtab_to_symtab_1 (struct partial_symtab *pst) -{ - struct cleanup *old_chain; - int i; - - if (!pst) - return; - - if (pst->readin) - { - fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", - pst->filename); - return; - } - - /* Read in all partial symtabs on which this one is dependent */ - for (i = 0; i < pst->number_of_dependencies; i++) - if (!pst->dependencies[i]->readin) - { - /* Inform about additional files that need to be read in. */ - if (info_verbose) - { - fputs_filtered (" ", gdb_stdout); - wrap_here (""); - fputs_filtered ("and ", gdb_stdout); - wrap_here (""); - printf_filtered ("%s...", pst->dependencies[i]->filename); - wrap_here (""); /* Flush output */ - gdb_flush (gdb_stdout); - } - os9k_psymtab_to_symtab_1 (pst->dependencies[i]); - } - - if (LDSYMCNT (pst)) /* Otherwise it's a dummy */ - { - /* Init stuff necessary for reading in symbols */ - stabsread_init (); - buildsym_init (); - old_chain = make_cleanup (really_free_pendings, 0); - - /* Read in this file's symbols */ - os9k_read_ofile_symtab (pst); - sort_symtab_syms (pst->symtab); - do_cleanups (old_chain); - } - - pst->readin = 1; -} - -/* Read in all of the symbols for a given psymtab for real. - Be verbose about it if the user wants that. */ - -static void -os9k_psymtab_to_symtab (struct partial_symtab *pst) -{ - bfd *sym_bfd; - - if (!pst) - return; - - if (pst->readin) - { - fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", - pst->filename); - return; - } - - if (LDSYMCNT (pst) || pst->number_of_dependencies) - { - /* Print the message now, before reading the string table, - to avoid disconcerting pauses. */ - if (info_verbose) - { - printf_filtered ("Reading in symbols for %s...", pst->filename); - gdb_flush (gdb_stdout); - } - - sym_bfd = pst->objfile->obfd; - os9k_psymtab_to_symtab_1 (pst); - - /* Match with global symbols. This only needs to be done once, - after all of the symtabs and dependencies have been read in. */ - scan_file_globals (pst->objfile); - - /* Finish up the debug error message. */ - if (info_verbose) - printf_filtered ("done.\n"); - } -} - -/* Read in a defined section of a specific object file's symbols. */ -static void -os9k_read_ofile_symtab (struct partial_symtab *pst) -{ - register struct internal_symstruct *bufp; - unsigned char type; - unsigned max_symnum; - register bfd *abfd; - struct objfile *objfile; - int sym_offset; /* Offset to start of symbols to read */ - CORE_ADDR text_offset; /* Start of text segment for symbols */ - int text_size; /* Size of text segment for symbols */ - FILE *dbg_file; - - objfile = pst->objfile; - sym_offset = LDSYMOFF (pst); - max_symnum = LDSYMCNT (pst); - text_offset = pst->textlow; - text_size = pst->texthigh - pst->textlow; - - current_objfile = objfile; - subfile_stack = NULL; - last_source_file = NULL; - - abfd = objfile->obfd; - dbg_file = objfile->auxf2; - -#if 0 - /* It is necessary to actually read one symbol *before* the start - of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL - occurs before the N_SO symbol. - Detecting this in read_dbx_symtab - would slow down initial readin, so we look for it here instead. */ - if (!processing_acc_compilation && sym_offset >= (int) symbol_size) - { - fseek (objefile->auxf2, sym_offset, SEEK_CUR); - fill_sym (objfile->auxf2, abfd); - bufp = symbuf; - - processing_gcc_compilation = 0; - if (bufp->n_type == N_TEXT) - { - if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) - processing_gcc_compilation = 1; - else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) - processing_gcc_compilation = 2; - } - - /* Try to select a C++ demangling based on the compilation unit - producer. */ - - if (processing_gcc_compilation) - { - if (AUTO_DEMANGLING) - { - set_demangling_style (GNU_DEMANGLING_STYLE_STRING); - } - } - } - else - { - /* The N_SO starting this symtab is the first symbol, so we - better not check the symbol before it. I'm not this can - happen, but it doesn't hurt to check for it. */ - bfd_seek (symfile_bfd, sym_offset, SEEK_CUR); - processing_gcc_compilation = 0; - } -#endif /* 0 */ - - fseek (dbg_file, (long) sym_offset, 0); -/* - if (bufp->n_type != (unsigned char)N_SYM_SYM) - error("First symbol in segment of executable not a source symbol"); - */ - - for (symnum = 0; symnum < max_symnum; symnum++) - { - QUIT; /* Allow this to be interruptable */ - fill_sym (dbg_file, abfd); - bufp = symbuf; - type = bufp->n_type; - - os9k_process_one_symbol ((int) type, (int) bufp->n_desc, - (CORE_ADDR) bufp->n_value, bufp->n_strx, pst->section_offsets, objfile); - - /* We skip checking for a new .o or -l file; that should never - happen in this routine. */ -#if 0 - else - if (type == N_TEXT) - { - /* I don't think this code will ever be executed, because - the GCC_COMPILED_FLAG_SYMBOL usually is right before - the N_SO symbol which starts this source file. - However, there is no reason not to accept - the GCC_COMPILED_FLAG_SYMBOL anywhere. */ - - if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) - processing_gcc_compilation = 1; - else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) - processing_gcc_compilation = 2; - - if (AUTO_DEMANGLING) - { - set_demangling_style (GNU_DEMANGLING_STYLE_STRING); - } - } - else if (type & N_EXT || type == (unsigned char) N_TEXT - || type == (unsigned char) N_NBTEXT - ) - { - /* Global symbol: see if we came across a dbx defintion for - a corresponding symbol. If so, store the value. Remove - syms from the chain when their values are stored, but - search the whole chain, as there may be several syms from - different files with the same name. */ - /* This is probably not true. Since the files will be read - in one at a time, each reference to a global symbol will - be satisfied in each file as it appears. So we skip this - section. */ - ; - } -#endif /* 0 */ - } - - current_objfile = NULL; - - /* In a Solaris elf file, this variable, which comes from the - value of the N_SO symbol, will still be 0. Luckily, text_offset, - which comes from pst->textlow is correct. */ - if (last_source_start_addr == 0) - last_source_start_addr = text_offset; - pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); - end_stabs (); -} - - -/* This handles a single symbol from the symbol-file, building symbols - into a GDB symtab. It takes these arguments and an implicit argument. - - TYPE is the type field of the ".stab" symbol entry. - DESC is the desc field of the ".stab" entry. - VALU is the value field of the ".stab" entry. - NAME is the symbol name, in our address space. - SECTION_OFFSETS is a set of amounts by which the sections of this object - file were relocated when it was loaded into memory. - All symbols that refer - to memory locations need to be offset by these amounts. - OBJFILE is the object file from which we are reading symbols. - It is used in end_symtab. */ - -static void -os9k_process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, - struct section_offsets *section_offsets, - struct objfile *objfile) -{ - register struct context_stack *new; - /* The stab type used for the definition of the last function. - N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers. */ - static int function_stab_type = 0; - -#if 0 - /* Something is wrong if we see real data before - seeing a source file name. */ - if (last_source_file == NULL && type != (unsigned char) N_SO) - { - /* Ignore any symbols which appear before an N_SO symbol. - Currently no one puts symbols there, but we should deal - gracefully with the case. A complain()t might be in order, - but this should not be an error (). */ - return; - } -#endif /* 0 */ - - switch (type) - { - case N_SYM_LBRAC: - /* On most machines, the block addresses are relative to the - N_SO, the linker did not relocate them (sigh). */ - valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - new = push_context (desc, valu); - break; - - case N_SYM_RBRAC: - valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - new = pop_context (); - -#if !defined (OS9K_VARIABLES_INSIDE_BLOCK) -#define OS9K_VARIABLES_INSIDE_BLOCK(desc, gcc_p) 1 -#endif - - if (!OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) - local_symbols = new->locals; - - if (context_stack_depth > 1) - { - /* This is not the outermost LBRAC...RBRAC pair in the function, - its local symbols preceded it, and are the ones just recovered - from the context stack. Define the block for them (but don't - bother if the block contains no symbols. Should we complain - on blocks without symbols? I can't think of any useful purpose - for them). */ - if (local_symbols != NULL) - { - /* Muzzle a compiler bug that makes end < start. (which - compilers? Is this ever harmful?). */ - if (new->start_addr > valu) - { - complain (&lbrac_rbrac_complaint); - new->start_addr = valu; - } - /* Make a block for the local symbols within. */ - finish_block (0, &local_symbols, new->old_blocks, - new->start_addr, valu, objfile); - } - } - else - { - if (context_stack_depth == 0) - { - within_function = 0; - /* Make a block for the local symbols within. */ - finish_block (new->name, &local_symbols, new->old_blocks, - new->start_addr, valu, objfile); - } - else - { - /* attach local_symbols to the end of new->locals */ - if (!new->locals) - new->locals = local_symbols; - else - { - struct pending *p; - - p = new->locals; - while (p->next) - p = p->next; - p->next = local_symbols; - } - } - } - - if (OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) - /* Now pop locals of block just finished. */ - local_symbols = new->locals; - break; - - - case N_SYM_SLINE: - /* This type of "symbol" really just records - one line-number -- core-address correspondence. - Enter it in the line list for this symbol table. */ - /* Relocate for dynamic loading and for ELF acc fn-relative syms. */ - valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - /* FIXME: loses if sizeof (char *) > sizeof (int) */ - gdb_assert (sizeof (name) <= sizeof (int)); - record_line (current_subfile, (int) name, valu); - break; - - /* The following symbol types need to have the appropriate offset added - to their value; then we process symbol definitions in the name. */ - case N_SYM_SYM: - - if (name) - { - char deftype; - char *dirn, *n; - char *p = strchr (name, ':'); - if (p == NULL) - deftype = '\0'; - else - deftype = p[1]; - - - switch (deftype) - { - case 'S': - valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - n = strrchr (name, '/'); - if (n != NULL) - { - *n = '\0'; - n++; - dirn = name; - } - else - { - n = name; - dirn = NULL; - } - *p = '\0'; - if (symfile_depth++ == 0) - { - if (last_source_file) - { - end_symtab (valu, objfile, SECT_OFF_TEXT (objfile)); - end_stabs (); - } - start_stabs (); - os9k_stabs = 1; - start_symtab (n, dirn, valu); - record_debugformat ("OS9"); - } - else - { - push_subfile (); - start_subfile (n, dirn != NULL ? dirn : current_subfile->dirname); - } - break; - - case 'f': - case 'F': - valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); - function_stab_type = type; - - within_function = 1; - new = push_context (0, valu); - new->name = define_symbol (valu, name, desc, type, objfile); - break; - - case 'V': - case 'v': - valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile)); - define_symbol (valu, name, desc, type, objfile); - break; - - default: - define_symbol (valu, name, desc, type, objfile); - break; - } - } - break; - - case N_SYM_SE: - if (--symfile_depth != 0) - start_subfile (pop_subfile (), current_subfile->dirname); - break; - - default: - complain (&unknown_symtype_complaint, - local_hex_string ((unsigned long) type)); - /* FALLTHROUGH */ - break; - - case N_SYM_CMPLR: - break; - } - previous_stab_code = type; -} - -static struct sym_fns os9k_sym_fns = -{ - bfd_target_os9k_flavour, - os9k_new_init, /* sym_new_init: init anything gbl to entire symtab */ - os9k_symfile_init, /* sym_init: read initial info, setup for sym_read() */ - os9k_symfile_read, /* sym_read: read a symbol file into symtab */ - os9k_symfile_finish, /* sym_finish: finished with file, cleanup */ - default_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */ - NULL /* next: pointer to next struct sym_fns */ -}; - -void -_initialize_os9kread (void) -{ - add_symtab_fns (&os9k_sym_fns); -} +// OBSOLETE /* Read os9/os9k symbol tables and convert to internal format, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, +// OBSOLETE 1996, 1997, 1998, 1999, 2000, 2001 +// 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 /* This module provides three functions: os9k_symfile_init, +// OBSOLETE which initializes to read a symbol file; os9k_new_init, which +// OBSOLETE discards existing cached information when all symbols are being +// OBSOLETE discarded; and os9k_symfile_read, which reads a symbol table +// OBSOLETE from a file. +// OBSOLETE +// OBSOLETE os9k_symfile_read only does the minimum work necessary for letting the +// OBSOLETE user "name" things symbolically; it does not read the entire symtab. +// OBSOLETE Instead, it reads the external and static symbols and puts them in partial +// OBSOLETE symbol tables. When more extensive information is requested of a +// OBSOLETE file, the corresponding partial symbol table is mutated into a full +// OBSOLETE fledged symbol table by going back and reading the symbols +// OBSOLETE for real. os9k_psymtab_to_symtab() is the function that does this */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "gdb_string.h" +// OBSOLETE #include "gdb_assert.h" +// OBSOLETE #include +// OBSOLETE +// OBSOLETE #if defined(USG) || defined(__CYGNUSCLIB__) +// OBSOLETE #include +// OBSOLETE #include +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #include "obstack.h" +// OBSOLETE #include "gdb_stat.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "breakpoint.h" +// OBSOLETE #include "command.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "gdbcore.h" /* for bfd stuff */ +// OBSOLETE #include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */ +// OBSOLETE #include "symfile.h" +// OBSOLETE #include "objfiles.h" +// OBSOLETE #include "buildsym.h" +// OBSOLETE #include "gdb-stabs.h" +// OBSOLETE #include "demangle.h" +// OBSOLETE #include "language.h" /* Needed inside partial-stab.h */ +// OBSOLETE #include "complaints.h" +// OBSOLETE #include "os9k.h" +// OBSOLETE #include "stabsread.h" +// OBSOLETE +// OBSOLETE extern void _initialize_os9kread (void); +// OBSOLETE +// OBSOLETE /* Each partial symbol table entry contains a pointer to private data for the +// OBSOLETE read_symtab() function to use when expanding a partial symbol table entry +// OBSOLETE to a full symbol table entry. +// OBSOLETE +// OBSOLETE For dbxread this structure contains the offset within the file symbol table +// OBSOLETE of first local symbol for this file, and count of the section +// OBSOLETE of the symbol table devoted to this file's symbols (actually, the section +// OBSOLETE bracketed may contain more than just this file's symbols). It also contains +// OBSOLETE further information needed to locate the symbols if they are in an ELF file. +// OBSOLETE +// OBSOLETE If ldsymcnt is 0, the only reason for this thing's existence is the +// OBSOLETE dependency list. Nothing else will happen when it is read in. */ +// OBSOLETE +// OBSOLETE #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff) +// OBSOLETE #define LDSYMCNT(p) (((struct symloc *)((p)->read_symtab_private))->ldsymnum) +// OBSOLETE +// OBSOLETE struct symloc +// OBSOLETE { +// OBSOLETE int ldsymoff; +// OBSOLETE int ldsymnum; +// OBSOLETE }; +// OBSOLETE +// OBSOLETE /* Remember what we deduced to be the source language of this psymtab. */ +// OBSOLETE static enum language psymtab_language = language_unknown; +// OBSOLETE +// OBSOLETE /* keep partial symbol table file nested depth */ +// OBSOLETE static int psymfile_depth = 0; +// OBSOLETE +// OBSOLETE /* keep symbol table file nested depth */ +// OBSOLETE static int symfile_depth = 0; +// OBSOLETE +// OBSOLETE extern int previous_stab_code; +// OBSOLETE +// OBSOLETE /* Name of last function encountered. Used in Solaris to approximate +// OBSOLETE object file boundaries. */ +// OBSOLETE static char *last_function_name; +// OBSOLETE +// OBSOLETE /* Complaints about the symbols we have encountered. */ +// OBSOLETE extern struct complaint lbrac_complaint; +// OBSOLETE +// OBSOLETE extern struct complaint unknown_symtype_complaint; +// OBSOLETE +// OBSOLETE extern struct complaint unknown_symchar_complaint; +// OBSOLETE +// OBSOLETE extern struct complaint lbrac_rbrac_complaint; +// OBSOLETE +// OBSOLETE extern struct complaint repeated_header_complaint; +// OBSOLETE +// OBSOLETE extern struct complaint repeated_header_name_complaint; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE static struct complaint lbrac_unmatched_complaint = +// OBSOLETE {"unmatched Increment Block Entry before symtab pos %d", 0, 0}; +// OBSOLETE +// OBSOLETE static struct complaint lbrac_mismatch_complaint = +// OBSOLETE {"IBE/IDE symbol mismatch at symtab pos %d", 0, 0}; +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* Local function prototypes */ +// OBSOLETE +// OBSOLETE static void read_minimal_symbols (struct objfile *); +// OBSOLETE +// OBSOLETE static void os9k_read_ofile_symtab (struct partial_symtab *); +// OBSOLETE +// OBSOLETE static void os9k_psymtab_to_symtab (struct partial_symtab *); +// OBSOLETE +// OBSOLETE static void os9k_psymtab_to_symtab_1 (struct partial_symtab *); +// OBSOLETE +// OBSOLETE static void read_os9k_psymtab (struct objfile *, CORE_ADDR, int); +// OBSOLETE +// OBSOLETE static int fill_sym (FILE *, bfd *); +// OBSOLETE +// OBSOLETE static void os9k_symfile_init (struct objfile *); +// OBSOLETE +// OBSOLETE static void os9k_new_init (struct objfile *); +// OBSOLETE +// OBSOLETE static void os9k_symfile_read (struct objfile *, int); +// OBSOLETE +// OBSOLETE static void os9k_symfile_finish (struct objfile *); +// OBSOLETE +// OBSOLETE static void os9k_process_one_symbol (int, int, CORE_ADDR, char *, +// OBSOLETE struct section_offsets *, +// OBSOLETE struct objfile *); +// OBSOLETE +// OBSOLETE static struct partial_symtab *os9k_start_psymtab (struct objfile *, char *, +// OBSOLETE CORE_ADDR, int, int, +// OBSOLETE struct partial_symbol **, +// OBSOLETE struct partial_symbol **); +// OBSOLETE +// OBSOLETE static struct partial_symtab *os9k_end_psymtab (struct partial_symtab *, +// OBSOLETE char **, int, int, CORE_ADDR, +// OBSOLETE struct partial_symtab **, +// OBSOLETE int); +// OBSOLETE +// OBSOLETE static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *); +// OBSOLETE +// OBSOLETE #define HANDLE_RBRAC(val) \ +// OBSOLETE if ((val) > pst->texthigh) pst->texthigh = (val); +// OBSOLETE +// OBSOLETE #define SWAP_STBHDR(hdrp, abfd) \ +// OBSOLETE { \ +// OBSOLETE (hdrp)->fmtno = bfd_get_16(abfd, (unsigned char *)&(hdrp)->fmtno); \ +// OBSOLETE (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \ +// OBSOLETE (hdrp)->offset = bfd_get_32(abfd, (unsigned char *)&(hdrp)->offset); \ +// OBSOLETE (hdrp)->nsym = bfd_get_32(abfd, (unsigned char *)&(hdrp)->nsym); \ +// OBSOLETE } +// OBSOLETE #define SWAP_STBSYM(symp, abfd) \ +// OBSOLETE { \ +// OBSOLETE (symp)->value = bfd_get_32(abfd, (unsigned char *)&(symp)->value); \ +// OBSOLETE (symp)->type = bfd_get_16(abfd, (unsigned char *)&(symp)->type); \ +// OBSOLETE (symp)->stroff = bfd_get_32(abfd, (unsigned char *)&(symp)->stroff); \ +// OBSOLETE } +// OBSOLETE #define N_DATA 0 +// OBSOLETE #define N_BSS 1 +// OBSOLETE #define N_RDATA 2 +// OBSOLETE #define N_IDATA 3 +// OBSOLETE #define N_TEXT 4 +// OBSOLETE #define N_ABS 6 +// OBSOLETE +// OBSOLETE static void +// OBSOLETE record_minimal_symbol (char *name, CORE_ADDR address, int type, +// OBSOLETE struct objfile *objfile) +// OBSOLETE { +// OBSOLETE enum minimal_symbol_type ms_type; +// OBSOLETE +// OBSOLETE switch (type) +// OBSOLETE { +// OBSOLETE case N_TEXT: +// OBSOLETE ms_type = mst_text; +// OBSOLETE address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE break; +// OBSOLETE case N_DATA: +// OBSOLETE ms_type = mst_data; +// OBSOLETE break; +// OBSOLETE case N_BSS: +// OBSOLETE ms_type = mst_bss; +// OBSOLETE break; +// OBSOLETE case N_RDATA: +// OBSOLETE ms_type = mst_bss; +// OBSOLETE break; +// OBSOLETE case N_IDATA: +// OBSOLETE ms_type = mst_data; +// OBSOLETE break; +// OBSOLETE case N_ABS: +// OBSOLETE ms_type = mst_abs; +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE ms_type = mst_unknown; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE prim_record_minimal_symbol (name, address, ms_type, objfile); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* read and process .stb file and store in minimal symbol table */ +// OBSOLETE typedef char mhhdr[80]; +// OBSOLETE struct stbhdr +// OBSOLETE { +// OBSOLETE mhhdr comhdr; +// OBSOLETE char *name; +// OBSOLETE short fmtno; +// OBSOLETE int crc; +// OBSOLETE int offset; +// OBSOLETE int nsym; +// OBSOLETE char *pad; +// OBSOLETE }; +// OBSOLETE struct stbsymbol +// OBSOLETE { +// OBSOLETE int value; +// OBSOLETE short type; +// OBSOLETE int stroff; +// OBSOLETE }; +// OBSOLETE #define STBSYMSIZE 10 +// OBSOLETE +// OBSOLETE static void +// OBSOLETE read_minimal_symbols (struct objfile *objfile) +// OBSOLETE { +// OBSOLETE FILE *fp; +// OBSOLETE bfd *abfd; +// OBSOLETE struct stbhdr hdr; +// OBSOLETE struct stbsymbol sym; +// OBSOLETE int ch, i, j, off; +// OBSOLETE char buf[64], buf1[128]; +// OBSOLETE +// OBSOLETE fp = objfile->auxf1; +// OBSOLETE if (fp == NULL) +// OBSOLETE return; +// OBSOLETE abfd = objfile->obfd; +// OBSOLETE fread (&hdr.comhdr[0], sizeof (mhhdr), 1, fp); +// OBSOLETE i = 0; +// OBSOLETE ch = getc (fp); +// OBSOLETE while (ch != -1) +// OBSOLETE { +// OBSOLETE buf[i] = (char) ch; +// OBSOLETE i++; +// OBSOLETE if (ch == 0) +// OBSOLETE break; +// OBSOLETE ch = getc (fp); +// OBSOLETE }; +// OBSOLETE if (i % 2) +// OBSOLETE ch = getc (fp); +// OBSOLETE hdr.name = &buf[0]; +// OBSOLETE +// OBSOLETE fread (&hdr.fmtno, sizeof (hdr.fmtno), 1, fp); +// OBSOLETE fread (&hdr.crc, sizeof (hdr.crc), 1, fp); +// OBSOLETE fread (&hdr.offset, sizeof (hdr.offset), 1, fp); +// OBSOLETE fread (&hdr.nsym, sizeof (hdr.nsym), 1, fp); +// OBSOLETE SWAP_STBHDR (&hdr, abfd); +// OBSOLETE +// OBSOLETE /* read symbols */ +// OBSOLETE init_minimal_symbol_collection (); +// OBSOLETE off = hdr.offset; +// OBSOLETE for (i = hdr.nsym; i > 0; i--) +// OBSOLETE { +// OBSOLETE fseek (fp, (long) off, 0); +// OBSOLETE fread (&sym.value, sizeof (sym.value), 1, fp); +// OBSOLETE fread (&sym.type, sizeof (sym.type), 1, fp); +// OBSOLETE fread (&sym.stroff, sizeof (sym.stroff), 1, fp); +// OBSOLETE SWAP_STBSYM (&sym, abfd); +// OBSOLETE fseek (fp, (long) sym.stroff, 0); +// OBSOLETE j = 0; +// OBSOLETE ch = getc (fp); +// OBSOLETE while (ch != -1) +// OBSOLETE { +// OBSOLETE buf1[j] = (char) ch; +// OBSOLETE j++; +// OBSOLETE if (ch == 0) +// OBSOLETE break; +// OBSOLETE ch = getc (fp); +// OBSOLETE }; +// OBSOLETE record_minimal_symbol (buf1, sym.value, sym.type & 7, objfile); +// OBSOLETE off += STBSYMSIZE; +// OBSOLETE }; +// OBSOLETE install_minimal_symbols (objfile); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Scan and build partial symbols for a symbol file. +// OBSOLETE We have been initialized by a call to os9k_symfile_init, which +// OBSOLETE put all the relevant info into a "struct os9k_symfile_info", +// OBSOLETE hung off the objfile structure. +// OBSOLETE +// OBSOLETE MAINLINE is true if we are reading the main symbol +// OBSOLETE table (as opposed to a shared lib or dynamically loaded file). */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_symfile_read (struct objfile *objfile, int mainline) +// OBSOLETE { +// OBSOLETE bfd *sym_bfd; +// OBSOLETE struct cleanup *back_to; +// OBSOLETE +// OBSOLETE sym_bfd = objfile->obfd; +// OBSOLETE /* If we are reinitializing, or if we have never loaded syms yet, init */ +// OBSOLETE if (mainline +// OBSOLETE || (objfile->global_psymbols.size == 0 +// OBSOLETE && objfile->static_psymbols.size == 0)) +// OBSOLETE init_psymbol_list (objfile, DBX_SYMCOUNT (objfile)); +// OBSOLETE +// OBSOLETE free_pending_blocks (); +// OBSOLETE back_to = make_cleanup (really_free_pendings, 0); +// OBSOLETE +// OBSOLETE make_cleanup_discard_minimal_symbols (); +// OBSOLETE read_minimal_symbols (objfile); +// OBSOLETE +// OBSOLETE /* Now that the symbol table data of the executable file are all in core, +// OBSOLETE process them and define symbols accordingly. */ +// OBSOLETE read_os9k_psymtab (objfile, +// OBSOLETE DBX_TEXT_ADDR (objfile), +// OBSOLETE DBX_TEXT_SIZE (objfile)); +// OBSOLETE +// OBSOLETE do_cleanups (back_to); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Initialize anything that needs initializing when a completely new +// OBSOLETE symbol file is specified (not just adding some symbols from another +// OBSOLETE file, e.g. a shared library). */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_new_init (struct objfile *ignore) +// OBSOLETE { +// OBSOLETE stabsread_new_init (); +// OBSOLETE buildsym_new_init (); +// OBSOLETE psymfile_depth = 0; +// OBSOLETE /* +// OBSOLETE init_header_files (); +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* os9k_symfile_init () +// OBSOLETE It is passed a struct objfile which contains, among other things, +// OBSOLETE the BFD for the file whose symbols are being read, and a slot for a pointer +// OBSOLETE to "private data" which we fill with goodies. +// OBSOLETE +// OBSOLETE Since BFD doesn't know how to read debug symbols in a format-independent +// OBSOLETE way (and may never do so...), we have to do it ourselves. We will never +// OBSOLETE be called unless this is an a.out (or very similar) file. +// OBSOLETE FIXME, there should be a cleaner peephole into the BFD environment here. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_symfile_init (struct objfile *objfile) +// OBSOLETE { +// OBSOLETE bfd *sym_bfd = objfile->obfd; +// OBSOLETE char *name = bfd_get_filename (sym_bfd); +// OBSOLETE char dbgname[512], stbname[512]; +// OBSOLETE FILE *symfile = 0; +// OBSOLETE FILE *minfile = 0; +// OBSOLETE asection *text_sect; +// OBSOLETE +// OBSOLETE strcpy (dbgname, name); +// OBSOLETE strcat (dbgname, ".dbg"); +// OBSOLETE strcpy (stbname, name); +// OBSOLETE strcat (stbname, ".stb"); +// OBSOLETE +// OBSOLETE if ((symfile = fopen (dbgname, "r")) == NULL) +// OBSOLETE { +// OBSOLETE warning ("Symbol file %s not found", dbgname); +// OBSOLETE } +// OBSOLETE objfile->auxf2 = symfile; +// OBSOLETE +// OBSOLETE if ((minfile = fopen (stbname, "r")) == NULL) +// OBSOLETE { +// OBSOLETE warning ("Symbol file %s not found", stbname); +// OBSOLETE } +// OBSOLETE objfile->auxf1 = minfile; +// OBSOLETE +// OBSOLETE /* Allocate struct to keep track of the symfile */ +// OBSOLETE objfile->sym_stab_info = (struct dbx_symfile_info *) +// OBSOLETE xmmalloc (objfile->md, sizeof (struct dbx_symfile_info)); +// OBSOLETE DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL; +// OBSOLETE +// OBSOLETE text_sect = bfd_get_section_by_name (sym_bfd, ".text"); +// OBSOLETE if (!text_sect) +// OBSOLETE error ("Can't find .text section in file"); +// OBSOLETE DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect); +// OBSOLETE DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect); +// OBSOLETE +// OBSOLETE DBX_SYMBOL_SIZE (objfile) = 0; /* variable size symbol */ +// OBSOLETE DBX_SYMCOUNT (objfile) = 0; /* used to be bfd_get_symcount(sym_bfd) */ +// OBSOLETE DBX_SYMTAB_OFFSET (objfile) = 0; /* used to be SYMBOL_TABLE_OFFSET */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Perform any local cleanups required when we are done with a particular +// OBSOLETE objfile. I.E, we are in the process of discarding all symbol information +// OBSOLETE for an objfile, freeing up all memory held for it, and unlinking the +// OBSOLETE objfile struct from the global list of known objfiles. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_symfile_finish (struct objfile *objfile) +// OBSOLETE { +// OBSOLETE if (objfile->sym_stab_info != NULL) +// OBSOLETE { +// OBSOLETE xmfree (objfile->md, objfile->sym_stab_info); +// OBSOLETE } +// OBSOLETE /* +// OBSOLETE free_header_files (); +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE struct st_dbghdr +// OBSOLETE { +// OBSOLETE int sync; +// OBSOLETE short rev; +// OBSOLETE int crc; +// OBSOLETE short os; +// OBSOLETE short cpu; +// OBSOLETE }; +// OBSOLETE #define SYNC (int)0xefbefeca +// OBSOLETE +// OBSOLETE #define SWAP_DBGHDR(hdrp, abfd) \ +// OBSOLETE { \ +// OBSOLETE (hdrp)->sync = bfd_get_32(abfd, (unsigned char *)&(hdrp)->sync); \ +// OBSOLETE (hdrp)->rev = bfd_get_16(abfd, (unsigned char *)&(hdrp)->rev); \ +// OBSOLETE (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \ +// OBSOLETE (hdrp)->os = bfd_get_16(abfd, (unsigned char *)&(hdrp)->os); \ +// OBSOLETE (hdrp)->cpu = bfd_get_16(abfd, (unsigned char *)&(hdrp)->cpu); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define N_SYM_CMPLR 0 +// OBSOLETE #define N_SYM_SLINE 1 +// OBSOLETE #define N_SYM_SYM 2 +// OBSOLETE #define N_SYM_LBRAC 3 +// OBSOLETE #define N_SYM_RBRAC 4 +// OBSOLETE #define N_SYM_SE 5 +// OBSOLETE +// OBSOLETE struct internal_symstruct +// OBSOLETE { +// OBSOLETE short n_type; +// OBSOLETE short n_desc; +// OBSOLETE long n_value; +// OBSOLETE char *n_strx; +// OBSOLETE }; +// OBSOLETE static struct internal_symstruct symbol; +// OBSOLETE static struct internal_symstruct *symbuf = &symbol; +// OBSOLETE static char strbuf[4096]; +// OBSOLETE static struct st_dbghdr dbghdr; +// OBSOLETE static short cmplrid; +// OBSOLETE +// OBSOLETE #define VER_PRE_ULTRAC ((short)4) +// OBSOLETE #define VER_ULTRAC ((short)5) +// OBSOLETE +// OBSOLETE static int +// OBSOLETE fill_sym (FILE *dbg_file, bfd *abfd) +// OBSOLETE { +// OBSOLETE short si, nmask; +// OBSOLETE long li; +// OBSOLETE int ii; +// OBSOLETE char *p; +// OBSOLETE +// OBSOLETE int nbytes = fread (&si, sizeof (si), 1, dbg_file); +// OBSOLETE if (nbytes == 0) +// OBSOLETE return 0; +// OBSOLETE if (nbytes < 0) +// OBSOLETE perror_with_name ("reading .dbg file."); +// OBSOLETE symbuf->n_desc = 0; +// OBSOLETE symbuf->n_value = 0; +// OBSOLETE symbuf->n_strx = NULL; +// OBSOLETE symbuf->n_type = bfd_get_16 (abfd, (unsigned char *) &si); +// OBSOLETE symbuf->n_type = 0xf & symbuf->n_type; +// OBSOLETE switch (symbuf->n_type) +// OBSOLETE { +// OBSOLETE case N_SYM_CMPLR: +// OBSOLETE fread (&si, sizeof (si), 1, dbg_file); +// OBSOLETE symbuf->n_desc = bfd_get_16 (abfd, (unsigned char *) &si); +// OBSOLETE cmplrid = symbuf->n_desc & 0xff; +// OBSOLETE break; +// OBSOLETE case N_SYM_SLINE: +// OBSOLETE fread (&li, sizeof (li), 1, dbg_file); +// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); +// OBSOLETE fread (&li, sizeof (li), 1, dbg_file); +// OBSOLETE li = bfd_get_32 (abfd, (unsigned char *) &li); +// OBSOLETE symbuf->n_strx = (char *) (li >> 12); +// OBSOLETE symbuf->n_desc = li & 0xfff; +// OBSOLETE break; +// OBSOLETE case N_SYM_SYM: +// OBSOLETE fread (&li, sizeof (li), 1, dbg_file); +// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); +// OBSOLETE si = 0; +// OBSOLETE do +// OBSOLETE { +// OBSOLETE ii = getc (dbg_file); +// OBSOLETE strbuf[si++] = (char) ii; +// OBSOLETE } +// OBSOLETE while (ii != 0 || si % 2 != 0); +// OBSOLETE symbuf->n_strx = strbuf; +// OBSOLETE p = (char *) strchr (strbuf, ':'); +// OBSOLETE if (!p) +// OBSOLETE break; +// OBSOLETE if ((p[1] == 'F' || p[1] == 'f') && cmplrid == VER_PRE_ULTRAC) +// OBSOLETE { +// OBSOLETE fread (&si, sizeof (si), 1, dbg_file); +// OBSOLETE nmask = bfd_get_16 (abfd, (unsigned char *) &si); +// OBSOLETE for (ii = 0; ii < nmask; ii++) +// OBSOLETE fread (&si, sizeof (si), 1, dbg_file); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE case N_SYM_LBRAC: +// OBSOLETE fread (&li, sizeof (li), 1, dbg_file); +// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); +// OBSOLETE break; +// OBSOLETE case N_SYM_RBRAC: +// OBSOLETE fread (&li, sizeof (li), 1, dbg_file); +// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li); +// OBSOLETE break; +// OBSOLETE case N_SYM_SE: +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Given pointers to an a.out symbol table in core containing dbx +// OBSOLETE style data, setup partial_symtab's describing each source file for +// OBSOLETE which debugging information is available. +// OBSOLETE SYMFILE_NAME is the name of the file we are reading from. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE read_os9k_psymtab (struct objfile *objfile, CORE_ADDR text_addr, int text_size) +// OBSOLETE { +// OBSOLETE register struct internal_symstruct *bufp = 0; /* =0 avoids gcc -Wall glitch */ +// OBSOLETE register char *namestring; +// OBSOLETE int past_first_source_file = 0; +// OBSOLETE CORE_ADDR last_o_file_start = 0; +// OBSOLETE #if 0 +// OBSOLETE struct cleanup *back_to; +// OBSOLETE #endif +// OBSOLETE bfd *abfd; +// OBSOLETE FILE *fp; +// OBSOLETE +// OBSOLETE /* End of the text segment of the executable file. */ +// OBSOLETE static CORE_ADDR end_of_text_addr; +// OBSOLETE +// OBSOLETE /* Current partial symtab */ +// OBSOLETE static struct partial_symtab *pst = 0; +// OBSOLETE +// OBSOLETE /* List of current psymtab's include files */ +// OBSOLETE char **psymtab_include_list; +// OBSOLETE int includes_allocated; +// OBSOLETE int includes_used; +// OBSOLETE +// OBSOLETE /* Index within current psymtab dependency list */ +// OBSOLETE struct partial_symtab **dependency_list; +// OBSOLETE int dependencies_used, dependencies_allocated; +// OBSOLETE +// OBSOLETE includes_allocated = 30; +// OBSOLETE includes_used = 0; +// OBSOLETE psymtab_include_list = (char **) alloca (includes_allocated * +// OBSOLETE sizeof (char *)); +// OBSOLETE +// OBSOLETE dependencies_allocated = 30; +// OBSOLETE dependencies_used = 0; +// OBSOLETE dependency_list = +// OBSOLETE (struct partial_symtab **) alloca (dependencies_allocated * +// OBSOLETE sizeof (struct partial_symtab *)); +// OBSOLETE +// OBSOLETE last_source_file = NULL; +// OBSOLETE +// OBSOLETE #ifdef END_OF_TEXT_DEFAULT +// OBSOLETE end_of_text_addr = END_OF_TEXT_DEFAULT; +// OBSOLETE #else +// OBSOLETE end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)) +// OBSOLETE + text_size; /* Relocate */ +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE abfd = objfile->obfd; +// OBSOLETE fp = objfile->auxf2; +// OBSOLETE if (!fp) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE fread (&dbghdr.sync, sizeof (dbghdr.sync), 1, fp); +// OBSOLETE fread (&dbghdr.rev, sizeof (dbghdr.rev), 1, fp); +// OBSOLETE fread (&dbghdr.crc, sizeof (dbghdr.crc), 1, fp); +// OBSOLETE fread (&dbghdr.os, sizeof (dbghdr.os), 1, fp); +// OBSOLETE fread (&dbghdr.cpu, sizeof (dbghdr.cpu), 1, fp); +// OBSOLETE SWAP_DBGHDR (&dbghdr, abfd); +// OBSOLETE +// OBSOLETE symnum = 0; +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE int ret; +// OBSOLETE long cursymoffset; +// OBSOLETE +// OBSOLETE /* Get the symbol for this run and pull out some info */ +// OBSOLETE QUIT; /* allow this to be interruptable */ +// OBSOLETE cursymoffset = ftell (objfile->auxf2); +// OBSOLETE ret = fill_sym (objfile->auxf2, abfd); +// OBSOLETE if (ret <= 0) +// OBSOLETE break; +// OBSOLETE else +// OBSOLETE symnum++; +// OBSOLETE bufp = symbuf; +// OBSOLETE +// OBSOLETE /* Special case to speed up readin. */ +// OBSOLETE if (bufp->n_type == (short) N_SYM_SLINE) +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE #define CUR_SYMBOL_VALUE bufp->n_value +// OBSOLETE /* partial-stab.h */ +// OBSOLETE +// OBSOLETE switch (bufp->n_type) +// OBSOLETE { +// OBSOLETE char *p; +// OBSOLETE +// OBSOLETE case N_SYM_CMPLR: +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case N_SYM_SE: +// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE if (psymfile_depth == 1 && pst) +// OBSOLETE { +// OBSOLETE os9k_end_psymtab (pst, psymtab_include_list, includes_used, +// OBSOLETE symnum, CUR_SYMBOL_VALUE, +// OBSOLETE dependency_list, dependencies_used); +// OBSOLETE pst = (struct partial_symtab *) 0; +// OBSOLETE includes_used = 0; +// OBSOLETE dependencies_used = 0; +// OBSOLETE } +// OBSOLETE psymfile_depth--; +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case N_SYM_SYM: /* Typedef or automatic variable. */ +// OBSOLETE namestring = bufp->n_strx; +// OBSOLETE p = (char *) strchr (namestring, ':'); +// OBSOLETE if (!p) +// OBSOLETE continue; /* Not a debugging symbol. */ +// OBSOLETE +// OBSOLETE /* Main processing section for debugging symbols which +// OBSOLETE the initial read through the symbol tables needs to worry +// OBSOLETE about. If we reach this point, the symbol which we are +// OBSOLETE considering is definitely one we are interested in. +// OBSOLETE p must also contain the (valid) index into the namestring +// OBSOLETE which indicates the debugging type symbol. */ +// OBSOLETE +// OBSOLETE switch (p[1]) +// OBSOLETE { +// OBSOLETE case 'S': +// OBSOLETE { +// OBSOLETE unsigned long valu; +// OBSOLETE enum language tmp_language; +// OBSOLETE char *str, *p; +// OBSOLETE int n; +// OBSOLETE +// OBSOLETE valu = CUR_SYMBOL_VALUE; +// OBSOLETE if (valu) +// OBSOLETE valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE past_first_source_file = 1; +// OBSOLETE +// OBSOLETE p = strchr (namestring, ':'); +// OBSOLETE if (p) +// OBSOLETE n = p - namestring; +// OBSOLETE else +// OBSOLETE n = strlen (namestring); +// OBSOLETE str = alloca (n + 1); +// OBSOLETE strncpy (str, namestring, n); +// OBSOLETE str[n] = '\0'; +// OBSOLETE +// OBSOLETE if (psymfile_depth == 0) +// OBSOLETE { +// OBSOLETE if (!pst) +// OBSOLETE pst = os9k_start_psymtab (objfile, +// OBSOLETE str, valu, +// OBSOLETE cursymoffset, +// OBSOLETE symnum - 1, +// OBSOLETE objfile->global_psymbols.next, +// OBSOLETE objfile->static_psymbols.next); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { /* this is a include file */ +// OBSOLETE tmp_language = deduce_language_from_filename (str); +// OBSOLETE if (tmp_language != language_unknown +// OBSOLETE && (tmp_language != language_c +// OBSOLETE || psymtab_language != language_cplus)) +// OBSOLETE psymtab_language = tmp_language; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE if (pst && STREQ (str, pst->filename)) +// OBSOLETE continue; +// OBSOLETE { +// OBSOLETE register int i; +// OBSOLETE for (i = 0; i < includes_used; i++) +// OBSOLETE if (STREQ (str, psymtab_include_list[i])) +// OBSOLETE { +// OBSOLETE i = -1; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE if (i == -1) +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE */ +// OBSOLETE +// OBSOLETE psymtab_include_list[includes_used++] = str; +// OBSOLETE if (includes_used >= includes_allocated) +// OBSOLETE { +// OBSOLETE char **orig = psymtab_include_list; +// OBSOLETE +// OBSOLETE psymtab_include_list = (char **) +// OBSOLETE alloca ((includes_allocated *= 2) * sizeof (char *)); +// OBSOLETE memcpy ((PTR) psymtab_include_list, (PTR) orig, +// OBSOLETE includes_used * sizeof (char *)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE } +// OBSOLETE psymfile_depth++; +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE case 'v': +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_STATIC, +// OBSOLETE &objfile->static_psymbols, +// OBSOLETE 0, CUR_SYMBOL_VALUE, +// OBSOLETE psymtab_language, objfile); +// OBSOLETE continue; +// OBSOLETE case 'V': +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_STATIC, +// OBSOLETE &objfile->global_psymbols, +// OBSOLETE 0, CUR_SYMBOL_VALUE, +// OBSOLETE psymtab_language, objfile); +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case 'T': +// OBSOLETE if (p != namestring) /* a name is there, not just :T... */ +// OBSOLETE { +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE STRUCT_NAMESPACE, LOC_TYPEDEF, +// OBSOLETE &objfile->static_psymbols, +// OBSOLETE CUR_SYMBOL_VALUE, 0, +// OBSOLETE psymtab_language, objfile); +// OBSOLETE if (p[2] == 't') +// OBSOLETE { +// OBSOLETE /* Also a typedef with the same name. */ +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF, +// OBSOLETE &objfile->static_psymbols, +// OBSOLETE CUR_SYMBOL_VALUE, 0, psymtab_language, +// OBSOLETE objfile); +// OBSOLETE p += 1; +// OBSOLETE } +// OBSOLETE /* The semantics of C++ state that "struct foo { ... }" +// OBSOLETE also defines a typedef for "foo". Unfortuantely, cfront +// OBSOLETE never makes the typedef when translating from C++ to C. +// OBSOLETE We make the typedef here so that "ptype foo" works as +// OBSOLETE expected for cfront translated code. */ +// OBSOLETE else if (psymtab_language == language_cplus) +// OBSOLETE { +// OBSOLETE /* Also a typedef with the same name. */ +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF, +// OBSOLETE &objfile->static_psymbols, +// OBSOLETE CUR_SYMBOL_VALUE, 0, psymtab_language, +// OBSOLETE objfile); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE goto check_enum; +// OBSOLETE case 't': +// OBSOLETE if (p != namestring) /* a name is there, not just :T... */ +// OBSOLETE { +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF, +// OBSOLETE &objfile->static_psymbols, +// OBSOLETE CUR_SYMBOL_VALUE, 0, +// OBSOLETE psymtab_language, objfile); +// OBSOLETE } +// OBSOLETE check_enum: +// OBSOLETE /* If this is an enumerated type, we need to +// OBSOLETE add all the enum constants to the partial symbol +// OBSOLETE table. This does not cover enums without names, e.g. +// OBSOLETE "enum {a, b} c;" in C, but fortunately those are +// OBSOLETE rare. There is no way for GDB to find those from the +// OBSOLETE enum type without spending too much time on it. Thus +// OBSOLETE to solve this problem, the compiler needs to put out the +// OBSOLETE enum in a nameless type. GCC2 does this. */ +// OBSOLETE +// OBSOLETE /* We are looking for something of the form +// OBSOLETE ":" ("t" | "T") [ "="] "e" +// OBSOLETE { ":" ","} ";". */ +// OBSOLETE +// OBSOLETE /* Skip over the colon and the 't' or 'T'. */ +// OBSOLETE p += 2; +// OBSOLETE /* This type may be given a number. Also, numbers can come +// OBSOLETE in pairs like (0,26). Skip over it. */ +// OBSOLETE while ((*p >= '0' && *p <= '9') +// OBSOLETE || *p == '(' || *p == ',' || *p == ')' +// OBSOLETE || *p == '=') +// OBSOLETE p++; +// OBSOLETE +// OBSOLETE if (*p++ == 'e') +// OBSOLETE { +// OBSOLETE /* We have found an enumerated type. skip size */ +// OBSOLETE while (*p >= '0' && *p <= '9') +// OBSOLETE p++; +// OBSOLETE /* According to comments in read_enum_type +// OBSOLETE a comma could end it instead of a semicolon. +// OBSOLETE I don't know where that happens. +// OBSOLETE Accept either. */ +// OBSOLETE while (*p && *p != ';' && *p != ',') +// OBSOLETE { +// OBSOLETE char *q; +// OBSOLETE +// OBSOLETE /* Check for and handle cretinous dbx symbol name +// OBSOLETE continuation! +// OBSOLETE if (*p == '\\') +// OBSOLETE p = next_symbol_text (objfile); +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Point to the character after the name +// OBSOLETE of the enum constant. */ +// OBSOLETE for (q = p; *q && *q != ':'; q++) +// OBSOLETE ; +// OBSOLETE /* Note that the value doesn't matter for +// OBSOLETE enum constants in psymtabs, just in symtabs. */ +// OBSOLETE add_psymbol_to_list (p, q - p, +// OBSOLETE VAR_NAMESPACE, LOC_CONST, +// OBSOLETE &objfile->static_psymbols, 0, +// OBSOLETE 0, psymtab_language, objfile); +// OBSOLETE /* Point past the name. */ +// OBSOLETE p = q; +// OBSOLETE /* Skip over the value. */ +// OBSOLETE while (*p && *p != ',') +// OBSOLETE p++; +// OBSOLETE /* Advance past the comma. */ +// OBSOLETE if (*p) +// OBSOLETE p++; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE continue; +// OBSOLETE case 'c': +// OBSOLETE /* Constant, e.g. from "const" in Pascal. */ +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_CONST, +// OBSOLETE &objfile->static_psymbols, CUR_SYMBOL_VALUE, +// OBSOLETE 0, psymtab_language, objfile); +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case 'f': +// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE if (pst && pst->textlow == 0) +// OBSOLETE pst->textlow = CUR_SYMBOL_VALUE; +// OBSOLETE +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_BLOCK, +// OBSOLETE &objfile->static_psymbols, CUR_SYMBOL_VALUE, +// OBSOLETE 0, psymtab_language, objfile); +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case 'F': +// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE if (pst && pst->textlow == 0) +// OBSOLETE pst->textlow = CUR_SYMBOL_VALUE; +// OBSOLETE +// OBSOLETE add_psymbol_to_list (namestring, p - namestring, +// OBSOLETE VAR_NAMESPACE, LOC_BLOCK, +// OBSOLETE &objfile->global_psymbols, CUR_SYMBOL_VALUE, +// OBSOLETE 0, psymtab_language, objfile); +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case 'p': +// OBSOLETE case 'l': +// OBSOLETE case 's': +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE case ':': +// OBSOLETE /* It is a C++ nested symbol. We don't need to record it +// OBSOLETE (I don't think); if we try to look up foo::bar::baz, +// OBSOLETE then symbols for the symtab containing foo should get +// OBSOLETE read in, I think. */ +// OBSOLETE /* Someone says sun cc puts out symbols like +// OBSOLETE /foo/baz/maclib::/usr/local/bin/maclib, +// OBSOLETE which would get here with a symbol type of ':'. */ +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE /* Unexpected symbol descriptor. The second and subsequent stabs +// OBSOLETE of a continued stab can show up here. The question is +// OBSOLETE whether they ever can mimic a normal stab--it would be +// OBSOLETE nice if not, since we certainly don't want to spend the +// OBSOLETE time searching to the end of every string looking for +// OBSOLETE a backslash. */ +// OBSOLETE +// OBSOLETE complain (&unknown_symchar_complaint, p[1]); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE case N_SYM_RBRAC: +// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE #ifdef HANDLE_RBRAC +// OBSOLETE HANDLE_RBRAC (CUR_SYMBOL_VALUE); +// OBSOLETE continue; +// OBSOLETE #endif +// OBSOLETE case N_SYM_LBRAC: +// OBSOLETE continue; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE /* If we haven't found it yet, ignore it. It's probably some +// OBSOLETE new type we don't know about yet. */ +// OBSOLETE complain (&unknown_symtype_complaint, +// OBSOLETE local_hex_string ((unsigned long) bufp->n_type)); +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE DBX_SYMCOUNT (objfile) = symnum; +// OBSOLETE +// OBSOLETE /* If there's stuff to be cleaned up, clean it up. */ +// OBSOLETE if (DBX_SYMCOUNT (objfile) > 0 +// OBSOLETE /*FIXME, does this have a bug at start address 0? */ +// OBSOLETE && last_o_file_start +// OBSOLETE && objfile->ei.entry_point < bufp->n_value +// OBSOLETE && objfile->ei.entry_point >= last_o_file_start) +// OBSOLETE { +// OBSOLETE objfile->ei.entry_file_lowpc = last_o_file_start; +// OBSOLETE objfile->ei.entry_file_highpc = bufp->n_value; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (pst) +// OBSOLETE { +// OBSOLETE os9k_end_psymtab (pst, psymtab_include_list, includes_used, +// OBSOLETE symnum, end_of_text_addr, +// OBSOLETE dependency_list, dependencies_used); +// OBSOLETE } +// OBSOLETE /* +// OBSOLETE do_cleanups (back_to); +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Allocate and partially fill a partial symtab. It will be +// OBSOLETE completely filled at the end of the symbol list. +// OBSOLETE +// OBSOLETE SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR +// OBSOLETE is the address relative to which its symbols are (incremental) or 0 +// OBSOLETE (normal). */ +// OBSOLETE +// OBSOLETE +// OBSOLETE static struct partial_symtab * +// OBSOLETE os9k_start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow, +// OBSOLETE int ldsymoff, int ldsymcnt, +// OBSOLETE struct partial_symbol **global_syms, +// OBSOLETE struct partial_symbol **static_syms) +// OBSOLETE { +// OBSOLETE struct partial_symtab *result = +// OBSOLETE start_psymtab_common (objfile, objfile->section_offsets, +// OBSOLETE filename, textlow, global_syms, static_syms); +// OBSOLETE +// OBSOLETE result->read_symtab_private = (char *) +// OBSOLETE obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); +// OBSOLETE +// OBSOLETE LDSYMOFF (result) = ldsymoff; +// OBSOLETE LDSYMCNT (result) = ldsymcnt; +// OBSOLETE result->read_symtab = os9k_psymtab_to_symtab; +// OBSOLETE +// OBSOLETE /* Deduce the source language from the filename for this psymtab. */ +// OBSOLETE psymtab_language = deduce_language_from_filename (filename); +// OBSOLETE return result; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Close off the current usage of PST. +// OBSOLETE Returns PST or NULL if the partial symtab was empty and thrown away. +// OBSOLETE FIXME: List variables and peculiarities of same. */ +// OBSOLETE +// OBSOLETE static struct partial_symtab * +// OBSOLETE os9k_end_psymtab (struct partial_symtab *pst, char **include_list, +// OBSOLETE int num_includes, int capping_symbol_cnt, +// OBSOLETE CORE_ADDR capping_text, +// OBSOLETE struct partial_symtab **dependency_list, +// OBSOLETE int number_dependencies) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE struct partial_symtab *p1; +// OBSOLETE struct objfile *objfile = pst->objfile; +// OBSOLETE +// OBSOLETE if (capping_symbol_cnt != -1) +// OBSOLETE LDSYMCNT (pst) = capping_symbol_cnt - LDSYMCNT (pst); +// OBSOLETE +// OBSOLETE /* Under Solaris, the N_SO symbols always have a value of 0, +// OBSOLETE instead of the usual address of the .o file. Therefore, +// OBSOLETE we have to do some tricks to fill in texthigh and textlow. +// OBSOLETE The first trick is in partial-stab.h: if we see a static +// OBSOLETE or global function, and the textlow for the current pst +// OBSOLETE is still 0, then we use that function's address for +// OBSOLETE the textlow of the pst. +// OBSOLETE +// OBSOLETE Now, to fill in texthigh, we remember the last function seen +// OBSOLETE in the .o file (also in partial-stab.h). Also, there's a hack in +// OBSOLETE bfd/elf.c and gdb/elfread.c to pass the ELF st_size field +// OBSOLETE to here via the misc_info field. Therefore, we can fill in +// OBSOLETE a reliable texthigh by taking the address plus size of the +// OBSOLETE last function in the file. +// OBSOLETE +// OBSOLETE Unfortunately, that does not cover the case where the last function +// OBSOLETE in the file is static. See the paragraph below for more comments +// OBSOLETE on this situation. +// OBSOLETE +// OBSOLETE Finally, if we have a valid textlow for the current file, we run +// OBSOLETE down the partial_symtab_list filling in previous texthighs that +// OBSOLETE are still unknown. */ +// OBSOLETE +// OBSOLETE if (pst->texthigh == 0 && last_function_name) +// OBSOLETE { +// OBSOLETE char *p; +// OBSOLETE int n; +// OBSOLETE struct minimal_symbol *minsym; +// OBSOLETE +// OBSOLETE p = strchr (last_function_name, ':'); +// OBSOLETE if (p == NULL) +// OBSOLETE p = last_function_name; +// OBSOLETE n = p - last_function_name; +// OBSOLETE p = alloca (n + 1); +// OBSOLETE strncpy (p, last_function_name, n); +// OBSOLETE p[n] = 0; +// OBSOLETE +// OBSOLETE minsym = lookup_minimal_symbol (p, NULL, objfile); +// OBSOLETE +// OBSOLETE if (minsym) +// OBSOLETE { +// OBSOLETE pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + (long) MSYMBOL_INFO (minsym); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* This file ends with a static function, and it's +// OBSOLETE difficult to imagine how hard it would be to track down +// OBSOLETE the elf symbol. Luckily, most of the time no one will notice, +// OBSOLETE since the next file will likely be compiled with -g, so +// OBSOLETE the code below will copy the first fuction's start address +// OBSOLETE back to our texthigh variable. (Also, if this file is the +// OBSOLETE last one in a dynamically linked program, texthigh already +// OBSOLETE has the right value.) If the next file isn't compiled +// OBSOLETE with -g, then the last function in this file winds up owning +// OBSOLETE all of the text space up to the next -g file, or the end (minus +// OBSOLETE shared libraries). This only matters for single stepping, +// OBSOLETE and even then it will still work, except that it will single +// OBSOLETE step through all of the covered functions, instead of setting +// OBSOLETE breakpoints around them as it usualy does. This makes it +// OBSOLETE pretty slow, but at least it doesn't fail. +// OBSOLETE +// OBSOLETE We can fix this with a fairly big change to bfd, but we need +// OBSOLETE to coordinate better with Cygnus if we want to do that. FIXME. */ +// OBSOLETE } +// OBSOLETE last_function_name = NULL; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* this test will be true if the last .o file is only data */ +// OBSOLETE if (pst->textlow == 0) +// OBSOLETE pst->textlow = pst->texthigh; +// OBSOLETE +// OBSOLETE /* If we know our own starting text address, then walk through all other +// OBSOLETE psymtabs for this objfile, and if any didn't know their ending text +// OBSOLETE address, set it to our starting address. Take care to not set our +// OBSOLETE own ending address to our starting address, nor to set addresses on +// OBSOLETE `dependency' files that have both textlow and texthigh zero. */ +// OBSOLETE if (pst->textlow) +// OBSOLETE { +// OBSOLETE ALL_OBJFILE_PSYMTABS (objfile, p1) +// OBSOLETE { +// OBSOLETE if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst) +// OBSOLETE { +// OBSOLETE p1->texthigh = pst->textlow; +// OBSOLETE /* if this file has only data, then make textlow match texthigh */ +// OBSOLETE if (p1->textlow == 0) +// OBSOLETE p1->textlow = p1->texthigh; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* End of kludge for patching Solaris textlow and texthigh. */ +// OBSOLETE +// OBSOLETE pst->n_global_syms = +// OBSOLETE objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); +// OBSOLETE pst->n_static_syms = +// OBSOLETE objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset); +// OBSOLETE +// OBSOLETE pst->number_of_dependencies = number_dependencies; +// OBSOLETE if (number_dependencies) +// OBSOLETE { +// OBSOLETE pst->dependencies = (struct partial_symtab **) +// OBSOLETE obstack_alloc (&objfile->psymbol_obstack, +// OBSOLETE number_dependencies * sizeof (struct partial_symtab *)); +// OBSOLETE memcpy (pst->dependencies, dependency_list, +// OBSOLETE number_dependencies * sizeof (struct partial_symtab *)); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE pst->dependencies = 0; +// OBSOLETE +// OBSOLETE for (i = 0; i < num_includes; i++) +// OBSOLETE { +// OBSOLETE struct partial_symtab *subpst = +// OBSOLETE allocate_psymtab (include_list[i], objfile); +// OBSOLETE +// OBSOLETE subpst->section_offsets = pst->section_offsets; +// OBSOLETE subpst->read_symtab_private = +// OBSOLETE (char *) obstack_alloc (&objfile->psymbol_obstack, +// OBSOLETE sizeof (struct symloc)); +// OBSOLETE LDSYMOFF (subpst) = +// OBSOLETE LDSYMCNT (subpst) = +// OBSOLETE subpst->textlow = +// OBSOLETE subpst->texthigh = 0; +// OBSOLETE +// OBSOLETE /* We could save slight bits of space by only making one of these, +// OBSOLETE shared by the entire set of include files. FIXME-someday. */ +// OBSOLETE subpst->dependencies = (struct partial_symtab **) +// OBSOLETE obstack_alloc (&objfile->psymbol_obstack, +// OBSOLETE sizeof (struct partial_symtab *)); +// OBSOLETE subpst->dependencies[0] = pst; +// OBSOLETE subpst->number_of_dependencies = 1; +// OBSOLETE +// OBSOLETE subpst->globals_offset = +// OBSOLETE subpst->n_global_syms = +// OBSOLETE subpst->statics_offset = +// OBSOLETE subpst->n_static_syms = 0; +// OBSOLETE +// OBSOLETE subpst->readin = 0; +// OBSOLETE subpst->symtab = 0; +// OBSOLETE subpst->read_symtab = pst->read_symtab; +// OBSOLETE } +// OBSOLETE +// OBSOLETE sort_pst_symbols (pst); +// OBSOLETE +// OBSOLETE /* If there is already a psymtab or symtab for a file of this name, +// OBSOLETE remove it. +// OBSOLETE (If there is a symtab, more drastic things also happen.) +// OBSOLETE This happens in VxWorks. */ +// OBSOLETE free_named_symtabs (pst->filename); +// OBSOLETE +// OBSOLETE if (num_includes == 0 +// OBSOLETE && number_dependencies == 0 +// OBSOLETE && pst->n_global_syms == 0 +// OBSOLETE && pst->n_static_syms == 0) +// OBSOLETE { +// OBSOLETE /* Throw away this psymtab, it's empty. We can't deallocate it, since +// OBSOLETE it is on the obstack, but we can forget to chain it on the list. */ +// OBSOLETE /* Indicate that psymtab was thrown away. */ +// OBSOLETE +// OBSOLETE discard_psymtab (pst); +// OBSOLETE +// OBSOLETE pst = (struct partial_symtab *) NULL; +// OBSOLETE } +// OBSOLETE return pst; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_psymtab_to_symtab_1 (struct partial_symtab *pst) +// OBSOLETE { +// OBSOLETE struct cleanup *old_chain; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE if (!pst) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (pst->readin) +// OBSOLETE { +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", +// OBSOLETE pst->filename); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read in all partial symtabs on which this one is dependent */ +// OBSOLETE for (i = 0; i < pst->number_of_dependencies; i++) +// OBSOLETE if (!pst->dependencies[i]->readin) +// OBSOLETE { +// OBSOLETE /* Inform about additional files that need to be read in. */ +// OBSOLETE if (info_verbose) +// OBSOLETE { +// OBSOLETE fputs_filtered (" ", gdb_stdout); +// OBSOLETE wrap_here (""); +// OBSOLETE fputs_filtered ("and ", gdb_stdout); +// OBSOLETE wrap_here (""); +// OBSOLETE printf_filtered ("%s...", pst->dependencies[i]->filename); +// OBSOLETE wrap_here (""); /* Flush output */ +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE os9k_psymtab_to_symtab_1 (pst->dependencies[i]); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (LDSYMCNT (pst)) /* Otherwise it's a dummy */ +// OBSOLETE { +// OBSOLETE /* Init stuff necessary for reading in symbols */ +// OBSOLETE stabsread_init (); +// OBSOLETE buildsym_init (); +// OBSOLETE old_chain = make_cleanup (really_free_pendings, 0); +// OBSOLETE +// OBSOLETE /* Read in this file's symbols */ +// OBSOLETE os9k_read_ofile_symtab (pst); +// OBSOLETE sort_symtab_syms (pst->symtab); +// OBSOLETE do_cleanups (old_chain); +// OBSOLETE } +// OBSOLETE +// OBSOLETE pst->readin = 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read in all of the symbols for a given psymtab for real. +// OBSOLETE Be verbose about it if the user wants that. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_psymtab_to_symtab (struct partial_symtab *pst) +// OBSOLETE { +// OBSOLETE bfd *sym_bfd; +// OBSOLETE +// OBSOLETE if (!pst) +// OBSOLETE return; +// OBSOLETE +// OBSOLETE if (pst->readin) +// OBSOLETE { +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n", +// OBSOLETE pst->filename); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (LDSYMCNT (pst) || pst->number_of_dependencies) +// OBSOLETE { +// OBSOLETE /* Print the message now, before reading the string table, +// OBSOLETE to avoid disconcerting pauses. */ +// OBSOLETE if (info_verbose) +// OBSOLETE { +// OBSOLETE printf_filtered ("Reading in symbols for %s...", pst->filename); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE sym_bfd = pst->objfile->obfd; +// OBSOLETE os9k_psymtab_to_symtab_1 (pst); +// OBSOLETE +// OBSOLETE /* Match with global symbols. This only needs to be done once, +// OBSOLETE after all of the symtabs and dependencies have been read in. */ +// OBSOLETE scan_file_globals (pst->objfile); +// OBSOLETE +// OBSOLETE /* Finish up the debug error message. */ +// OBSOLETE if (info_verbose) +// OBSOLETE printf_filtered ("done.\n"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read in a defined section of a specific object file's symbols. */ +// OBSOLETE static void +// OBSOLETE os9k_read_ofile_symtab (struct partial_symtab *pst) +// OBSOLETE { +// OBSOLETE register struct internal_symstruct *bufp; +// OBSOLETE unsigned char type; +// OBSOLETE unsigned max_symnum; +// OBSOLETE register bfd *abfd; +// OBSOLETE struct objfile *objfile; +// OBSOLETE int sym_offset; /* Offset to start of symbols to read */ +// OBSOLETE CORE_ADDR text_offset; /* Start of text segment for symbols */ +// OBSOLETE int text_size; /* Size of text segment for symbols */ +// OBSOLETE FILE *dbg_file; +// OBSOLETE +// OBSOLETE objfile = pst->objfile; +// OBSOLETE sym_offset = LDSYMOFF (pst); +// OBSOLETE max_symnum = LDSYMCNT (pst); +// OBSOLETE text_offset = pst->textlow; +// OBSOLETE text_size = pst->texthigh - pst->textlow; +// OBSOLETE +// OBSOLETE current_objfile = objfile; +// OBSOLETE subfile_stack = NULL; +// OBSOLETE last_source_file = NULL; +// OBSOLETE +// OBSOLETE abfd = objfile->obfd; +// OBSOLETE dbg_file = objfile->auxf2; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* It is necessary to actually read one symbol *before* the start +// OBSOLETE of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL +// OBSOLETE occurs before the N_SO symbol. +// OBSOLETE Detecting this in read_dbx_symtab +// OBSOLETE would slow down initial readin, so we look for it here instead. */ +// OBSOLETE if (!processing_acc_compilation && sym_offset >= (int) symbol_size) +// OBSOLETE { +// OBSOLETE fseek (objefile->auxf2, sym_offset, SEEK_CUR); +// OBSOLETE fill_sym (objfile->auxf2, abfd); +// OBSOLETE bufp = symbuf; +// OBSOLETE +// OBSOLETE processing_gcc_compilation = 0; +// OBSOLETE if (bufp->n_type == N_TEXT) +// OBSOLETE { +// OBSOLETE if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) +// OBSOLETE processing_gcc_compilation = 1; +// OBSOLETE else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) +// OBSOLETE processing_gcc_compilation = 2; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Try to select a C++ demangling based on the compilation unit +// OBSOLETE producer. */ +// OBSOLETE +// OBSOLETE if (processing_gcc_compilation) +// OBSOLETE { +// OBSOLETE if (AUTO_DEMANGLING) +// OBSOLETE { +// OBSOLETE set_demangling_style (GNU_DEMANGLING_STYLE_STRING); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* The N_SO starting this symtab is the first symbol, so we +// OBSOLETE better not check the symbol before it. I'm not this can +// OBSOLETE happen, but it doesn't hurt to check for it. */ +// OBSOLETE bfd_seek (symfile_bfd, sym_offset, SEEK_CUR); +// OBSOLETE processing_gcc_compilation = 0; +// OBSOLETE } +// OBSOLETE #endif /* 0 */ +// OBSOLETE +// OBSOLETE fseek (dbg_file, (long) sym_offset, 0); +// OBSOLETE /* +// OBSOLETE if (bufp->n_type != (unsigned char)N_SYM_SYM) +// OBSOLETE error("First symbol in segment of executable not a source symbol"); +// OBSOLETE */ +// OBSOLETE +// OBSOLETE for (symnum = 0; symnum < max_symnum; symnum++) +// OBSOLETE { +// OBSOLETE QUIT; /* Allow this to be interruptable */ +// OBSOLETE fill_sym (dbg_file, abfd); +// OBSOLETE bufp = symbuf; +// OBSOLETE type = bufp->n_type; +// OBSOLETE +// OBSOLETE os9k_process_one_symbol ((int) type, (int) bufp->n_desc, +// OBSOLETE (CORE_ADDR) bufp->n_value, bufp->n_strx, pst->section_offsets, objfile); +// OBSOLETE +// OBSOLETE /* We skip checking for a new .o or -l file; that should never +// OBSOLETE happen in this routine. */ +// OBSOLETE #if 0 +// OBSOLETE else +// OBSOLETE if (type == N_TEXT) +// OBSOLETE { +// OBSOLETE /* I don't think this code will ever be executed, because +// OBSOLETE the GCC_COMPILED_FLAG_SYMBOL usually is right before +// OBSOLETE the N_SO symbol which starts this source file. +// OBSOLETE However, there is no reason not to accept +// OBSOLETE the GCC_COMPILED_FLAG_SYMBOL anywhere. */ +// OBSOLETE +// OBSOLETE if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL)) +// OBSOLETE processing_gcc_compilation = 1; +// OBSOLETE else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL)) +// OBSOLETE processing_gcc_compilation = 2; +// OBSOLETE +// OBSOLETE if (AUTO_DEMANGLING) +// OBSOLETE { +// OBSOLETE set_demangling_style (GNU_DEMANGLING_STYLE_STRING); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else if (type & N_EXT || type == (unsigned char) N_TEXT +// OBSOLETE || type == (unsigned char) N_NBTEXT +// OBSOLETE ) +// OBSOLETE { +// OBSOLETE /* Global symbol: see if we came across a dbx defintion for +// OBSOLETE a corresponding symbol. If so, store the value. Remove +// OBSOLETE syms from the chain when their values are stored, but +// OBSOLETE search the whole chain, as there may be several syms from +// OBSOLETE different files with the same name. */ +// OBSOLETE /* This is probably not true. Since the files will be read +// OBSOLETE in one at a time, each reference to a global symbol will +// OBSOLETE be satisfied in each file as it appears. So we skip this +// OBSOLETE section. */ +// OBSOLETE ; +// OBSOLETE } +// OBSOLETE #endif /* 0 */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE current_objfile = NULL; +// OBSOLETE +// OBSOLETE /* In a Solaris elf file, this variable, which comes from the +// OBSOLETE value of the N_SO symbol, will still be 0. Luckily, text_offset, +// OBSOLETE which comes from pst->textlow is correct. */ +// OBSOLETE if (last_source_start_addr == 0) +// OBSOLETE last_source_start_addr = text_offset; +// OBSOLETE pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); +// OBSOLETE end_stabs (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* This handles a single symbol from the symbol-file, building symbols +// OBSOLETE into a GDB symtab. It takes these arguments and an implicit argument. +// OBSOLETE +// OBSOLETE TYPE is the type field of the ".stab" symbol entry. +// OBSOLETE DESC is the desc field of the ".stab" entry. +// OBSOLETE VALU is the value field of the ".stab" entry. +// OBSOLETE NAME is the symbol name, in our address space. +// OBSOLETE SECTION_OFFSETS is a set of amounts by which the sections of this object +// OBSOLETE file were relocated when it was loaded into memory. +// OBSOLETE All symbols that refer +// OBSOLETE to memory locations need to be offset by these amounts. +// OBSOLETE OBJFILE is the object file from which we are reading symbols. +// OBSOLETE It is used in end_symtab. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE os9k_process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, +// OBSOLETE struct section_offsets *section_offsets, +// OBSOLETE struct objfile *objfile) +// OBSOLETE { +// OBSOLETE register struct context_stack *new; +// OBSOLETE /* The stab type used for the definition of the last function. +// OBSOLETE N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers. */ +// OBSOLETE static int function_stab_type = 0; +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* Something is wrong if we see real data before +// OBSOLETE seeing a source file name. */ +// OBSOLETE if (last_source_file == NULL && type != (unsigned char) N_SO) +// OBSOLETE { +// OBSOLETE /* Ignore any symbols which appear before an N_SO symbol. +// OBSOLETE Currently no one puts symbols there, but we should deal +// OBSOLETE gracefully with the case. A complain()t might be in order, +// OBSOLETE but this should not be an error (). */ +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE #endif /* 0 */ +// OBSOLETE +// OBSOLETE switch (type) +// OBSOLETE { +// OBSOLETE case N_SYM_LBRAC: +// OBSOLETE /* On most machines, the block addresses are relative to the +// OBSOLETE N_SO, the linker did not relocate them (sigh). */ +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE new = push_context (desc, valu); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case N_SYM_RBRAC: +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE new = pop_context (); +// OBSOLETE +// OBSOLETE #if !defined (OS9K_VARIABLES_INSIDE_BLOCK) +// OBSOLETE #define OS9K_VARIABLES_INSIDE_BLOCK(desc, gcc_p) 1 +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE if (!OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) +// OBSOLETE local_symbols = new->locals; +// OBSOLETE +// OBSOLETE if (context_stack_depth > 1) +// OBSOLETE { +// OBSOLETE /* This is not the outermost LBRAC...RBRAC pair in the function, +// OBSOLETE its local symbols preceded it, and are the ones just recovered +// OBSOLETE from the context stack. Define the block for them (but don't +// OBSOLETE bother if the block contains no symbols. Should we complain +// OBSOLETE on blocks without symbols? I can't think of any useful purpose +// OBSOLETE for them). */ +// OBSOLETE if (local_symbols != NULL) +// OBSOLETE { +// OBSOLETE /* Muzzle a compiler bug that makes end < start. (which +// OBSOLETE compilers? Is this ever harmful?). */ +// OBSOLETE if (new->start_addr > valu) +// OBSOLETE { +// OBSOLETE complain (&lbrac_rbrac_complaint); +// OBSOLETE new->start_addr = valu; +// OBSOLETE } +// OBSOLETE /* Make a block for the local symbols within. */ +// OBSOLETE finish_block (0, &local_symbols, new->old_blocks, +// OBSOLETE new->start_addr, valu, objfile); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (context_stack_depth == 0) +// OBSOLETE { +// OBSOLETE within_function = 0; +// OBSOLETE /* Make a block for the local symbols within. */ +// OBSOLETE finish_block (new->name, &local_symbols, new->old_blocks, +// OBSOLETE new->start_addr, valu, objfile); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* attach local_symbols to the end of new->locals */ +// OBSOLETE if (!new->locals) +// OBSOLETE new->locals = local_symbols; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE struct pending *p; +// OBSOLETE +// OBSOLETE p = new->locals; +// OBSOLETE while (p->next) +// OBSOLETE p = p->next; +// OBSOLETE p->next = local_symbols; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation)) +// OBSOLETE /* Now pop locals of block just finished. */ +// OBSOLETE local_symbols = new->locals; +// OBSOLETE break; +// OBSOLETE +// OBSOLETE +// OBSOLETE case N_SYM_SLINE: +// OBSOLETE /* This type of "symbol" really just records +// OBSOLETE one line-number -- core-address correspondence. +// OBSOLETE Enter it in the line list for this symbol table. */ +// OBSOLETE /* Relocate for dynamic loading and for ELF acc fn-relative syms. */ +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE /* FIXME: loses if sizeof (char *) > sizeof (int) */ +// OBSOLETE gdb_assert (sizeof (name) <= sizeof (int)); +// OBSOLETE record_line (current_subfile, (int) name, valu); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE /* The following symbol types need to have the appropriate offset added +// OBSOLETE to their value; then we process symbol definitions in the name. */ +// OBSOLETE case N_SYM_SYM: +// OBSOLETE +// OBSOLETE if (name) +// OBSOLETE { +// OBSOLETE char deftype; +// OBSOLETE char *dirn, *n; +// OBSOLETE char *p = strchr (name, ':'); +// OBSOLETE if (p == NULL) +// OBSOLETE deftype = '\0'; +// OBSOLETE else +// OBSOLETE deftype = p[1]; +// OBSOLETE +// OBSOLETE +// OBSOLETE switch (deftype) +// OBSOLETE { +// OBSOLETE case 'S': +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE n = strrchr (name, '/'); +// OBSOLETE if (n != NULL) +// OBSOLETE { +// OBSOLETE *n = '\0'; +// OBSOLETE n++; +// OBSOLETE dirn = name; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE n = name; +// OBSOLETE dirn = NULL; +// OBSOLETE } +// OBSOLETE *p = '\0'; +// OBSOLETE if (symfile_depth++ == 0) +// OBSOLETE { +// OBSOLETE if (last_source_file) +// OBSOLETE { +// OBSOLETE end_symtab (valu, objfile, SECT_OFF_TEXT (objfile)); +// OBSOLETE end_stabs (); +// OBSOLETE } +// OBSOLETE start_stabs (); +// OBSOLETE os9k_stabs = 1; +// OBSOLETE start_symtab (n, dirn, valu); +// OBSOLETE record_debugformat ("OS9"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE push_subfile (); +// OBSOLETE start_subfile (n, dirn != NULL ? dirn : current_subfile->dirname); +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'f': +// OBSOLETE case 'F': +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); +// OBSOLETE function_stab_type = type; +// OBSOLETE +// OBSOLETE within_function = 1; +// OBSOLETE new = push_context (0, valu); +// OBSOLETE new->name = define_symbol (valu, name, desc, type, objfile); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 'V': +// OBSOLETE case 'v': +// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile)); +// OBSOLETE define_symbol (valu, name, desc, type, objfile); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE define_symbol (valu, name, desc, type, objfile); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case N_SYM_SE: +// OBSOLETE if (--symfile_depth != 0) +// OBSOLETE start_subfile (pop_subfile (), current_subfile->dirname); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE complain (&unknown_symtype_complaint, +// OBSOLETE local_hex_string ((unsigned long) type)); +// OBSOLETE /* FALLTHROUGH */ +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case N_SYM_CMPLR: +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE previous_stab_code = type; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static struct sym_fns os9k_sym_fns = +// OBSOLETE { +// OBSOLETE bfd_target_os9k_flavour, +// OBSOLETE os9k_new_init, /* sym_new_init: init anything gbl to entire symtab */ +// OBSOLETE os9k_symfile_init, /* sym_init: read initial info, setup for sym_read() */ +// OBSOLETE os9k_symfile_read, /* sym_read: read a symbol file into symtab */ +// OBSOLETE os9k_symfile_finish, /* sym_finish: finished with file, cleanup */ +// OBSOLETE default_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */ +// OBSOLETE NULL /* next: pointer to next struct sym_fns */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_os9kread (void) +// OBSOLETE { +// OBSOLETE add_symtab_fns (&os9k_sym_fns); +// OBSOLETE } diff --git a/gdb/remote-os9k.c b/gdb/remote-os9k.c index 0a703ebd3a5..5a7dd3410f9 100644 --- a/gdb/remote-os9k.c +++ b/gdb/remote-os9k.c @@ -1,1234 +1,1234 @@ -/* Remote debugging interface for boot monitors, for GDB. - - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2002 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. */ - -/* This file was derived from remote-eb.c, which did a similar job, but for - an AMD-29K running EBMON. That file was in turn derived from remote.c - as mentioned in the following comment (left in for comic relief): - - "This is like remote.c but is for a different situation-- - having a PC running os9000 hook up with a unix machine with - a serial line, and running ctty com2 on the PC. os9000 has a debug - monitor called ROMBUG running. Not to mention that the PC - has PC/NFS, so it can access the same executables that gdb can, - over the net in real time." - - In reality, this module talks to a debug monitor called 'ROMBUG', which - We communicate with ROMBUG via a direct serial line, the network version - of ROMBUG is not available yet. - */ - -/* FIXME This file needs to be rewritten if it's to work again, either - to self-contained or to use the new monitor interface. */ - -#include "defs.h" -#include "gdbcore.h" -#include "target.h" -#include "gdb_string.h" -#include -#include "command.h" -#include "serial.h" -#include "monitor.h" -#include "remote-utils.h" -#include "symtab.h" -#include "symfile.h" -#include "objfiles.h" -#include "gdb-stabs.h" -#include "regcache.h" - -struct cmd_list_element *showlist; -extern struct target_ops rombug_ops; /* Forward declaration */ -extern struct monitor_ops rombug_cmds; /* Forward declaration */ -extern struct cmd_list_element *setlist; -extern struct cmd_list_element *unsetlist; -extern int attach_flag; - -static void rombug_close (); -static void rombug_fetch_register (); -static void rombug_fetch_registers (); -static void rombug_store_register (); -#if 0 -static int sr_get_debug (); /* flag set by "set remotedebug" */ -#endif -static int hashmark; /* flag set by "set hash" */ -static int rombug_is_open = 0; - -/* FIXME: Replace with sr_get_debug (). */ -#define LOG_FILE "monitor.log" -FILE *log_file; -static int monitor_log = 0; -static int tty_xon = 0; -static int tty_xoff = 0; - -static int timeout = 10; -static int is_trace_mode = 0; -/* Descriptor for I/O to remote machine. Initialize it to NULL */ -static struct serial *monitor_desc = NULL; - -static CORE_ADDR bufaddr = 0; -static int buflen = 0; -static char readbuf[16]; - -/* Send data to monitor. Works just like printf. */ -static void -printf_monitor (char *pattern,...) -{ - va_list args; - char buf[200]; - int i; - - va_start (args, pattern); - - vsprintf (buf, pattern, args); - va_end (args); - - if (serial_write (monitor_desc, buf, strlen (buf))) - fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", - safe_strerror (errno)); -} - -/* Read a character from the remote system, doing all the fancy timeout stuff */ -static int -readchar (int timeout) -{ - int c; - - c = serial_readchar (monitor_desc, timeout); - - if (sr_get_debug ()) - putchar (c & 0x7f); - - if (monitor_log && isascii (c)) - putc (c & 0x7f, log_file); - - if (c >= 0) - return c & 0x7f; - - if (c == SERIAL_TIMEOUT) - { - if (timeout == 0) - return c; /* Polls shouldn't generate timeout errors */ - - error ("Timeout reading from remote system."); - } - - perror_with_name ("remote-monitor"); -} - -/* Scan input from the remote system, until STRING is found. If DISCARD is - non-zero, then discard non-matching input, else print it out. - Let the user break out immediately. */ -static void -expect (char *string, int discard) -{ - char *p = string; - int c; - - if (sr_get_debug ()) - printf ("Expecting \"%s\"\n", string); - - immediate_quit++; - while (1) - { - c = readchar (timeout); - if (!isascii (c)) - continue; - if (c == *p++) - { - if (*p == '\0') - { - immediate_quit--; - if (sr_get_debug ()) - printf ("\nMatched\n"); - return; - } - } - else - { - if (!discard) - { - fwrite (string, 1, (p - 1) - string, stdout); - putchar ((char) c); - fflush (stdout); - } - p = string; - } - } -} - -/* Keep discarding input until we see the ROMBUG prompt. - - The convention for dealing with the prompt is that you - o give your command - o *then* wait for the prompt. - - Thus the last thing that a procedure does with the serial line - will be an expect_prompt(). Exception: rombug_resume does not - wait for the prompt, because the terminal is being handed over - to the inferior. However, the next thing which happens after that - is a rombug_wait which does wait for the prompt. - Note that this includes abnormal exit, e.g. error(). This is - necessary to prevent getting into states from which we can't - recover. */ -static void -expect_prompt (int discard) -{ - if (monitor_log) - /* This is a convenient place to do this. The idea is to do it often - enough that we never lose much data if we terminate abnormally. */ - fflush (log_file); - - if (is_trace_mode) - { - expect ("trace", discard); - } - else - { - expect (PROMPT, discard); - } -} - -/* Get a hex digit from the remote system & return its value. - If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ -static int -get_hex_digit (int ignore_space) -{ - int ch; - while (1) - { - ch = readchar (timeout); - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else if (ch == ' ' && ignore_space) - ; - else - { - expect_prompt (1); - error ("Invalid hex digit from remote system."); - } - } -} - -/* Get a byte from monitor and put it in *BYT. Accept any number - leading spaces. */ -static void -get_hex_byte (char *byt) -{ - int val; - - val = get_hex_digit (1) << 4; - val |= get_hex_digit (0); - *byt = val; -} - -/* Get N 32-bit words from remote, each preceded by a space, - and put them in registers starting at REGNO. */ -static void -get_hex_regs (int n, int regno) -{ - long val; - int i; - unsigned char b; - - for (i = 0; i < n; i++) - { - int j; - - val = 0; - for (j = 0; j < 4; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - val = (val << 8) + b; - else - val = val + (b << (j * 8)); - } - supply_register (regno++, (char *) &val); - } -} - -/* This is called not only when we first attach, but also when the - user types "run" after having attached. */ -static void -rombug_create_inferior (char *execfile, char *args, char **env) -{ - int entry_pt; - - if (args && *args) - error ("Can't pass arguments to remote ROMBUG process"); - - if (execfile == 0 || exec_bfd == 0) - error ("No executable file specified"); - - entry_pt = (int) bfd_get_start_address (exec_bfd); - - if (monitor_log) - fputs ("\nIn Create_inferior()", log_file); - - -/* The "process" (board) is already stopped awaiting our commands, and - the program is already downloaded. We just set its PC and go. */ - - init_wait_for_inferior (); - proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0); -} - -/* Open a connection to a remote debugger. - NAME is the filename used for communication. */ - -static char dev_name[100]; - -static void -rombug_open (char *args, int from_tty) -{ - if (args == NULL) - error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\ -`target RomBug HOST-NAME:PORT-NUMBER' to use a network connection."); - - target_preopen (from_tty); - - if (rombug_is_open) - unpush_target (&rombug_ops); - - strcpy (dev_name, args); - monitor_desc = serial_open (dev_name); - if (monitor_desc == NULL) - perror_with_name (dev_name); - - /* if baud rate is set by 'set remotebaud' */ - if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ())) - { - serial_close (monitor_desc); - perror_with_name ("RomBug"); - } - serial_raw (monitor_desc); - if (tty_xon || tty_xoff) - { - struct hardware_ttystate - { - struct termios t; - } - *tty_s; - - tty_s = (struct hardware_ttystate *) serial_get_tty_state (monitor_desc); - if (tty_xon) - tty_s->t.c_iflag |= IXON; - if (tty_xoff) - tty_s->t.c_iflag |= IXOFF; - serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s); - } - - rombug_is_open = 1; - - log_file = fopen (LOG_FILE, "w"); - if (log_file == NULL) - perror_with_name (LOG_FILE); - - push_monitor (&rombug_cmds); - printf_monitor ("\r"); /* CR wakes up monitor */ - expect_prompt (1); - push_target (&rombug_ops); - attach_flag = 1; - - if (from_tty) - printf ("Remote %s connected to %s\n", target_shortname, - dev_name); - - rombug_fetch_registers (); - - printf_monitor ("ov e \r"); - expect_prompt (1); - bufaddr = 0; - buflen = 0; -} - -/* - * Close out all files and local state before this target loses control. - */ - -static void -rombug_close (int quitting) -{ - if (rombug_is_open) - { - serial_close (monitor_desc); - monitor_desc = NULL; - rombug_is_open = 0; - } - - if (log_file) - { - if (ferror (log_file)) - fprintf_unfiltered (gdb_stderr, "Error writing log file.\n"); - if (fclose (log_file) != 0) - fprintf_unfiltered (gdb_stderr, "Error closing log file.\n"); - log_file = 0; - } -} - -int -rombug_link (char *mod_name, CORE_ADDR *text_reloc) -{ - int i, j; - unsigned long val; - unsigned char b; - - printf_monitor ("l %s \r", mod_name); - expect_prompt (1); - printf_monitor (".r \r"); - expect (REG_DELIM, 1); - for (i = 0; i <= 7; i++) - { - val = 0; - for (j = 0; j < 4; j++) - { - get_hex_byte (&b); - val = (val << 8) + b; - } - } - expect_prompt (1); - *text_reloc = val; - return 1; -} - -/* Terminate the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ -static void -rombug_detach (int from_tty) -{ - if (attach_flag) - { - printf_monitor (GO_CMD); - attach_flag = 0; - } - pop_target (); /* calls rombug_close to do the real work */ - if (from_tty) - printf ("Ending remote %s debugging\n", target_shortname); -} - -/* - * Tell the remote machine to resume. - */ -static void -rombug_resume (ptid_t ptid, int step, enum target_signal sig) -{ - if (monitor_log) - fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig); - - if (step) - { - is_trace_mode = 1; - printf_monitor (STEP_CMD); - /* wait for the echo. ** - expect (STEP_CMD, 1); - */ - } - else - { - printf_monitor (GO_CMD); - /* swallow the echo. ** - expect (GO_CMD, 1); - */ - } - bufaddr = 0; - buflen = 0; -} - -/* - * Wait until the remote machine stops, then return, - * storing status in status just as `wait' would. - */ - -static ptid * -rombug_wait (ptid_t ptid, struct target_waitstatus *status) -{ - int old_timeout = timeout; - struct section_offsets *offs; - CORE_ADDR addr, pc; - struct obj_section *obj_sec; - - if (monitor_log) - fputs ("\nIn wait ()", log_file); - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - timeout = -1; /* Don't time out -- user program is running. */ - expect ("eax:", 0); /* output any message before register display */ - expect_prompt (1); /* Wait for prompt, outputting extraneous text */ - - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - timeout = old_timeout; - rombug_fetch_registers (); - bufaddr = 0; - buflen = 0; - pc = read_register (PC_REGNUM); - addr = read_register (DATABASE_REG); - obj_sec = find_pc_section (pc); - if (obj_sec != NULL) - { - if (obj_sec->objfile != symfile_objfile) - new_symfile_objfile (obj_sec->objfile, 1, 0); - offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); - memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS); - offs->offsets[SECT_OFF_DATA (symfile_objfile)] = addr; - offs->offsets[SECT_OFF_BSS (symfile_objfile)] = addr; - - objfile_relocate (symfile_objfile, offs); - } - - return inferior_ptid; -} - -/* Return the name of register number regno in the form input and output by - monitor. Currently, register_names just happens to contain exactly what - monitor wants. Lets take advantage of that just as long as possible! */ - -static char * -get_reg_name (int regno) -{ - static char buf[50]; - char *p; - char *b; - - b = buf; - - if (regno < 0) - return (""); -/* - for (p = REGISTER_NAME (regno); *p; p++) - *b++ = toupper(*p); - *b = '\000'; - */ - p = (char *) REGISTER_NAME (regno); - return p; -/* - return buf; - */ -} - -/* read the remote registers into the block regs. */ - -static void -rombug_fetch_registers (void) -{ - int regno, j, i; - long val; - unsigned char b; - - printf_monitor (GET_REG); - expect ("eax:", 1); - expect ("\n", 1); - get_hex_regs (1, 0); - get_hex_regs (1, 3); - get_hex_regs (1, 1); - get_hex_regs (1, 2); - get_hex_regs (1, 6); - get_hex_regs (1, 7); - get_hex_regs (1, 5); - get_hex_regs (1, 4); - for (regno = 8; regno <= 15; regno++) - { - expect (REG_DELIM, 1); - if (regno >= 8 && regno <= 13) - { - val = 0; - for (j = 0; j < 2; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - val = (val << 8) + b; - else - val = val + (b << (j * 8)); - } - - if (regno == 8) - i = 10; - if (regno >= 9 && regno <= 12) - i = regno + 3; - if (regno == 13) - i = 11; - supply_register (i, (char *) &val); - } - else if (regno == 14) - { - get_hex_regs (1, PC_REGNUM); - } - else if (regno == 15) - { - get_hex_regs (1, 9); - } - else - { - val = 0; - supply_register (regno, (char *) &val); - } - } - is_trace_mode = 0; - expect_prompt (1); -} - -/* Fetch register REGNO, or all registers if REGNO is -1. - Returns errno value. */ -static void -rombug_fetch_register (int regno) -{ - int val, j; - unsigned char b; - - if (monitor_log) - { - fprintf (log_file, "\nIn Fetch Register (reg=%s)\n", get_reg_name (regno)); - fflush (log_file); - } - - if (regno < 0) - { - rombug_fetch_registers (); - } - else - { - char *name = get_reg_name (regno); - printf_monitor (GET_REG); - if (regno >= 10 && regno <= 15) - { - expect ("\n", 1); - expect ("\n", 1); - expect (name, 1); - expect (REG_DELIM, 1); - val = 0; - for (j = 0; j < 2; j++) - { - get_hex_byte (&b); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) - val = (val << 8) + b; - else - val = val + (b << (j * 8)); - } - supply_register (regno, (char *) &val); - } - else if (regno == 8 || regno == 9) - { - expect ("\n", 1); - expect ("\n", 1); - expect ("\n", 1); - expect (name, 1); - expect (REG_DELIM, 1); - get_hex_regs (1, regno); - } - else - { - expect (name, 1); - expect (REG_DELIM, 1); - expect ("\n", 1); - get_hex_regs (1, 0); - get_hex_regs (1, 3); - get_hex_regs (1, 1); - get_hex_regs (1, 2); - get_hex_regs (1, 6); - get_hex_regs (1, 7); - get_hex_regs (1, 5); - get_hex_regs (1, 4); - } - expect_prompt (1); - } - return; -} - -/* Store the remote registers from the contents of the block REGS. */ - -static void -rombug_store_registers (void) -{ - int regno; - - for (regno = 0; regno <= PC_REGNUM; regno++) - rombug_store_register (regno); - - registers_changed (); -} - -/* Store register REGNO, or all if REGNO == 0. - return errno value. */ -static void -rombug_store_register (int regno) -{ - char *name; - - if (monitor_log) - fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno); - - if (regno == -1) - rombug_store_registers (); - else - { - if (sr_get_debug ()) - printf ("Setting register %s to 0x%x\n", get_reg_name (regno), read_register (regno)); - - name = get_reg_name (regno); - if (name == 0) - return; - printf_monitor (SET_REG, name, read_register (regno)); - - is_trace_mode = 0; - expect_prompt (1); - } -} - -/* Get ready to modify the registers array. On machines which store - individual registers, this doesn't need to do anything. On machines - which store all the registers in one fell swoop, this makes sure - that registers contains all the registers from the program being - debugged. */ - -static void -rombug_prepare_to_store (void) -{ - /* Do nothing, since we can store individual regs */ -} - -static void -rombug_files_info (void) -{ - printf ("\tAttached to %s at %d baud.\n", - dev_name, sr_get_baud_rate ()); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns length moved. */ -static int -rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) -{ - int i; - char buf[10]; - - if (monitor_log) - fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); - - printf_monitor (MEM_SET_CMD, memaddr); - for (i = 0; i < len; i++) - { - expect (CMD_DELIM, 1); - printf_monitor ("%x \r", myaddr[i]); - if (sr_get_debug ()) - printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]); - } - expect (CMD_DELIM, 1); - if (CMD_END) - printf_monitor (CMD_END); - is_trace_mode = 0; - expect_prompt (1); - - bufaddr = 0; - buflen = 0; - return len; -} - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns length moved. */ -static int -rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) -{ - int i, j; - - /* Number of bytes read so far. */ - int count; - - /* Starting address of this pass. */ - unsigned long startaddr; - - /* Number of bytes to read in this pass. */ - int len_this_pass; - - if (monitor_log) - fprintf (log_file, "\nIn Read_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); - - /* Note that this code works correctly if startaddr is just less - than UINT_MAX (well, really CORE_ADDR_MAX if there was such a - thing). That is, something like - rombug_read_bytes (CORE_ADDR_MAX - 4, foo, 4) - works--it never adds len To memaddr and gets 0. */ - /* However, something like - rombug_read_bytes (CORE_ADDR_MAX - 3, foo, 4) - doesn't need to work. Detect it and give up if there's an attempt - to do that. */ - if (((memaddr - 1) + len) < memaddr) - { - errno = EIO; - return 0; - } - if (bufaddr <= memaddr && (memaddr + len) <= (bufaddr + buflen)) - { - memcpy (myaddr, &readbuf[memaddr - bufaddr], len); - return len; - } - - startaddr = memaddr; - count = 0; - while (count < len) - { - len_this_pass = 16; - if ((startaddr % 16) != 0) - len_this_pass -= startaddr % 16; - if (len_this_pass > (len - count)) - len_this_pass = (len - count); - if (sr_get_debug ()) - printf ("\nDisplay %d bytes at %x\n", len_this_pass, startaddr); - - printf_monitor (MEM_DIS_CMD, startaddr, 8); - expect ("- ", 1); - for (i = 0; i < 16; i++) - { - get_hex_byte (&readbuf[i]); - } - bufaddr = startaddr; - buflen = 16; - memcpy (&myaddr[count], readbuf, len_this_pass); - count += len_this_pass; - startaddr += len_this_pass; - expect (CMD_DELIM, 1); - } - if (CMD_END) - printf_monitor (CMD_END); - is_trace_mode = 0; - expect_prompt (1); - - return len; -} - -/* Transfer LEN bytes between GDB address MYADDR and target address - MEMADDR. If WRITE is non-zero, transfer them to the target, - otherwise transfer them from the target. TARGET is unused. - - Returns the number of bytes transferred. */ - -static int -rombug_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, - int write, struct mem_attrib *attrib, - struct target_ops *target) -{ - if (write) - return rombug_write_inferior_memory (memaddr, myaddr, len); - else - return rombug_read_inferior_memory (memaddr, myaddr, len); -} - -static void -rombug_kill (char *args, int from_tty) -{ - return; /* ignore attempts to kill target system */ -} - -/* Clean up when a program exits. - The program actually lives on in the remote processor's RAM, and may be - run again without a download. Don't leave it full of breakpoint - instructions. */ - -static void -rombug_mourn_inferior (void) -{ - remove_breakpoints (); - generic_mourn_inferior (); /* Do all the proper things now */ -} - -#define MAX_MONITOR_BREAKPOINTS 16 - -static CORE_ADDR breakaddr[MAX_MONITOR_BREAKPOINTS] = -{0}; - -static int -rombug_insert_breakpoint (CORE_ADDR addr, char *shadow) -{ - int i; - CORE_ADDR bp_addr = addr; - int bp_size = 0; - - if (monitor_log) - fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr); - BREAKPOINT_FROM_PC (&bp_addr, &bp_size); - - for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++) - if (breakaddr[i] == 0) - { - breakaddr[i] = addr; - if (sr_get_debug ()) - printf ("Breakpoint at %x\n", addr); - rombug_read_inferior_memory (bp_addr, shadow, bp_size); - printf_monitor (SET_BREAK_CMD, addr); - is_trace_mode = 0; - expect_prompt (1); - return 0; - } - - fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for monitor\n"); - return 1; -} - -/* - * _remove_breakpoint -- Tell the monitor to remove a breakpoint - */ -static int -rombug_remove_breakpoint (CORE_ADDR addr, char *shadow) -{ - int i; - - if (monitor_log) - fprintf (log_file, "\nIn Remove_breakpoint (addr=%x)\n", addr); - - for (i = 0; i < MAX_MONITOR_BREAKPOINTS; i++) - if (breakaddr[i] == addr) - { - breakaddr[i] = 0; - printf_monitor (CLR_BREAK_CMD, addr); - is_trace_mode = 0; - expect_prompt (1); - return 0; - } - - fprintf_unfiltered (gdb_stderr, - "Can't find breakpoint associated with 0x%x\n", addr); - return 1; -} - -/* Load a file. This is usually an srecord, which is ascii. No - protocol, just sent line by line. */ - -#define DOWNLOAD_LINE_SIZE 100 -static void -rombug_load (char *arg) -{ -/* this part comment out for os9* */ -#if 0 - FILE *download; - char buf[DOWNLOAD_LINE_SIZE]; - int i, bytes_read; - - if (sr_get_debug ()) - printf ("Loading %s to monitor\n", arg); - - download = fopen (arg, "r"); - if (download == NULL) - { - error (sprintf (buf, "%s Does not exist", arg)); - return; - } - - printf_monitor (LOAD_CMD); -/* expect ("Waiting for S-records from host... ", 1); */ - - while (!feof (download)) - { - bytes_read = fread (buf, sizeof (char), DOWNLOAD_LINE_SIZE, download); - if (hashmark) - { - putchar ('.'); - fflush (stdout); - } - - if (serial_write (monitor_desc, buf, bytes_read)) - { - fprintf_unfiltered (gdb_stderr, - "serial_write failed: (while downloading) %s\n", - safe_strerror (errno)); - break; - } - i = 0; - while (i++ <= 200000) - { - }; /* Ugly HACK, probably needs flow control */ - if (bytes_read < DOWNLOAD_LINE_SIZE) - { - if (!feof (download)) - error ("Only read %d bytes\n", bytes_read); - break; - } - } - - if (hashmark) - { - putchar ('\n'); - } - if (!feof (download)) - error ("Never got EOF while downloading"); - fclose (download); -#endif /* 0 */ -} - -/* Put a command string, in args, out to MONITOR. - Output from MONITOR is placed on the users terminal until the prompt - is seen. */ - -static void -rombug_command (char *args, int fromtty) -{ - if (monitor_desc == NULL) - error ("monitor target not open."); - - if (monitor_log) - fprintf (log_file, "\nIn command (args=%s)\n", args); - - if (!args) - error ("Missing command."); - - printf_monitor ("%s\r", args); - expect_prompt (0); -} - -#if 0 -/* Connect the user directly to MONITOR. This command acts just like the - 'cu' or 'tip' command. Use ~. or ~^D to break out. */ - -static struct ttystate ttystate; - -static void -cleanup_tty (void) -{ - printf ("\r\n[Exiting connect mode]\r\n"); - /*serial_restore(0, &ttystate); */ -} - -static void -connect_command (char *args, int fromtty) -{ - fd_set readfds; - int numfds; - int c; - char cur_esc = 0; - - dont_repeat (); - - if (monitor_desc == NULL) - error ("monitor target not open."); - - if (args) - fprintf ("This command takes no args. They have been ignored.\n"); - - printf ("[Entering connect mode. Use ~. or ~^D to escape]\n"); - - serial_raw (0, &ttystate); - - make_cleanup (cleanup_tty, 0); - - FD_ZERO (&readfds); - - while (1) - { - do - { - FD_SET (0, &readfds); - FD_SET (deprecated_serial_fd (monitor_desc), &readfds); - numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0); - } - while (numfds == 0); - - if (numfds < 0) - perror_with_name ("select"); - - if (FD_ISSET (0, &readfds)) - { /* tty input, send to monitor */ - c = getchar (); - if (c < 0) - perror_with_name ("connect"); - - printf_monitor ("%c", c); - switch (cur_esc) - { - case 0: - if (c == '\r') - cur_esc = c; - break; - case '\r': - if (c == '~') - cur_esc = c; - else - cur_esc = 0; - break; - case '~': - if (c == '.' || c == '\004') - return; - else - cur_esc = 0; - } - } - - if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds)) - { - while (1) - { - c = readchar (0); - if (c < 0) - break; - putchar (c); - } - fflush (stdout); - } - } -} -#endif - -/* - * Define the monitor command strings. Since these are passed directly - * through to a printf style function, we need can include formatting - * strings. We also need a CR or LF on the end. - */ -#warning FIXME: monitor interface pattern strings, stale struct decl -struct monitor_ops rombug_cmds = -{ - "g \r", /* execute or usually GO command */ - "g \r", /* continue command */ - "t \r", /* single step */ - "b %x\r", /* set a breakpoint */ - "k %x\r", /* clear a breakpoint */ - "c %x\r", /* set memory to a value */ - "d %x %d\r", /* display memory */ - "$%08X", /* prompt memory commands use */ - ".%s %x\r", /* set a register */ - ":", /* delimiter between registers */ - ". \r", /* read a register */ - "mf \r", /* download command */ - "RomBug: ", /* monitor command prompt */ - ": ", /* end-of-command delimitor */ - ".\r" /* optional command terminator */ -}; - -struct target_ops rombug_ops; - -static void -init_rombug_ops (void) -{ - rombug_ops.to_shortname = "rombug"; - rombug_ops.to_longname = "Microware's ROMBUG debug monitor"; - rombug_ops.to_doc = "Use a remote computer running the ROMBUG debug monitor.\n\ -Specify the serial device it is connected to (e.g. /dev/ttya).", - rombug_ops.to_open = rombug_open; - rombug_ops.to_close = rombug_close; - rombug_ops.to_attach = 0; - rombug_ops.to_post_attach = NULL; - rombug_ops.to_require_attach = NULL; - rombug_ops.to_detach = rombug_detach; - rombug_ops.to_require_detach = NULL; - rombug_ops.to_resume = rombug_resume; - rombug_ops.to_wait = rombug_wait; - rombug_ops.to_post_wait = NULL; - rombug_ops.to_fetch_registers = rombug_fetch_register; - rombug_ops.to_store_registers = rombug_store_register; - rombug_ops.to_prepare_to_store = rombug_prepare_to_store; - rombug_ops.to_xfer_memory = rombug_xfer_inferior_memory; - rombug_ops.to_files_info = rombug_files_info; - rombug_ops.to_insert_breakpoint = rombug_insert_breakpoint; - rombug_ops.to_remove_breakpoint = rombug_remove_breakpoint; /* Breakpoints */ - rombug_ops.to_terminal_init = 0; - rombug_ops.to_terminal_inferior = 0; - rombug_ops.to_terminal_ours_for_output = 0; - rombug_ops.to_terminal_ours = 0; - rombug_ops.to_terminal_info = 0; /* Terminal handling */ - rombug_ops.to_kill = rombug_kill; - rombug_ops.to_load = rombug_load; /* load */ - rombug_ops.to_lookup_symbol = rombug_link; /* lookup_symbol */ - rombug_ops.to_create_inferior = rombug_create_inferior; - rombug_ops.to_post_startup_inferior = NULL; - rombug_ops.to_acknowledge_created_inferior = NULL; - rombug_ops.to_clone_and_follow_inferior = NULL; - rombug_ops.to_post_follow_inferior_by_clone = NULL; - rombug_ops.to_insert_fork_catchpoint = NULL; - rombug_ops.to_remove_fork_catchpoint = NULL; - rombug_ops.to_insert_vfork_catchpoint = NULL; - rombug_ops.to_remove_vfork_catchpoint = NULL; - rombug_ops.to_has_forked = NULL; - rombug_ops.to_has_vforked = NULL; - rombug_ops.to_can_follow_vfork_prior_to_exec = NULL; - rombug_ops.to_post_follow_vfork = NULL; - rombug_ops.to_insert_exec_catchpoint = NULL; - rombug_ops.to_remove_exec_catchpoint = NULL; - rombug_ops.to_has_execd = NULL; - rombug_ops.to_reported_exec_events_per_exec_call = NULL; - rombug_ops.to_has_exited = NULL; - rombug_ops.to_mourn_inferior = rombug_mourn_inferior; - rombug_ops.to_can_run = 0; /* can_run */ - rombug_ops.to_notice_signals = 0; /* notice_signals */ - rombug_ops.to_thread_alive = 0; - rombug_ops.to_stop = 0; /* to_stop */ - rombug_ops.to_pid_to_exec_file = NULL; - rombug_ops.to_stratum = process_stratum; - rombug_ops.DONT_USE = 0; /* next */ - rombug_ops.to_has_all_memory = 1; - rombug_ops.to_has_memory = 1; - rombug_ops.to_has_stack = 1; - rombug_ops.to_has_registers = 1; - rombug_ops.to_has_execution = 1; /* has execution */ - rombug_ops.to_sections = 0; - rombug_ops.to_sections_end = 0; /* Section pointers */ - rombug_ops.to_magic = OPS_MAGIC; /* Always the last thing */ -} - -void -_initialize_remote_os9k (void) -{ - init_rombug_ops (); - add_target (&rombug_ops); - - add_show_from_set ( - add_set_cmd ("hash", no_class, var_boolean, (char *) &hashmark, - "Set display of activity while downloading a file.\nWhen enabled, a period \'.\' is displayed.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("timeout", no_class, var_zinteger, - (char *) &timeout, - "Set timeout in seconds for remote MIPS serial I/O.", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotelog", no_class, var_zinteger, - (char *) &monitor_log, - "Set monitor activity log on(=1) or off(=0).", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotexon", no_class, var_zinteger, - (char *) &tty_xon, - "Set remote tty line XON control", - &setlist), - &showlist); - - add_show_from_set ( - add_set_cmd ("remotexoff", no_class, var_zinteger, - (char *) &tty_xoff, - "Set remote tty line XOFF control", - &setlist), - &showlist); - - add_com ("rombug ", class_obscure, rombug_command, - "Send a command to the debug monitor."); -#if 0 - add_com ("connect", class_obscure, connect_command, - "Connect the terminal directly up to a serial based command monitor.\nUse ~. or ~^D to break out."); -#endif -} +// OBSOLETE /* Remote debugging interface for boot monitors, for GDB. +// OBSOLETE +// OBSOLETE Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, +// OBSOLETE 2000, 2001, 2002 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 /* This file was derived from remote-eb.c, which did a similar job, but for +// OBSOLETE an AMD-29K running EBMON. That file was in turn derived from remote.c +// OBSOLETE as mentioned in the following comment (left in for comic relief): +// OBSOLETE +// OBSOLETE "This is like remote.c but is for a different situation-- +// OBSOLETE having a PC running os9000 hook up with a unix machine with +// OBSOLETE a serial line, and running ctty com2 on the PC. os9000 has a debug +// OBSOLETE monitor called ROMBUG running. Not to mention that the PC +// OBSOLETE has PC/NFS, so it can access the same executables that gdb can, +// OBSOLETE over the net in real time." +// OBSOLETE +// OBSOLETE In reality, this module talks to a debug monitor called 'ROMBUG', which +// OBSOLETE We communicate with ROMBUG via a direct serial line, the network version +// OBSOLETE of ROMBUG is not available yet. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* FIXME This file needs to be rewritten if it's to work again, either +// OBSOLETE to self-contained or to use the new monitor interface. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "target.h" +// OBSOLETE #include "gdb_string.h" +// OBSOLETE #include +// OBSOLETE #include "command.h" +// OBSOLETE #include "serial.h" +// OBSOLETE #include "monitor.h" +// OBSOLETE #include "remote-utils.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "symfile.h" +// OBSOLETE #include "objfiles.h" +// OBSOLETE #include "gdb-stabs.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE struct cmd_list_element *showlist; +// OBSOLETE extern struct target_ops rombug_ops; /* Forward declaration */ +// OBSOLETE extern struct monitor_ops rombug_cmds; /* Forward declaration */ +// OBSOLETE extern struct cmd_list_element *setlist; +// OBSOLETE extern struct cmd_list_element *unsetlist; +// OBSOLETE extern int attach_flag; +// OBSOLETE +// OBSOLETE static void rombug_close (); +// OBSOLETE static void rombug_fetch_register (); +// OBSOLETE static void rombug_fetch_registers (); +// OBSOLETE static void rombug_store_register (); +// OBSOLETE #if 0 +// OBSOLETE static int sr_get_debug (); /* flag set by "set remotedebug" */ +// OBSOLETE #endif +// OBSOLETE static int hashmark; /* flag set by "set hash" */ +// OBSOLETE static int rombug_is_open = 0; +// OBSOLETE +// OBSOLETE /* FIXME: Replace with sr_get_debug (). */ +// OBSOLETE #define LOG_FILE "monitor.log" +// OBSOLETE FILE *log_file; +// OBSOLETE static int monitor_log = 0; +// OBSOLETE static int tty_xon = 0; +// OBSOLETE static int tty_xoff = 0; +// OBSOLETE +// OBSOLETE static int timeout = 10; +// OBSOLETE static int is_trace_mode = 0; +// OBSOLETE /* Descriptor for I/O to remote machine. Initialize it to NULL */ +// OBSOLETE static struct serial *monitor_desc = NULL; +// OBSOLETE +// OBSOLETE static CORE_ADDR bufaddr = 0; +// OBSOLETE static int buflen = 0; +// OBSOLETE static char readbuf[16]; +// OBSOLETE +// OBSOLETE /* Send data to monitor. Works just like printf. */ +// OBSOLETE static void +// OBSOLETE printf_monitor (char *pattern,...) +// OBSOLETE { +// OBSOLETE va_list args; +// OBSOLETE char buf[200]; +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE va_start (args, pattern); +// OBSOLETE +// OBSOLETE vsprintf (buf, pattern, args); +// OBSOLETE va_end (args); +// OBSOLETE +// OBSOLETE if (serial_write (monitor_desc, buf, strlen (buf))) +// OBSOLETE fprintf_unfiltered (gdb_stderr, "serial_write failed: %s\n", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read a character from the remote system, doing all the fancy timeout stuff */ +// OBSOLETE static int +// OBSOLETE readchar (int timeout) +// OBSOLETE { +// OBSOLETE int c; +// OBSOLETE +// OBSOLETE c = serial_readchar (monitor_desc, timeout); +// OBSOLETE +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE putchar (c & 0x7f); +// OBSOLETE +// OBSOLETE if (monitor_log && isascii (c)) +// OBSOLETE putc (c & 0x7f, log_file); +// OBSOLETE +// OBSOLETE if (c >= 0) +// OBSOLETE return c & 0x7f; +// OBSOLETE +// OBSOLETE if (c == SERIAL_TIMEOUT) +// OBSOLETE { +// OBSOLETE if (timeout == 0) +// OBSOLETE return c; /* Polls shouldn't generate timeout errors */ +// OBSOLETE +// OBSOLETE error ("Timeout reading from remote system."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE perror_with_name ("remote-monitor"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Scan input from the remote system, until STRING is found. If DISCARD is +// OBSOLETE non-zero, then discard non-matching input, else print it out. +// OBSOLETE Let the user break out immediately. */ +// OBSOLETE static void +// OBSOLETE expect (char *string, int discard) +// OBSOLETE { +// OBSOLETE char *p = string; +// OBSOLETE int c; +// OBSOLETE +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("Expecting \"%s\"\n", string); +// OBSOLETE +// OBSOLETE immediate_quit++; +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE c = readchar (timeout); +// OBSOLETE if (!isascii (c)) +// OBSOLETE continue; +// OBSOLETE if (c == *p++) +// OBSOLETE { +// OBSOLETE if (*p == '\0') +// OBSOLETE { +// OBSOLETE immediate_quit--; +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("\nMatched\n"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (!discard) +// OBSOLETE { +// OBSOLETE fwrite (string, 1, (p - 1) - string, stdout); +// OBSOLETE putchar ((char) c); +// OBSOLETE fflush (stdout); +// OBSOLETE } +// OBSOLETE p = string; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Keep discarding input until we see the ROMBUG prompt. +// OBSOLETE +// OBSOLETE The convention for dealing with the prompt is that you +// OBSOLETE o give your command +// OBSOLETE o *then* wait for the prompt. +// OBSOLETE +// OBSOLETE Thus the last thing that a procedure does with the serial line +// OBSOLETE will be an expect_prompt(). Exception: rombug_resume does not +// OBSOLETE wait for the prompt, because the terminal is being handed over +// OBSOLETE to the inferior. However, the next thing which happens after that +// OBSOLETE is a rombug_wait which does wait for the prompt. +// OBSOLETE Note that this includes abnormal exit, e.g. error(). This is +// OBSOLETE necessary to prevent getting into states from which we can't +// OBSOLETE recover. */ +// OBSOLETE static void +// OBSOLETE expect_prompt (int discard) +// OBSOLETE { +// OBSOLETE if (monitor_log) +// OBSOLETE /* This is a convenient place to do this. The idea is to do it often +// OBSOLETE enough that we never lose much data if we terminate abnormally. */ +// OBSOLETE fflush (log_file); +// OBSOLETE +// OBSOLETE if (is_trace_mode) +// OBSOLETE { +// OBSOLETE expect ("trace", discard); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE expect (PROMPT, discard); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Get a hex digit from the remote system & return its value. +// OBSOLETE If ignore_space is nonzero, ignore spaces (not newline, tab, etc). */ +// OBSOLETE static int +// OBSOLETE get_hex_digit (int ignore_space) +// OBSOLETE { +// OBSOLETE int ch; +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE ch = readchar (timeout); +// OBSOLETE if (ch >= '0' && ch <= '9') +// OBSOLETE return ch - '0'; +// OBSOLETE else if (ch >= 'A' && ch <= 'F') +// OBSOLETE return ch - 'A' + 10; +// OBSOLETE else if (ch >= 'a' && ch <= 'f') +// OBSOLETE return ch - 'a' + 10; +// OBSOLETE else if (ch == ' ' && ignore_space) +// OBSOLETE ; +// OBSOLETE else +// OBSOLETE { +// OBSOLETE expect_prompt (1); +// OBSOLETE error ("Invalid hex digit from remote system."); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Get a byte from monitor and put it in *BYT. Accept any number +// OBSOLETE leading spaces. */ +// OBSOLETE static void +// OBSOLETE get_hex_byte (char *byt) +// OBSOLETE { +// OBSOLETE int val; +// OBSOLETE +// OBSOLETE val = get_hex_digit (1) << 4; +// OBSOLETE val |= get_hex_digit (0); +// OBSOLETE *byt = val; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Get N 32-bit words from remote, each preceded by a space, +// OBSOLETE and put them in registers starting at REGNO. */ +// OBSOLETE static void +// OBSOLETE get_hex_regs (int n, int regno) +// OBSOLETE { +// OBSOLETE long val; +// OBSOLETE int i; +// OBSOLETE unsigned char b; +// OBSOLETE +// OBSOLETE for (i = 0; i < n; i++) +// OBSOLETE { +// OBSOLETE int j; +// OBSOLETE +// OBSOLETE val = 0; +// OBSOLETE for (j = 0; j < 4; j++) +// OBSOLETE { +// OBSOLETE get_hex_byte (&b); +// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) +// OBSOLETE val = (val << 8) + b; +// OBSOLETE else +// OBSOLETE val = val + (b << (j * 8)); +// OBSOLETE } +// OBSOLETE supply_register (regno++, (char *) &val); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This is called not only when we first attach, but also when the +// OBSOLETE user types "run" after having attached. */ +// OBSOLETE static void +// OBSOLETE rombug_create_inferior (char *execfile, char *args, char **env) +// OBSOLETE { +// OBSOLETE int entry_pt; +// OBSOLETE +// OBSOLETE if (args && *args) +// OBSOLETE error ("Can't pass arguments to remote ROMBUG process"); +// OBSOLETE +// OBSOLETE if (execfile == 0 || exec_bfd == 0) +// OBSOLETE error ("No executable file specified"); +// OBSOLETE +// OBSOLETE entry_pt = (int) bfd_get_start_address (exec_bfd); +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fputs ("\nIn Create_inferior()", log_file); +// OBSOLETE +// OBSOLETE +// OBSOLETE /* The "process" (board) is already stopped awaiting our commands, and +// OBSOLETE the program is already downloaded. We just set its PC and go. */ +// OBSOLETE +// OBSOLETE init_wait_for_inferior (); +// OBSOLETE proceed ((CORE_ADDR) entry_pt, TARGET_SIGNAL_DEFAULT, 0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Open a connection to a remote debugger. +// OBSOLETE NAME is the filename used for communication. */ +// OBSOLETE +// OBSOLETE static char dev_name[100]; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_open (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE if (args == NULL) +// OBSOLETE error ("Use `target RomBug DEVICE-NAME' to use a serial port, or \n\ +// OBSOLETE `target RomBug HOST-NAME:PORT-NUMBER' to use a network connection."); +// OBSOLETE +// OBSOLETE target_preopen (from_tty); +// OBSOLETE +// OBSOLETE if (rombug_is_open) +// OBSOLETE unpush_target (&rombug_ops); +// OBSOLETE +// OBSOLETE strcpy (dev_name, args); +// OBSOLETE monitor_desc = serial_open (dev_name); +// OBSOLETE if (monitor_desc == NULL) +// OBSOLETE perror_with_name (dev_name); +// OBSOLETE +// OBSOLETE /* if baud rate is set by 'set remotebaud' */ +// OBSOLETE if (serial_setbaudrate (monitor_desc, sr_get_baud_rate ())) +// OBSOLETE { +// OBSOLETE serial_close (monitor_desc); +// OBSOLETE perror_with_name ("RomBug"); +// OBSOLETE } +// OBSOLETE serial_raw (monitor_desc); +// OBSOLETE if (tty_xon || tty_xoff) +// OBSOLETE { +// OBSOLETE struct hardware_ttystate +// OBSOLETE { +// OBSOLETE struct termios t; +// OBSOLETE } +// OBSOLETE *tty_s; +// OBSOLETE +// OBSOLETE tty_s = (struct hardware_ttystate *) serial_get_tty_state (monitor_desc); +// OBSOLETE if (tty_xon) +// OBSOLETE tty_s->t.c_iflag |= IXON; +// OBSOLETE if (tty_xoff) +// OBSOLETE tty_s->t.c_iflag |= IXOFF; +// OBSOLETE serial_set_tty_state (monitor_desc, (serial_ttystate) tty_s); +// OBSOLETE } +// OBSOLETE +// OBSOLETE rombug_is_open = 1; +// OBSOLETE +// OBSOLETE log_file = fopen (LOG_FILE, "w"); +// OBSOLETE if (log_file == NULL) +// OBSOLETE perror_with_name (LOG_FILE); +// OBSOLETE +// OBSOLETE push_monitor (&rombug_cmds); +// OBSOLETE printf_monitor ("\r"); /* CR wakes up monitor */ +// OBSOLETE expect_prompt (1); +// OBSOLETE push_target (&rombug_ops); +// OBSOLETE attach_flag = 1; +// OBSOLETE +// OBSOLETE if (from_tty) +// OBSOLETE printf ("Remote %s connected to %s\n", target_shortname, +// OBSOLETE dev_name); +// OBSOLETE +// OBSOLETE rombug_fetch_registers (); +// OBSOLETE +// OBSOLETE printf_monitor ("ov e \r"); +// OBSOLETE expect_prompt (1); +// OBSOLETE bufaddr = 0; +// OBSOLETE buflen = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Close out all files and local state before this target loses control. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_close (int quitting) +// OBSOLETE { +// OBSOLETE if (rombug_is_open) +// OBSOLETE { +// OBSOLETE serial_close (monitor_desc); +// OBSOLETE monitor_desc = NULL; +// OBSOLETE rombug_is_open = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (log_file) +// OBSOLETE { +// OBSOLETE if (ferror (log_file)) +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Error writing log file.\n"); +// OBSOLETE if (fclose (log_file) != 0) +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Error closing log file.\n"); +// OBSOLETE log_file = 0; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE rombug_link (char *mod_name, CORE_ADDR *text_reloc) +// OBSOLETE { +// OBSOLETE int i, j; +// OBSOLETE unsigned long val; +// OBSOLETE unsigned char b; +// OBSOLETE +// OBSOLETE printf_monitor ("l %s \r", mod_name); +// OBSOLETE expect_prompt (1); +// OBSOLETE printf_monitor (".r \r"); +// OBSOLETE expect (REG_DELIM, 1); +// OBSOLETE for (i = 0; i <= 7; i++) +// OBSOLETE { +// OBSOLETE val = 0; +// OBSOLETE for (j = 0; j < 4; j++) +// OBSOLETE { +// OBSOLETE get_hex_byte (&b); +// OBSOLETE val = (val << 8) + b; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE expect_prompt (1); +// OBSOLETE *text_reloc = val; +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Terminate the open connection to the remote debugger. +// OBSOLETE Use this when you want to detach and do something else +// OBSOLETE with your gdb. */ +// OBSOLETE static void +// OBSOLETE rombug_detach (int from_tty) +// OBSOLETE { +// OBSOLETE if (attach_flag) +// OBSOLETE { +// OBSOLETE printf_monitor (GO_CMD); +// OBSOLETE attach_flag = 0; +// OBSOLETE } +// OBSOLETE pop_target (); /* calls rombug_close to do the real work */ +// OBSOLETE if (from_tty) +// OBSOLETE printf ("Ending remote %s debugging\n", target_shortname); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Tell the remote machine to resume. +// OBSOLETE */ +// OBSOLETE static void +// OBSOLETE rombug_resume (ptid_t ptid, int step, enum target_signal sig) +// OBSOLETE { +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Resume (step=%d, sig=%d)\n", step, sig); +// OBSOLETE +// OBSOLETE if (step) +// OBSOLETE { +// OBSOLETE is_trace_mode = 1; +// OBSOLETE printf_monitor (STEP_CMD); +// OBSOLETE /* wait for the echo. ** +// OBSOLETE expect (STEP_CMD, 1); +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE printf_monitor (GO_CMD); +// OBSOLETE /* swallow the echo. ** +// OBSOLETE expect (GO_CMD, 1); +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE bufaddr = 0; +// OBSOLETE buflen = 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Wait until the remote machine stops, then return, +// OBSOLETE * storing status in status just as `wait' would. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static ptid * +// OBSOLETE rombug_wait (ptid_t ptid, struct target_waitstatus *status) +// OBSOLETE { +// OBSOLETE int old_timeout = timeout; +// OBSOLETE struct section_offsets *offs; +// OBSOLETE CORE_ADDR addr, pc; +// OBSOLETE struct obj_section *obj_sec; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fputs ("\nIn wait ()", log_file); +// OBSOLETE +// OBSOLETE status->kind = TARGET_WAITKIND_EXITED; +// OBSOLETE status->value.integer = 0; +// OBSOLETE +// OBSOLETE timeout = -1; /* Don't time out -- user program is running. */ +// OBSOLETE expect ("eax:", 0); /* output any message before register display */ +// OBSOLETE expect_prompt (1); /* Wait for prompt, outputting extraneous text */ +// OBSOLETE +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; +// OBSOLETE timeout = old_timeout; +// OBSOLETE rombug_fetch_registers (); +// OBSOLETE bufaddr = 0; +// OBSOLETE buflen = 0; +// OBSOLETE pc = read_register (PC_REGNUM); +// OBSOLETE addr = read_register (DATABASE_REG); +// OBSOLETE obj_sec = find_pc_section (pc); +// OBSOLETE if (obj_sec != NULL) +// OBSOLETE { +// OBSOLETE if (obj_sec->objfile != symfile_objfile) +// OBSOLETE new_symfile_objfile (obj_sec->objfile, 1, 0); +// OBSOLETE offs = (struct section_offsets *) alloca (SIZEOF_SECTION_OFFSETS); +// OBSOLETE memcpy (offs, symfile_objfile->section_offsets, SIZEOF_SECTION_OFFSETS); +// OBSOLETE offs->offsets[SECT_OFF_DATA (symfile_objfile)] = addr; +// OBSOLETE offs->offsets[SECT_OFF_BSS (symfile_objfile)] = addr; +// OBSOLETE +// OBSOLETE objfile_relocate (symfile_objfile, offs); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return inferior_ptid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the name of register number regno in the form input and output by +// OBSOLETE monitor. Currently, register_names just happens to contain exactly what +// OBSOLETE monitor wants. Lets take advantage of that just as long as possible! */ +// OBSOLETE +// OBSOLETE static char * +// OBSOLETE get_reg_name (int regno) +// OBSOLETE { +// OBSOLETE static char buf[50]; +// OBSOLETE char *p; +// OBSOLETE char *b; +// OBSOLETE +// OBSOLETE b = buf; +// OBSOLETE +// OBSOLETE if (regno < 0) +// OBSOLETE return (""); +// OBSOLETE /* +// OBSOLETE for (p = REGISTER_NAME (regno); *p; p++) +// OBSOLETE *b++ = toupper(*p); +// OBSOLETE *b = '\000'; +// OBSOLETE */ +// OBSOLETE p = (char *) REGISTER_NAME (regno); +// OBSOLETE return p; +// OBSOLETE /* +// OBSOLETE return buf; +// OBSOLETE */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* read the remote registers into the block regs. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_fetch_registers (void) +// OBSOLETE { +// OBSOLETE int regno, j, i; +// OBSOLETE long val; +// OBSOLETE unsigned char b; +// OBSOLETE +// OBSOLETE printf_monitor (GET_REG); +// OBSOLETE expect ("eax:", 1); +// OBSOLETE expect ("\n", 1); +// OBSOLETE get_hex_regs (1, 0); +// OBSOLETE get_hex_regs (1, 3); +// OBSOLETE get_hex_regs (1, 1); +// OBSOLETE get_hex_regs (1, 2); +// OBSOLETE get_hex_regs (1, 6); +// OBSOLETE get_hex_regs (1, 7); +// OBSOLETE get_hex_regs (1, 5); +// OBSOLETE get_hex_regs (1, 4); +// OBSOLETE for (regno = 8; regno <= 15; regno++) +// OBSOLETE { +// OBSOLETE expect (REG_DELIM, 1); +// OBSOLETE if (regno >= 8 && regno <= 13) +// OBSOLETE { +// OBSOLETE val = 0; +// OBSOLETE for (j = 0; j < 2; j++) +// OBSOLETE { +// OBSOLETE get_hex_byte (&b); +// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) +// OBSOLETE val = (val << 8) + b; +// OBSOLETE else +// OBSOLETE val = val + (b << (j * 8)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (regno == 8) +// OBSOLETE i = 10; +// OBSOLETE if (regno >= 9 && regno <= 12) +// OBSOLETE i = regno + 3; +// OBSOLETE if (regno == 13) +// OBSOLETE i = 11; +// OBSOLETE supply_register (i, (char *) &val); +// OBSOLETE } +// OBSOLETE else if (regno == 14) +// OBSOLETE { +// OBSOLETE get_hex_regs (1, PC_REGNUM); +// OBSOLETE } +// OBSOLETE else if (regno == 15) +// OBSOLETE { +// OBSOLETE get_hex_regs (1, 9); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE val = 0; +// OBSOLETE supply_register (regno, (char *) &val); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Fetch register REGNO, or all registers if REGNO is -1. +// OBSOLETE Returns errno value. */ +// OBSOLETE static void +// OBSOLETE rombug_fetch_register (int regno) +// OBSOLETE { +// OBSOLETE int val, j; +// OBSOLETE unsigned char b; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE { +// OBSOLETE fprintf (log_file, "\nIn Fetch Register (reg=%s)\n", get_reg_name (regno)); +// OBSOLETE fflush (log_file); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (regno < 0) +// OBSOLETE { +// OBSOLETE rombug_fetch_registers (); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE char *name = get_reg_name (regno); +// OBSOLETE printf_monitor (GET_REG); +// OBSOLETE if (regno >= 10 && regno <= 15) +// OBSOLETE { +// OBSOLETE expect ("\n", 1); +// OBSOLETE expect ("\n", 1); +// OBSOLETE expect (name, 1); +// OBSOLETE expect (REG_DELIM, 1); +// OBSOLETE val = 0; +// OBSOLETE for (j = 0; j < 2; j++) +// OBSOLETE { +// OBSOLETE get_hex_byte (&b); +// OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) +// OBSOLETE val = (val << 8) + b; +// OBSOLETE else +// OBSOLETE val = val + (b << (j * 8)); +// OBSOLETE } +// OBSOLETE supply_register (regno, (char *) &val); +// OBSOLETE } +// OBSOLETE else if (regno == 8 || regno == 9) +// OBSOLETE { +// OBSOLETE expect ("\n", 1); +// OBSOLETE expect ("\n", 1); +// OBSOLETE expect ("\n", 1); +// OBSOLETE expect (name, 1); +// OBSOLETE expect (REG_DELIM, 1); +// OBSOLETE get_hex_regs (1, regno); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE expect (name, 1); +// OBSOLETE expect (REG_DELIM, 1); +// OBSOLETE expect ("\n", 1); +// OBSOLETE get_hex_regs (1, 0); +// OBSOLETE get_hex_regs (1, 3); +// OBSOLETE get_hex_regs (1, 1); +// OBSOLETE get_hex_regs (1, 2); +// OBSOLETE get_hex_regs (1, 6); +// OBSOLETE get_hex_regs (1, 7); +// OBSOLETE get_hex_regs (1, 5); +// OBSOLETE get_hex_regs (1, 4); +// OBSOLETE } +// OBSOLETE expect_prompt (1); +// OBSOLETE } +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store the remote registers from the contents of the block REGS. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_store_registers (void) +// OBSOLETE { +// OBSOLETE int regno; +// OBSOLETE +// OBSOLETE for (regno = 0; regno <= PC_REGNUM; regno++) +// OBSOLETE rombug_store_register (regno); +// OBSOLETE +// OBSOLETE registers_changed (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store register REGNO, or all if REGNO == 0. +// OBSOLETE return errno value. */ +// OBSOLETE static void +// OBSOLETE rombug_store_register (int regno) +// OBSOLETE { +// OBSOLETE char *name; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Store_register (regno=%d)\n", regno); +// OBSOLETE +// OBSOLETE if (regno == -1) +// OBSOLETE rombug_store_registers (); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("Setting register %s to 0x%x\n", get_reg_name (regno), read_register (regno)); +// OBSOLETE +// OBSOLETE name = get_reg_name (regno); +// OBSOLETE if (name == 0) +// OBSOLETE return; +// OBSOLETE printf_monitor (SET_REG, name, read_register (regno)); +// OBSOLETE +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Get ready to modify the registers array. On machines which store +// OBSOLETE individual registers, this doesn't need to do anything. On machines +// OBSOLETE which store all the registers in one fell swoop, this makes sure +// OBSOLETE that registers contains all the registers from the program being +// OBSOLETE debugged. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_prepare_to_store (void) +// OBSOLETE { +// OBSOLETE /* Do nothing, since we can store individual regs */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_files_info (void) +// OBSOLETE { +// OBSOLETE printf ("\tAttached to %s at %d baud.\n", +// OBSOLETE dev_name, sr_get_baud_rate ()); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Copy LEN bytes of data from debugger memory at MYADDR +// OBSOLETE to inferior's memory at MEMADDR. Returns length moved. */ +// OBSOLETE static int +// OBSOLETE rombug_write_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE char buf[10]; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Write_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); +// OBSOLETE +// OBSOLETE printf_monitor (MEM_SET_CMD, memaddr); +// OBSOLETE for (i = 0; i < len; i++) +// OBSOLETE { +// OBSOLETE expect (CMD_DELIM, 1); +// OBSOLETE printf_monitor ("%x \r", myaddr[i]); +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("\nSet 0x%x to 0x%x\n", memaddr + i, myaddr[i]); +// OBSOLETE } +// OBSOLETE expect (CMD_DELIM, 1); +// OBSOLETE if (CMD_END) +// OBSOLETE printf_monitor (CMD_END); +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE +// OBSOLETE bufaddr = 0; +// OBSOLETE buflen = 0; +// OBSOLETE return len; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read LEN bytes from inferior memory at MEMADDR. Put the result +// OBSOLETE at debugger address MYADDR. Returns length moved. */ +// OBSOLETE static int +// OBSOLETE rombug_read_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len) +// OBSOLETE { +// OBSOLETE int i, j; +// OBSOLETE +// OBSOLETE /* Number of bytes read so far. */ +// OBSOLETE int count; +// OBSOLETE +// OBSOLETE /* Starting address of this pass. */ +// OBSOLETE unsigned long startaddr; +// OBSOLETE +// OBSOLETE /* Number of bytes to read in this pass. */ +// OBSOLETE int len_this_pass; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Read_inferior_memory (memaddr=%x, len=%d)\n", memaddr, len); +// OBSOLETE +// OBSOLETE /* Note that this code works correctly if startaddr is just less +// OBSOLETE than UINT_MAX (well, really CORE_ADDR_MAX if there was such a +// OBSOLETE thing). That is, something like +// OBSOLETE rombug_read_bytes (CORE_ADDR_MAX - 4, foo, 4) +// OBSOLETE works--it never adds len To memaddr and gets 0. */ +// OBSOLETE /* However, something like +// OBSOLETE rombug_read_bytes (CORE_ADDR_MAX - 3, foo, 4) +// OBSOLETE doesn't need to work. Detect it and give up if there's an attempt +// OBSOLETE to do that. */ +// OBSOLETE if (((memaddr - 1) + len) < memaddr) +// OBSOLETE { +// OBSOLETE errno = EIO; +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE if (bufaddr <= memaddr && (memaddr + len) <= (bufaddr + buflen)) +// OBSOLETE { +// OBSOLETE memcpy (myaddr, &readbuf[memaddr - bufaddr], len); +// OBSOLETE return len; +// OBSOLETE } +// OBSOLETE +// OBSOLETE startaddr = memaddr; +// OBSOLETE count = 0; +// OBSOLETE while (count < len) +// OBSOLETE { +// OBSOLETE len_this_pass = 16; +// OBSOLETE if ((startaddr % 16) != 0) +// OBSOLETE len_this_pass -= startaddr % 16; +// OBSOLETE if (len_this_pass > (len - count)) +// OBSOLETE len_this_pass = (len - count); +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("\nDisplay %d bytes at %x\n", len_this_pass, startaddr); +// OBSOLETE +// OBSOLETE printf_monitor (MEM_DIS_CMD, startaddr, 8); +// OBSOLETE expect ("- ", 1); +// OBSOLETE for (i = 0; i < 16; i++) +// OBSOLETE { +// OBSOLETE get_hex_byte (&readbuf[i]); +// OBSOLETE } +// OBSOLETE bufaddr = startaddr; +// OBSOLETE buflen = 16; +// OBSOLETE memcpy (&myaddr[count], readbuf, len_this_pass); +// OBSOLETE count += len_this_pass; +// OBSOLETE startaddr += len_this_pass; +// OBSOLETE expect (CMD_DELIM, 1); +// OBSOLETE } +// OBSOLETE if (CMD_END) +// OBSOLETE printf_monitor (CMD_END); +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE +// OBSOLETE return len; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Transfer LEN bytes between GDB address MYADDR and target address +// OBSOLETE MEMADDR. If WRITE is non-zero, transfer them to the target, +// OBSOLETE otherwise transfer them from the target. TARGET is unused. +// OBSOLETE +// OBSOLETE Returns the number of bytes transferred. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE rombug_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len, +// OBSOLETE int write, struct mem_attrib *attrib, +// OBSOLETE struct target_ops *target) +// OBSOLETE { +// OBSOLETE if (write) +// OBSOLETE return rombug_write_inferior_memory (memaddr, myaddr, len); +// OBSOLETE else +// OBSOLETE return rombug_read_inferior_memory (memaddr, myaddr, len); +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_kill (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE return; /* ignore attempts to kill target system */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Clean up when a program exits. +// OBSOLETE The program actually lives on in the remote processor's RAM, and may be +// OBSOLETE run again without a download. Don't leave it full of breakpoint +// OBSOLETE instructions. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_mourn_inferior (void) +// OBSOLETE { +// OBSOLETE remove_breakpoints (); +// OBSOLETE generic_mourn_inferior (); /* Do all the proper things now */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define MAX_MONITOR_BREAKPOINTS 16 +// OBSOLETE +// OBSOLETE static CORE_ADDR breakaddr[MAX_MONITOR_BREAKPOINTS] = +// OBSOLETE {0}; +// OBSOLETE +// OBSOLETE static int +// OBSOLETE rombug_insert_breakpoint (CORE_ADDR addr, char *shadow) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE CORE_ADDR bp_addr = addr; +// OBSOLETE int bp_size = 0; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Insert_breakpoint (addr=%x)\n", addr); +// OBSOLETE BREAKPOINT_FROM_PC (&bp_addr, &bp_size); +// OBSOLETE +// OBSOLETE for (i = 0; i <= MAX_MONITOR_BREAKPOINTS; i++) +// OBSOLETE if (breakaddr[i] == 0) +// OBSOLETE { +// OBSOLETE breakaddr[i] = addr; +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("Breakpoint at %x\n", addr); +// OBSOLETE rombug_read_inferior_memory (bp_addr, shadow, bp_size); +// OBSOLETE printf_monitor (SET_BREAK_CMD, addr); +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Too many breakpoints (> 16) for monitor\n"); +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * _remove_breakpoint -- Tell the monitor to remove a breakpoint +// OBSOLETE */ +// OBSOLETE static int +// OBSOLETE rombug_remove_breakpoint (CORE_ADDR addr, char *shadow) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn Remove_breakpoint (addr=%x)\n", addr); +// OBSOLETE +// OBSOLETE for (i = 0; i < MAX_MONITOR_BREAKPOINTS; i++) +// OBSOLETE if (breakaddr[i] == addr) +// OBSOLETE { +// OBSOLETE breakaddr[i] = 0; +// OBSOLETE printf_monitor (CLR_BREAK_CMD, addr); +// OBSOLETE is_trace_mode = 0; +// OBSOLETE expect_prompt (1); +// OBSOLETE return 0; +// OBSOLETE } +// OBSOLETE +// OBSOLETE fprintf_unfiltered (gdb_stderr, +// OBSOLETE "Can't find breakpoint associated with 0x%x\n", addr); +// OBSOLETE return 1; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Load a file. This is usually an srecord, which is ascii. No +// OBSOLETE protocol, just sent line by line. */ +// OBSOLETE +// OBSOLETE #define DOWNLOAD_LINE_SIZE 100 +// OBSOLETE static void +// OBSOLETE rombug_load (char *arg) +// OBSOLETE { +// OBSOLETE /* this part comment out for os9* */ +// OBSOLETE #if 0 +// OBSOLETE FILE *download; +// OBSOLETE char buf[DOWNLOAD_LINE_SIZE]; +// OBSOLETE int i, bytes_read; +// OBSOLETE +// OBSOLETE if (sr_get_debug ()) +// OBSOLETE printf ("Loading %s to monitor\n", arg); +// OBSOLETE +// OBSOLETE download = fopen (arg, "r"); +// OBSOLETE if (download == NULL) +// OBSOLETE { +// OBSOLETE error (sprintf (buf, "%s Does not exist", arg)); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE printf_monitor (LOAD_CMD); +// OBSOLETE /* expect ("Waiting for S-records from host... ", 1); */ +// OBSOLETE +// OBSOLETE while (!feof (download)) +// OBSOLETE { +// OBSOLETE bytes_read = fread (buf, sizeof (char), DOWNLOAD_LINE_SIZE, download); +// OBSOLETE if (hashmark) +// OBSOLETE { +// OBSOLETE putchar ('.'); +// OBSOLETE fflush (stdout); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (serial_write (monitor_desc, buf, bytes_read)) +// OBSOLETE { +// OBSOLETE fprintf_unfiltered (gdb_stderr, +// OBSOLETE "serial_write failed: (while downloading) %s\n", +// OBSOLETE safe_strerror (errno)); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE i = 0; +// OBSOLETE while (i++ <= 200000) +// OBSOLETE { +// OBSOLETE }; /* Ugly HACK, probably needs flow control */ +// OBSOLETE if (bytes_read < DOWNLOAD_LINE_SIZE) +// OBSOLETE { +// OBSOLETE if (!feof (download)) +// OBSOLETE error ("Only read %d bytes\n", bytes_read); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (hashmark) +// OBSOLETE { +// OBSOLETE putchar ('\n'); +// OBSOLETE } +// OBSOLETE if (!feof (download)) +// OBSOLETE error ("Never got EOF while downloading"); +// OBSOLETE fclose (download); +// OBSOLETE #endif /* 0 */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Put a command string, in args, out to MONITOR. +// OBSOLETE Output from MONITOR is placed on the users terminal until the prompt +// OBSOLETE is seen. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE rombug_command (char *args, int fromtty) +// OBSOLETE { +// OBSOLETE if (monitor_desc == NULL) +// OBSOLETE error ("monitor target not open."); +// OBSOLETE +// OBSOLETE if (monitor_log) +// OBSOLETE fprintf (log_file, "\nIn command (args=%s)\n", args); +// OBSOLETE +// OBSOLETE if (!args) +// OBSOLETE error ("Missing command."); +// OBSOLETE +// OBSOLETE printf_monitor ("%s\r", args); +// OBSOLETE expect_prompt (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* Connect the user directly to MONITOR. This command acts just like the +// OBSOLETE 'cu' or 'tip' command. Use ~. or ~^D to break out. */ +// OBSOLETE +// OBSOLETE static struct ttystate ttystate; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE cleanup_tty (void) +// OBSOLETE { +// OBSOLETE printf ("\r\n[Exiting connect mode]\r\n"); +// OBSOLETE /*serial_restore(0, &ttystate); */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE connect_command (char *args, int fromtty) +// OBSOLETE { +// OBSOLETE fd_set readfds; +// OBSOLETE int numfds; +// OBSOLETE int c; +// OBSOLETE char cur_esc = 0; +// OBSOLETE +// OBSOLETE dont_repeat (); +// OBSOLETE +// OBSOLETE if (monitor_desc == NULL) +// OBSOLETE error ("monitor target not open."); +// OBSOLETE +// OBSOLETE if (args) +// OBSOLETE fprintf ("This command takes no args. They have been ignored.\n"); +// OBSOLETE +// OBSOLETE printf ("[Entering connect mode. Use ~. or ~^D to escape]\n"); +// OBSOLETE +// OBSOLETE serial_raw (0, &ttystate); +// OBSOLETE +// OBSOLETE make_cleanup (cleanup_tty, 0); +// OBSOLETE +// OBSOLETE FD_ZERO (&readfds); +// OBSOLETE +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE do +// OBSOLETE { +// OBSOLETE FD_SET (0, &readfds); +// OBSOLETE FD_SET (deprecated_serial_fd (monitor_desc), &readfds); +// OBSOLETE numfds = select (sizeof (readfds) * 8, &readfds, 0, 0, 0); +// OBSOLETE } +// OBSOLETE while (numfds == 0); +// OBSOLETE +// OBSOLETE if (numfds < 0) +// OBSOLETE perror_with_name ("select"); +// OBSOLETE +// OBSOLETE if (FD_ISSET (0, &readfds)) +// OBSOLETE { /* tty input, send to monitor */ +// OBSOLETE c = getchar (); +// OBSOLETE if (c < 0) +// OBSOLETE perror_with_name ("connect"); +// OBSOLETE +// OBSOLETE printf_monitor ("%c", c); +// OBSOLETE switch (cur_esc) +// OBSOLETE { +// OBSOLETE case 0: +// OBSOLETE if (c == '\r') +// OBSOLETE cur_esc = c; +// OBSOLETE break; +// OBSOLETE case '\r': +// OBSOLETE if (c == '~') +// OBSOLETE cur_esc = c; +// OBSOLETE else +// OBSOLETE cur_esc = 0; +// OBSOLETE break; +// OBSOLETE case '~': +// OBSOLETE if (c == '.' || c == '\004') +// OBSOLETE return; +// OBSOLETE else +// OBSOLETE cur_esc = 0; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (FD_ISSET (deprecated_serial_fd (monitor_desc), &readfds)) +// OBSOLETE { +// OBSOLETE while (1) +// OBSOLETE { +// OBSOLETE c = readchar (0); +// OBSOLETE if (c < 0) +// OBSOLETE break; +// OBSOLETE putchar (c); +// OBSOLETE } +// OBSOLETE fflush (stdout); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Define the monitor command strings. Since these are passed directly +// OBSOLETE * through to a printf style function, we need can include formatting +// OBSOLETE * strings. We also need a CR or LF on the end. +// OBSOLETE */ +// OBSOLETE #warning FIXME: monitor interface pattern strings, stale struct decl +// OBSOLETE struct monitor_ops rombug_cmds = +// OBSOLETE { +// OBSOLETE "g \r", /* execute or usually GO command */ +// OBSOLETE "g \r", /* continue command */ +// OBSOLETE "t \r", /* single step */ +// OBSOLETE "b %x\r", /* set a breakpoint */ +// OBSOLETE "k %x\r", /* clear a breakpoint */ +// OBSOLETE "c %x\r", /* set memory to a value */ +// OBSOLETE "d %x %d\r", /* display memory */ +// OBSOLETE "$%08X", /* prompt memory commands use */ +// OBSOLETE ".%s %x\r", /* set a register */ +// OBSOLETE ":", /* delimiter between registers */ +// OBSOLETE ". \r", /* read a register */ +// OBSOLETE "mf \r", /* download command */ +// OBSOLETE "RomBug: ", /* monitor command prompt */ +// OBSOLETE ": ", /* end-of-command delimitor */ +// OBSOLETE ".\r" /* optional command terminator */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE struct target_ops rombug_ops; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE init_rombug_ops (void) +// OBSOLETE { +// OBSOLETE rombug_ops.to_shortname = "rombug"; +// OBSOLETE rombug_ops.to_longname = "Microware's ROMBUG debug monitor"; +// OBSOLETE rombug_ops.to_doc = "Use a remote computer running the ROMBUG debug monitor.\n\ +// OBSOLETE Specify the serial device it is connected to (e.g. /dev/ttya).", +// OBSOLETE rombug_ops.to_open = rombug_open; +// OBSOLETE rombug_ops.to_close = rombug_close; +// OBSOLETE rombug_ops.to_attach = 0; +// OBSOLETE rombug_ops.to_post_attach = NULL; +// OBSOLETE rombug_ops.to_require_attach = NULL; +// OBSOLETE rombug_ops.to_detach = rombug_detach; +// OBSOLETE rombug_ops.to_require_detach = NULL; +// OBSOLETE rombug_ops.to_resume = rombug_resume; +// OBSOLETE rombug_ops.to_wait = rombug_wait; +// OBSOLETE rombug_ops.to_post_wait = NULL; +// OBSOLETE rombug_ops.to_fetch_registers = rombug_fetch_register; +// OBSOLETE rombug_ops.to_store_registers = rombug_store_register; +// OBSOLETE rombug_ops.to_prepare_to_store = rombug_prepare_to_store; +// OBSOLETE rombug_ops.to_xfer_memory = rombug_xfer_inferior_memory; +// OBSOLETE rombug_ops.to_files_info = rombug_files_info; +// OBSOLETE rombug_ops.to_insert_breakpoint = rombug_insert_breakpoint; +// OBSOLETE rombug_ops.to_remove_breakpoint = rombug_remove_breakpoint; /* Breakpoints */ +// OBSOLETE rombug_ops.to_terminal_init = 0; +// OBSOLETE rombug_ops.to_terminal_inferior = 0; +// OBSOLETE rombug_ops.to_terminal_ours_for_output = 0; +// OBSOLETE rombug_ops.to_terminal_ours = 0; +// OBSOLETE rombug_ops.to_terminal_info = 0; /* Terminal handling */ +// OBSOLETE rombug_ops.to_kill = rombug_kill; +// OBSOLETE rombug_ops.to_load = rombug_load; /* load */ +// OBSOLETE rombug_ops.to_lookup_symbol = rombug_link; /* lookup_symbol */ +// OBSOLETE rombug_ops.to_create_inferior = rombug_create_inferior; +// OBSOLETE rombug_ops.to_post_startup_inferior = NULL; +// OBSOLETE rombug_ops.to_acknowledge_created_inferior = NULL; +// OBSOLETE rombug_ops.to_clone_and_follow_inferior = NULL; +// OBSOLETE rombug_ops.to_post_follow_inferior_by_clone = NULL; +// OBSOLETE rombug_ops.to_insert_fork_catchpoint = NULL; +// OBSOLETE rombug_ops.to_remove_fork_catchpoint = NULL; +// OBSOLETE rombug_ops.to_insert_vfork_catchpoint = NULL; +// OBSOLETE rombug_ops.to_remove_vfork_catchpoint = NULL; +// OBSOLETE rombug_ops.to_has_forked = NULL; +// OBSOLETE rombug_ops.to_has_vforked = NULL; +// OBSOLETE rombug_ops.to_can_follow_vfork_prior_to_exec = NULL; +// OBSOLETE rombug_ops.to_post_follow_vfork = NULL; +// OBSOLETE rombug_ops.to_insert_exec_catchpoint = NULL; +// OBSOLETE rombug_ops.to_remove_exec_catchpoint = NULL; +// OBSOLETE rombug_ops.to_has_execd = NULL; +// OBSOLETE rombug_ops.to_reported_exec_events_per_exec_call = NULL; +// OBSOLETE rombug_ops.to_has_exited = NULL; +// OBSOLETE rombug_ops.to_mourn_inferior = rombug_mourn_inferior; +// OBSOLETE rombug_ops.to_can_run = 0; /* can_run */ +// OBSOLETE rombug_ops.to_notice_signals = 0; /* notice_signals */ +// OBSOLETE rombug_ops.to_thread_alive = 0; +// OBSOLETE rombug_ops.to_stop = 0; /* to_stop */ +// OBSOLETE rombug_ops.to_pid_to_exec_file = NULL; +// OBSOLETE rombug_ops.to_stratum = process_stratum; +// OBSOLETE rombug_ops.DONT_USE = 0; /* next */ +// OBSOLETE rombug_ops.to_has_all_memory = 1; +// OBSOLETE rombug_ops.to_has_memory = 1; +// OBSOLETE rombug_ops.to_has_stack = 1; +// OBSOLETE rombug_ops.to_has_registers = 1; +// OBSOLETE rombug_ops.to_has_execution = 1; /* has execution */ +// OBSOLETE rombug_ops.to_sections = 0; +// OBSOLETE rombug_ops.to_sections_end = 0; /* Section pointers */ +// OBSOLETE rombug_ops.to_magic = OPS_MAGIC; /* Always the last thing */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_remote_os9k (void) +// OBSOLETE { +// OBSOLETE init_rombug_ops (); +// OBSOLETE add_target (&rombug_ops); +// OBSOLETE +// OBSOLETE add_show_from_set ( +// OBSOLETE add_set_cmd ("hash", no_class, var_boolean, (char *) &hashmark, +// OBSOLETE "Set display of activity while downloading a file.\nWhen enabled, a period \'.\' is displayed.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set ( +// OBSOLETE add_set_cmd ("timeout", no_class, var_zinteger, +// OBSOLETE (char *) &timeout, +// OBSOLETE "Set timeout in seconds for remote MIPS serial I/O.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set ( +// OBSOLETE add_set_cmd ("remotelog", no_class, var_zinteger, +// OBSOLETE (char *) &monitor_log, +// OBSOLETE "Set monitor activity log on(=1) or off(=0).", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set ( +// OBSOLETE add_set_cmd ("remotexon", no_class, var_zinteger, +// OBSOLETE (char *) &tty_xon, +// OBSOLETE "Set remote tty line XON control", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set ( +// OBSOLETE add_set_cmd ("remotexoff", no_class, var_zinteger, +// OBSOLETE (char *) &tty_xoff, +// OBSOLETE "Set remote tty line XOFF control", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_com ("rombug ", class_obscure, rombug_command, +// OBSOLETE "Send a command to the debug monitor."); +// OBSOLETE #if 0 +// OBSOLETE add_com ("connect", class_obscure, connect_command, +// OBSOLETE "Connect the terminal directly up to a serial based command monitor.\nUse ~. or ~^D to break out."); +// OBSOLETE #endif +// OBSOLETE }