diff options
author | John Gilmore <gnu@cygnus> | 1991-10-15 23:29:34 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-10-15 23:29:34 +0000 |
commit | afe4ca159ba3a3dc7a7af235fb13c4c234e550c3 (patch) | |
tree | abfc4776de8f4fdaaec55f52198b1b769785bc37 /gdb/dbxread.c | |
parent | 8c8af913b22767a2ebe71ba89c50647a0ce2e4ee (diff) | |
download | gdb-afe4ca159ba3a3dc7a7af235fb13c4c234e550c3.zip gdb-afe4ca159ba3a3dc7a7af235fb13c4c234e550c3.tar.gz gdb-afe4ca159ba3a3dc7a7af235fb13c4c234e550c3.tar.bz2 |
Changes from Fred Fish:
* tm-68k.h (FPI_REGNUM): Add.
* infrun.c (child_create_inferior): flush stdout and stderr
before forking.
* configure.in: Handle amigados, amix hosts and targets.
* inflow.c: Handle TIOCGLTC_BROKEN for Amiga.
From Andreas Schwab:
* values.c (show_convenience): Use printf_filtered.
* main.c (define_command): Check result of lookup_command for
exact match.
(echo_command): Use printf_filtered, and force output out.
* dbxread.c (read_enum_type): Avoid Modula-2 kludge that breaks C
programs.
* i387-tdep.c (double_to_i387): Fix typo for double_to_ieee_extended.
* utils.c (_initialize_utils): If !ISATTY, don't paginate.
Diffstat (limited to 'gdb/dbxread.c')
-rw-r--r-- | gdb/dbxread.c | 105 |
1 files changed, 56 insertions, 49 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 42ca221..18553fe 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -43,9 +43,21 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define L_INCR 1 #endif -#include "a.out.gnu.h" -#include "stab.gnu.h" /* We always use GNU stabs, not native, now */ +#include <obstack.h> +#include <sys/param.h> +#include <sys/file.h> +#include <sys/stat.h> #include <ctype.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 "aout64.h" +#include "stab.gnu.h" /* We always use GNU stabs, not native, now */ #ifndef NO_GNU_STABS /* @@ -105,18 +117,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif /* NO_GNU_STABS */ -#include <obstack.h> -#include <sys/param.h> -#include <sys/file.h> -#include <sys/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" - struct dbx_symfile_info { asection *text_sect; /* Text section accessor */ int symcount; /* How many symbols are there in the file */ @@ -363,7 +363,13 @@ static int undef_types_allocated, undef_types_length; static char *symfile_string_table; static int symfile_string_table_size; - /* Setup a define to deal cleanly with the underscore problem */ +/* The size of each symbol in the symbol file (in external form). + This is set by dbx_symfile_read when building psymtabs, and by + dbx_psymtab_to_symtab when building symtabs. */ + +static unsigned symbol_size; + +/* Setup a define to deal cleanly with the underscore problem */ #ifdef NAMES_HAVE_UNDERSCORE #define HASH_OFFSET 1 @@ -1294,6 +1300,9 @@ dbx_symfile_read (sf, addr, mainline) symfile_bfd = sym_bfd; /* Kludge for SWAP_SYMBOL */ + /* FIXME POKING INSIDE BFD DATA STRUCTURES */ + symbol_size = obj_symbol_entry_size (sym_bfd); + pending_blocks = 0; make_cleanup (really_free_pendings, 0); @@ -1433,7 +1442,7 @@ dbx_symfile_init (sf) } /* Buffer for reading the symbol table entries. */ -static struct nlist symbuf[4096]; +static struct internal_nlist symbuf[4096]; static int symbuf_idx; static int symbuf_end; @@ -1461,15 +1470,15 @@ fill_symbuf () perror_with_name ("<symbol file>"); else if (nbytes == 0) error ("Premature end of file reading symbol table"); - symbuf_end = nbytes / sizeof (struct nlist); + symbuf_end = nbytes / symbol_size; symbuf_idx = 0; return 1; } #define SWAP_SYMBOL(symp) \ { \ - (symp)->n_un.n_strx = bfd_h_get_32(symfile_bfd, \ - (unsigned char *)&(symp)->n_un.n_strx); \ + (symp)->n_strx = bfd_h_get_32(symfile_bfd, \ + (unsigned char *)&(symp)->n_strx); \ (symp)->n_desc = bfd_h_get_16 (symfile_bfd, \ (unsigned char *)&(symp)->n_desc); \ (symp)->n_value = bfd_h_get_32 (symfile_bfd, \ @@ -1492,7 +1501,7 @@ next_symbol_text () fill_symbuf (); symnum++; SWAP_SYMBOL(&symbuf[symbuf_idx]); - return symbuf[symbuf_idx++].n_un.n_strx + stringtab_global; + return symbuf[symbuf_idx++].n_strx + stringtab_global; } /* Initializes storage for all of the partial symbols that will be @@ -1653,7 +1662,7 @@ read_dbx_symtab (symfile_name, addr, CORE_ADDR text_addr; int text_size; { - register struct nlist *bufp; + register struct internal_nlist *bufp; register char *namestring; register struct partial_symbol *psym; int nsl; @@ -1743,11 +1752,11 @@ read_dbx_symtab (symfile_name, addr, give a fake name, and print a single error message per symbol file read, rather than abort the symbol reading or flood the user with messages. */ #define SET_NAMESTRING()\ - if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) { \ + if (bufp->n_strx < 0 || bufp->n_strx >= stringtab_size) { \ complain (&string_table_offset_complaint, symnum); \ namestring = "foo"; \ } else \ - namestring = bufp->n_un.n_strx + stringtab + namestring = bufp->n_strx + stringtab /* Add a symbol with an integer value to a psymtab. */ /* This is a macro unless we're debugging. See above this function. */ @@ -1844,7 +1853,7 @@ read_dbx_symtab (symfile_name, addr, && bufp->n_value > pst->textlow) { end_psymtab (pst, psymtab_include_list, includes_used, - symnum * sizeof (struct nlist), bufp->n_value, + symnum * symbol_size, bufp->n_value, dependency_list, dependencies_used, global_psymbols.next, static_psymbols.next); pst = (struct partial_symtab *) 0; @@ -1949,7 +1958,7 @@ read_dbx_symtab (symfile_name, addr, if (pst && past_first_source_file) { end_psymtab (pst, psymtab_include_list, includes_used, - first_symnum * sizeof (struct nlist), valu, + first_symnum * symbol_size, valu, dependency_list, dependencies_used, global_psymbols.next, static_psymbols.next); pst = (struct partial_symtab *) 0; @@ -1961,7 +1970,7 @@ read_dbx_symtab (symfile_name, addr, pst = start_psymtab (symfile_name, addr, namestring, valu, - first_symnum * sizeof (struct nlist), + first_symnum * symbol_size, global_psymbols.next, static_psymbols.next); continue; } @@ -2334,7 +2343,7 @@ read_dbx_symtab (symfile_name, addr, if (pst) { end_psymtab (pst, psymtab_include_list, includes_used, - symnum * sizeof (struct nlist), end_of_text_addr, + symnum * symbol_size, end_of_text_addr, dependency_list, dependencies_used, global_psymbols.next, static_psymbols.next); includes_used = 0; @@ -2535,7 +2544,7 @@ psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset) return; } - /* Read in all partial symbtabs on which this one is dependent */ + /* 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) { @@ -2681,6 +2690,8 @@ dbx_psymtab_to_symtab (pst) } symfile_bfd = sym_bfd; /* Kludge for SWAP_SYMBOL */ + /* FIXME POKING INSIDE BFD DATA STRUCTURES */ + symbol_size = obj_symbol_entry_size (sym_bfd); /* FIXME, this uses internal BFD variables. See above in dbx_symbol_file_open where the macro is defined! */ @@ -2807,8 +2818,9 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset, int offset; { register char *namestring; - struct nlist *bufp; + struct internal_nlist *bufp; unsigned char type; + unsigned max_symnum; subfile_stack = 0; stringtab_global = stringtab; @@ -2823,21 +2835,19 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset, Detecting this in read_dbx_symtab would slow down initial readin, so we look for it here instead. */ - if (sym_offset >= (int)sizeof (struct nlist)) + if (sym_offset >= (int)symbol_size) { - lseek (desc, sym_offset - sizeof (struct nlist), L_INCR); + lseek (desc, sym_offset - symbol_size, L_INCR); fill_symbuf (); bufp = &symbuf[symbuf_idx++]; SWAP_SYMBOL (bufp); - if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) - error ("Invalid symbol data: bad string table offset: %d", - bufp->n_un.n_strx); - namestring = bufp->n_un.n_strx + stringtab; + SET_NAMESTRING (); processing_gcc_compilation = (bufp->n_type == N_TEXT && !strcmp (namestring, GCC_COMPILED_FLAG_SYMBOL)); + /* FIXME!!! Check for gcc2_compiled... */ } else { @@ -2854,8 +2864,10 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset, if (bufp->n_type != (unsigned char)N_SO) error("First symbol in segment of executable not a source symbol"); + max_symnum = sym_size / symbol_size; + for (symnum = 0; - symnum < sym_size / sizeof(struct nlist); + symnum < max_symnum; symnum++) { QUIT; /* Allow this to be interruptable */ @@ -2875,10 +2887,7 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset, bufp->n_value += offset; type = bufp->n_type; - if (bufp->n_un.n_strx < 0 || bufp->n_un.n_strx >= stringtab_size) - error ("Invalid symbol data: bad string table offset: %d", - bufp->n_un.n_strx); - namestring = bufp->n_un.n_strx + stringtab; + SET_NAMESTRING (); if (type & N_STAB) { @@ -2893,22 +2902,17 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset, bufp = &symbuf[symbuf_idx]; if (bufp->n_type == (unsigned char)N_SO) { - char *namestring2; + char *namestring1 = namestring; SWAP_SYMBOL (bufp); bufp->n_value += offset; /* Relocate */ symbuf_idx++; symnum++; + SET_NAMESTRING (); - if (bufp->n_un.n_strx < 0 - || bufp->n_un.n_strx >= stringtab_size) - error ("Invalid symbol data: bad string table offset: %d", - bufp->n_un.n_strx); - namestring2 = bufp->n_un.n_strx + stringtab; - - process_symbol_pair (N_SO, bufp_n_desc, valu, namestring, + process_symbol_pair (N_SO, bufp_n_desc, valu, namestring1, N_SO, bufp->n_desc, bufp->n_value, - namestring2); + namestring); } else process_one_symbol(type, bufp_n_desc, valu, namestring); @@ -4953,6 +4957,8 @@ read_enum_type (pp, type) break; } +#if 0 + /* This screws up perfectly good C programs with enums. FIXME. */ /* Is this Modula-2's BOOLEAN type? Flag it as such if so. */ if(TYPE_NFIELDS(type) == 2 && ((!strcmp(TYPE_FIELD_NAME(type,0),"TRUE") && @@ -4960,6 +4966,7 @@ read_enum_type (pp, type) (!strcmp(TYPE_FIELD_NAME(type,1),"TRUE") && !strcmp(TYPE_FIELD_NAME(type,0),"FALSE")))) TYPE_CODE(type) = TYPE_CODE_BOOL; +#endif return type; } |