From: John Gilmore Date: Tue, 9 Jul 1991 02:08:13 +0000 (+0000) Subject: * core.c (memory_error): Reword error msg to mislead less. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b8c50f0918ce5a6612d84aa08a6fc2a8fb4f274a;p=binutils-gdb.git * core.c (memory_error): Reword error msg to mislead less. * mips-pinsn.c (print_insn_arg 'd'): Print $ with reg name. * mipsread.c (read_mips_symtab, read_the_mips_symtab, parse_partial_symbols): Use newer BFD internals (external_filehdr and external_aouthdr), byte-swap the fields that we care about before using them, and make the file header data local to read_the_mips_symtab rather than global. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f8b98c17fe..1024177f8cb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,6 +1,18 @@ +Mon Jul 8 19:02:46 1991 John Gilmore (gnu at cygint.cygnus.com) + + * core.c (memory_error): Reword error msg to mislead less. + + * mips-pinsn.c (print_insn_arg 'd'): Print $ with reg name. + + * mipsread.c (read_mips_symtab, read_the_mips_symtab, + parse_partial_symbols): Use newer BFD internals (external_filehdr + and external_aouthdr), byte-swap the fields that we care about + before using them, and make the file header data local to + read_the_mips_symtab rather than global. + Sat Jul 6 01:34:15 1991 John Gilmore (gnu at cygint.cygnus.com) - * ns32k-opcode.h (movmw, movmd): FIx opcodes. Bug fix + * ns32k-opcode.h (movmw, movmd): Fix opcodes. Bug fix from Rune Nerg}rd on 5 Jul 1991. * main.c (command_line_input): Flush stdout and stderr diff --git a/gdb/core.c b/gdb/core.c index a452e23e987..3a6a071d2bd 100644 --- a/gdb/core.c +++ b/gdb/core.c @@ -275,7 +275,7 @@ memory_error (status, memaddr) { /* Actually, address between memaddr and memaddr + len was out of bounds. */ - error ("Cannot access memory: address 0x%x out of bounds.", memaddr); + error ("Cannot access memory at address 0x%x.", memaddr); } else { diff --git a/gdb/mips-pinsn.c b/gdb/mips-pinsn.c index 82781e3586f..6dc3e553755 100644 --- a/gdb/mips-pinsn.c +++ b/gdb/mips-pinsn.c @@ -78,7 +78,7 @@ print_insn_arg (d, l, stream, pc) break; case 'd': - fprintf (stream, "%s", reg_names[((struct op_r_fmt *) l)->rd]); + fprintf (stream, "$%s", reg_names[((struct op_r_fmt *) l)->rd]); break; case 'h': diff --git a/gdb/mipsread.c b/gdb/mipsread.c index a6fd20f291a..afbd3f8c6b5 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -4,19 +4,19 @@ This file is part of GDB. -GDB is free software; you can redistribute it and/or modify +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 1, or (at your option) -any later version. +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -GDB is distributed in the hope that it will be useful, +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 GDB; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "param.h" @@ -38,11 +38,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ (re)define here what I really need in this module. I only assume the three standard COFF structure definitions: filehdr, aouthdr, scnhdr */ #define MIPS /* Kludge to get MIPS version of coff */ -#include "intel-coff.h" +#undef _ETEXT /* Avoid duplicated define from */ +#include "ecoff.h" struct coff_exec { - struct filehdr f; - struct aouthdr a; + struct external_filehdr f; + struct external_aouthdr a; }; #undef a_magic #undef a_text @@ -100,11 +101,6 @@ struct complaint unknown_ext_complaint = static struct symtab *cur_stab; -/* Header for executable/object file we read symbols from */ - -static struct coff_exec filhdr; -#define END_OF_TEXT_SEGMENT(f) ((f).a.text_start + (f).a.tsize) - /* Pointer to current file decriptor record, and its index */ static FDR *cur_fdr; @@ -287,6 +283,7 @@ mipscoff_symfile_read(sf, addr, mainline) } make_cleanup (free_stringtab, 0); #endif + /* Position to read the symbol table. Do not read it all at once. */ val = lseek (desc, (long)symtab_offset, 0); if (val < 0) @@ -298,7 +295,7 @@ mipscoff_symfile_read(sf, addr, mainline) /* Now that the executable file is positioned at symbol table, process it and define symbols accordingly. */ - read_mips_symtab(desc, 0); + read_mips_symtab(abfd, desc, 0); /* patch_opaque_types ();*/ @@ -366,8 +363,10 @@ mipscoff_psymtab_to_symtab(pst) /* Exported procedure: Is PC in the signal trampoline code */ -int in_sigtramp(pc,name) +int +in_sigtramp(pc, name) CORE_ADDR pc; + char *name; { if (sigtramp_address == 0) fixup_sigtramp(); @@ -376,22 +375,40 @@ int in_sigtramp(pc,name) /* File-level interface functions */ -/* Read the symtab information from file FSYM into memory */ +/* Read the symtab information from file FSYM into memory. Also, + return address just past end of our text segment in *END_OF_TEXT_SEGP. */ static -read_the_mips_symtab(fsym) +read_the_mips_symtab(abfd, fsym, end_of_text_segp) + bfd *abfd; + int fsym; + CORE_ADDR *end_of_text_segp; { int stsize, st_hdrsize; unsigned st_filptr; HDRR st_hdr; + /* Header for executable/object file we read symbols from */ + struct coff_exec filhdr; + + /* We get here with DESC pointing to the symtab header. But we need + * other info from the initial headers */ + lseek(fsym, 0L, 0); + myread(fsym, &filhdr, sizeof filhdr); + + if (end_of_text_segp) + *end_of_text_segp = + bfd_h_get_32 (abfd, filhdr.a.text_start) + + bfd_h_get_32 (abfd, filhdr.a.tsize); /* Find and read the symbol table header */ - st_hdrsize = filhdr.f.f_nsyms; - st_filptr = filhdr.f.f_symptr; + st_hdrsize = bfd_h_get_32 (abfd, filhdr.f.f_nsyms); + st_filptr = bfd_h_get_32 (abfd, filhdr.f.f_symptr); if (st_filptr == 0) return 0; lseek(fsym, st_filptr, L_SET); + if (st_hdrsize > sizeof (st_hdr)) /* Profanity check */ + abort(); if (read(fsym, &st_hdr, st_hdrsize) != st_hdrsize) goto readerr; @@ -573,21 +590,20 @@ char *fdr_name(name) /* Read in and parse the symtab of the file DESC. INCREMENTAL says - whether we are adding to the general symtab or not */ + whether we are adding to the general symtab or not. + FIXME: INCREMENTAL is currently always zero, though it should not be. */ static -read_mips_symtab( desc, incremental) +read_mips_symtab (abfd, desc, incremental) + bfd *abfd; + int desc; + int incremental; { - /* - * We get here with DESC pointing to the symtab header. But we need - * other info from the initial headers - */ - lseek(desc, 0L, 0); - myread(desc, &filhdr, sizeof filhdr); + CORE_ADDR end_of_text_seg; - read_the_mips_symtab(desc); + read_the_mips_symtab(abfd, desc, &end_of_text_seg); - parse_partial_symbols(cur_hdr, incremental); + parse_partial_symbols(cur_hdr, incremental, end_of_text_seg); cur_hdr = 0; /* @@ -1528,9 +1544,11 @@ parse_one_file(fh, f_idx, bound) /* Master parsing procedure. Parses the symtab described by the symbolic header HDR. If INCREMENTAL is true we are called - by add-file and must preserve the old symtabs */ + by add-file and must preserve the old symtabs. END_OF_TEXT_SEG + gives the address just after the text segment for the symtab + we are reading. */ static -parse_partial_symbols(hdr, incremental) +parse_partial_symbols(hdr, incremental, end_of_text_seg) HDRR *hdr; { int f_idx, s_idx, h_max; @@ -1659,8 +1677,8 @@ parse_partial_symbols(hdr, incremental) } /* Mark the last code address, and remember it for later */ - *prevhigh = END_OF_TEXT_SEGMENT(filhdr); - hdr->cbDnOffset = END_OF_TEXT_SEGMENT(filhdr); + *prevhigh = end_of_text_seg; + hdr->cbDnOffset = end_of_text_seg; reorder_psymtabs(); free(&fdr_to_pst[-1]);