From: Andrew Cagney Date: Mon, 15 Dec 1997 12:38:05 +0000 (+0000) Subject: (Mostly from Gavin Koch) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e7ab2a476e8f64722e49c8e1f221f4adad85701d;p=binutils-gdb.git (Mostly from Gavin Koch) In dwarf2read.c, if the ABI is 32 bit and 64 bit addresses are encountered discard the most significant 32 bits. Use CORE_ADDR for address variables instead of long. Add more explicit tx49 configur target. Check/use sigaction/SA_RESTART in remote-sim.c --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 130d8957abf..cc26113957f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,34 @@ +Mon Dec 15 15:13:57 1997 Andrew Cagney + + * configure.in (configdirs): Check for sigaction. + * configure: Re-generate. + +start-sanitize-tx49 + From Gavin Koch : + * config/mips/tx49el.mt : New file. + * config/mips/tm-tx49.h : New file. + * config/mips/tm-tx49el.h : New file. + * configure.tgt: Changed to use the new files for + mips64*tx49*-*-elf* and mips64*tx49*el-*-elf* + +end-sanitize-tx49 +Mon Dec 15 11:38:52 1997 Andrew Cagney + + * dwarf2read.c: From change proposed by Gavin Koch. + (address_significant_size): New static variable. + (dwarf2_build_psymtabs_hard): Check consistency between + `address_size' and `address_significant_size'. + (read_address): MASK out all but the significant bits, as + determined by `address_significant_size', of any addresses. + (elf-bfd.h): Include. + (dwarf2_build_psymtabs_hard): Set `address_significant_size' + according to the arch_size of the elf object file. + +Thu Dec 11 13:40:46 1997 Andrew Cagney + + * dwarf2read.c (dwarf_decode_lines): Change type of address to + CORE_ADDR. + Thu Dec 11 22:39:02 1997 Mark Alexander From change made to branch by Bob Manson : diff --git a/gdb/config.in b/gdb/config.in index 8a1d0db6e7e..097f29e3c1b 100644 --- a/gdb/config.in +++ b/gdb/config.in @@ -59,6 +59,9 @@ /* Define if the "%Lg" format works to print long doubles. */ #undef PRINTF_HAS_LONG_DOUBLE +/* Define if the "%Lg" format works to scan long doubles. */ +#undef SCANF_HAS_LONG_DOUBLE + /* Define if using Solaris thread debugging. */ #undef HAVE_THREAD_DB_LIB @@ -84,6 +87,9 @@ /* Define if you have the setpgid function. */ #undef HAVE_SETPGID +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + /* Define if you have the header file. */ #undef HAVE_ENDIAN_H diff --git a/gdb/config/mips/.Sanitize b/gdb/config/mips/.Sanitize index 0e3dc69173d..f8c0c91b4f5 100644 --- a/gdb/config/mips/.Sanitize +++ b/gdb/config/mips/.Sanitize @@ -29,6 +29,20 @@ else fi fi +tx49_files="tm-tx49.h tm-tx49l.h tx49.mt tx49l.mt" + +if ( echo $* | grep keep\-tx49 > /dev/null ) ; then + keep_these_too="${tx49_files} ${keep_these_too}" + if [ -n "${verbose}" ] ; then + echo Keeping ${tx49_files} + fi +else + lose_these_too="${tx49_files} ${lose_these_too}" + if [ -n "${verbose}" ] ; then + echo Deleting ${tx49_files} + fi +fi + if ( echo $* | grep keep\-r5900 > /dev/null ) ; then keep_these_too="tm-r5900.h r5900.mt ${keep_these_too}" else diff --git a/gdb/configure b/gdb/configure index 08e8bbb7bcd..8de826fe28c 100755 --- a/gdb/configure +++ b/gdb/configure @@ -1555,7 +1555,7 @@ EOF fi -for ac_func in setpgid sbrk select poll +for ac_func in setpgid sbrk select poll sigaction do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1562: checking for $ac_func" >&5 diff --git a/gdb/configure.in b/gdb/configure.in index 8512fc93263..f3438499df3 100644 --- a/gdb/configure.in +++ b/gdb/configure.in @@ -67,7 +67,7 @@ AC_HEADER_STAT AC_C_CONST -AC_CHECK_FUNCS(setpgid sbrk select poll) +AC_CHECK_FUNCS(setpgid sbrk select poll sigaction) # If we are configured native on Linux, work around problems with sys/procfs.h if test "${target}" = "${host}"; then diff --git a/gdb/configure.tgt b/gdb/configure.tgt index 1c1d51f7331..baa60632d00 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -171,10 +171,6 @@ mips64*vr5400*el-*-elf*) gdb_target=vr5000el ;; mips64*vr5400*-*-elf*) gdb_target=vr5000 configdirs="${configdirs} gdbserver" ;; # end-sanitize-vr5400 -# start-sanitize-tx49 -mips64*tx49*el-*-elf*) gdb_target=vr4300el ;; -mips64*tx49*-*-elf*) gdb_target=vr4300 ;; -# end-sanitize-tx49 # start-sanitize-r5900 mips64*r5900*-*-elf*) gdb_target=r5900 ;; # end-sanitize-r5900 @@ -186,6 +182,10 @@ mips-tx19*-* | mips*tx19*-*-*) # end-sanitize-tx19 mips*tx39*el*-elf*) gdb_target=tx39el ;; mips*tx39*-elf*) gdb_target=tx39 ;; +# start-sanitize-tx49 +mips64*tx49*el-*-elf*) gdb_target=tx49el ;; +mips64*tx49*-*-elf*) gdb_target=tx49 ;; +# end-sanitize-tx49 mips64*el-*-elf*) gdb_target=embedl64 ;; mips64*-*-elf*) gdb_target=embed64 ;; mips*el-*-ecoff*) gdb_target=embedl ;; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index feded4e9eef..418aaad6396 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #include "bfd.h" +#include "elf-bfd.h" #include "symtab.h" #include "gdbtypes.h" #include "symfile.h" @@ -522,6 +523,15 @@ static struct complaint dwarf2_unsupported_const_value_attr = whatever scope is currently getting read. */ static int address_size; +/* Some elf32 object file formats while linked for a 32 bit address + space contain debug information that has assumed 64 bit + addresses. Eg 64 bit MIPS target produced by GCC/GAS/LD where the + symbol table contains 32bit address values while its .debug_info + section contains 64 bit address values. + ADDRESS_SIGNIFICANT_SIZE specifies the number significant bits in + the ADDRESS_SIZE bytes read from the file */ +static int address_significant_size; + /* Externals references. */ extern int info_verbose; /* From main.c; nonzero => verbose */ @@ -907,6 +917,9 @@ dwarf2_build_psymtabs_hard (objfile, section_offsets, mainline) int comp_unit_has_pc_info; CORE_ADDR lowpc, highpc; + /* Number of bytes of any addresses that are signficant */ + address_significant_size = get_elf_backend_data (abfd)->s->arch_size / 8; + info_ptr = dwarf_info_buffer; abbrev_ptr = dwarf_abbrev_buffer; @@ -934,7 +947,7 @@ dwarf2_build_psymtabs_hard (objfile, section_offsets, mainline) } if (cu_header.abbrev_offset >= dwarf_abbrev_size) { - error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (at 0x%lx + 6).", + error ("Dwarf Error: bad offset (0x%lx) in compilation unit header (offset 0x%lx + 6).", (long) cu_header.abbrev_offset, (long) (beg_of_comp_unit - dwarf_info_buffer)); return; @@ -942,11 +955,17 @@ dwarf2_build_psymtabs_hard (objfile, section_offsets, mainline) if (beg_of_comp_unit + cu_header.length + 4 > dwarf_info_buffer + dwarf_info_size) { - error ("Dwarf Error: bad length (0x%lx) in compilation unit header (0x%lx + 0).", + error ("Dwarf Error: bad length (0x%lx) in compilation unit header (offset 0x%lx + 0).", (long) cu_header.length, (long) (beg_of_comp_unit - dwarf_info_buffer)); return; } + if (address_size < address_significant_size) + { + error ("Dwarf Error: bad address size (%ld) in compilation unit header (offset 0x%lx + 11).", + (long) cu_header.addr_size, + (long) (beg_of_comp_unit - dwarf_info_buffer)); + } /* Read the abbrevs for this compilation unit into a table */ dwarf2_read_abbrevs (abfd, cu_header.abbrev_offset); @@ -3509,11 +3528,27 @@ read_address (abfd, buf) { CORE_ADDR retval = 0; - if (address_size == 4) + switch (address_size) { + case 4: retval = bfd_get_32 (abfd, (bfd_byte *) buf); - } else { /* *THE* alternative is 8, right? */ + break; + case 8: retval = bfd_get_64 (abfd, (bfd_byte *) buf); + break; + default: + /* *THE* alternative is 8, right? */ + abort (); + } + /* If the address being read is larger than the address that is + applicable for the object file format then mask it down to the + correct size. Take care to avoid unnecessary shift or shift + overflow */ + if (address_size > address_significant_size + && address_significant_size < sizeof (CORE_ADDR)) + { + CORE_ADDR mask = ((CORE_ADDR) 0) - 1; + retval &= ~(mask << (address_significant_size * 8)); } return retval; } @@ -3844,7 +3879,7 @@ dwarf_decode_lines (offset, comp_dir, abfd) while (line_ptr < line_end) { /* state machine registers */ - unsigned int address = 0; + CORE_ADDR address = 0; unsigned int file = 1; unsigned int line = 1; unsigned int column = 0; diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index 22952ca3cef..713e539801e 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -690,6 +690,18 @@ gdbsim_wait (pid, status) if (sr_get_debug ()) printf_filtered ("gdbsim_wait\n"); +#if defined (HAVE_SIGACTION) && defined (SA_RESTART) + { + struct sigaction sa, osa; + sa.sa_handler = gdbsim_cntrl_c; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sigaction (SIGINT, &sa, &osa); + prev_sigint = osa.sa_handler; + } +#else + prev_sigint = signal (SIGINT, cntrl_c); +#endif prev_sigint = signal (SIGINT, gdbsim_cntrl_c); sim_resume (gdbsim_desc, resume_step, target_signal_to_host (resume_siggnal));