From: John Gilmore Date: Tue, 15 Oct 1991 23:29:34 +0000 (+0000) Subject: Changes from Fred Fish: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=afe4ca159ba3a3dc7a7af235fb13c4c234e550c3;p=binutils-gdb.git 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d658b24f2c..ac90fb22b0c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +Tue Oct 15 08:45:12 1991 John Gilmore (gnu at cygnus.com) + + 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. + Mon Oct 14 13:37:50 1991 Roland H. Pesch (pesch at cygnus.com) * doc/gdb.texinfo: Catch up to changes recorded here in ChangeLog diff --git a/gdb/configure.in b/gdb/configure.in index 2bf2d0f2b53..688465b4655 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -16,6 +16,14 @@ m68k) *) gdb_host=altos ;; esac ;; + + cbm) + case ${host_os} in + amigados) gdb_host=amigados ;; + svr4) gdb_host=amix ;; + esac + ;; + hp) case ${host_os} in hpux) gdb_host=hp300hpux ;; @@ -127,6 +135,12 @@ m68k) case "${target_vendor}" in att) gdb_target=3b1 ;; altos) gdb_target=altos ;; + cbm) + case ${target_os} in + amigados) gdb_host=amigados ;; + svr4) gdb_target=amix ;; + esac + ;; hp) case "${target_os}" in bsd) gdb_target=hp300bsd ;; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 42ca221c90e..18553fe6678 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 +#include +#include +#include #include +#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 -#include -#include -#include -#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 (""); 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; } diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index 24e8884ef83..e2e55576ffe 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -60,7 +60,7 @@ void double_to_i387 (from, to) char *from, *to; { - ieee_double_to_extended (&ext_format_i387, (double *)from, to); + double_to_ieee_extended (&ext_format_i387, (double *)from, to); } void diff --git a/gdb/main.c b/gdb/main.c index 353e7b1b066..795e94a7479 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -599,7 +599,8 @@ GDB manual (available as on-line info or a printed manual).\n", stderr); /* After the symbol file has been read, print a newline to get us beyond the copyright line... But errors should still set off the error message with a (single) blank line. */ - printf_filtered ("\n"); + if (!quiet) + printf_filtered ("\n"); error_pre_print = "\n"; if (corearg != NULL) @@ -714,7 +715,7 @@ execute_command (p, from_tty) register struct cmd_list_element *c; register struct command_line *cmdlines; register enum language flang; - static enum language current = language_unknown; + static struct language_defn *saved_language = 0; static int warned = 0; free_all_values (); @@ -761,24 +762,28 @@ execute_command (p, from_tty) (*c->function) (arg, from_tty & caution); } - /* Tell the user if the language has changed */ - if (working_lang != current) + /* Tell the user if the language has changed (except first time). */ + if (current_language != saved_language) { if (language_mode == language_mode_auto) { - if (current != language_unknown) + if (saved_language) language_info (); } - current = working_lang; + saved_language = current_language; warned = 0; } /* Warn the user if the working language does not match the language of the current frame. Only warn the user if we are actually running the program, i.e. there is a stack. */ + /* FIXME: This should be cacheing the frame and only running when + the frame changes. */ if (target_has_stack) { - flang = get_frame_language(); - if(!warned && flang != language_unknown && flang != working_lang) + flang = get_frame_language (); + if (!warned + && flang != language_unknown + && flang != current_language->la_language) { printf_filtered ("%s\n", lang_frame_mismatch_warn); warned = 1; @@ -1491,7 +1496,11 @@ define_command (comname, from_tty) validate_comname (comname); + /* Look it up, and verify that we got an exact match. */ c = lookup_cmd (&tem, cmdlist, "", -1, 1); + if (c && 0 != strcmp (comname, c->name)) + c = 0; + if (c) { if (c->class == class_user || c->class == class_alias) @@ -1571,8 +1580,8 @@ print_gnu_advertisement() { printf ("\ GDB is free software and you are welcome to distribute copies of it\n\ - under certain conditions; type \"info copying\" to see the conditions.\n\ -There is absolutely no warranty for GDB; type \"info warranty\" for details.\n\ + under certain conditions; type \"show copying\" to see the conditions.\n\ +There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\ "); } @@ -1763,11 +1772,14 @@ echo_command (text, from_tty) c = parse_escape (&p); if (c >= 0) - fputc (c, stdout); + printf_filtered ("%c", c); } else - fputc (c, stdout); + printf_filtered ("%c", c); } + + /* Force this output to appear now. */ + wrap_here (""); fflush (stdout); } diff --git a/gdb/tm-68k.h b/gdb/tm-68k.h index ee471c00c0f..3839c4ebf14 100644 --- a/gdb/tm-68k.h +++ b/gdb/tm-68k.h @@ -255,6 +255,7 @@ extern struct ext_format ext_format_68881; #define FP0_REGNUM 18 /* Floating point register 0 */ #define FPC_REGNUM 26 /* 68881 control register */ #define FPS_REGNUM 27 /* 68881 status register */ +#define FPI_REGNUM 28 /* 68881 iaddr register */ #endif /* 68881. */ /* Store the address of the place in which to copy the structure the diff --git a/gdb/values.c b/gdb/values.c index 380a9cc086d..0f5e1e7c364 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -493,9 +493,9 @@ show_convenience () #endif varseen = 1; } - printf ("$%s = ", var->name); + printf_filtered ("$%s = ", var->name); value_print (var->value, stdout, 0, Val_pretty_default); - printf ("\n"); + printf_filtered ("\n"); } if (!varseen) printf ("No debugger convenience variables now defined.\n\