aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-04-11Check corrupt VTENTRY entry in bfd_elf_gc_record_vtentryH.J. Lu33-98/+80
Instead of BFD_ASSERT (h != NULL) with ld: BFD ... assertion fail .../bfd/elf64-x86-64.c:2562 ld: bad.o: invalid string offset 50331648 >= 371 for section `nterp' check corrupt VTENTRY entry in bfd_elf_gc_record_vtentry with ld: bad.o: section 'g': corrupt VTENTRY entry * elf-m10300.c (mn10300_elf_check_relocs): Remove BFD_ASSERT of "h != NULL". Don't check "h != NULL" before calling. bfd_elf_gc_record_vtentry. * elf32-arm.c (elf32_arm_check_relocs): Likewise. * elf32-bfin.c (bfin_check_relocs): Likewise. * elf32-cris.c (cris_elf_check_relocs): Likewise. * elf32-csky.c (csky_elf_check_relocs): Likewise. * elf32-d10v.c (elf32_d10v_check_relocs): Likewise. * elf32-dlx.c (elf32_dlx_check_relocs): Likewise. * elf32-fr30.c (fr30_elf_check_relocs): Likewise. * elf32-frv.c (elf32_frv_check_relocs): Likewise. * elf32-hppa.c (elf32_hppa_check_relocs): Likewise. * elf32-i386.c (elf_i386_check_relocs): Likewise. * elf32-iq2000.c (iq2000_elf_check_relocs): Likewise. * elf32-m32r.c (m32r_elf_check_relocs): Likewise. * elf32-m68hc1x.c (elf32_m68hc11_check_relocs): Likewise. * elf32-m68k.c (elf_m68k_check_relocs): Likewise. * elf32-mcore.c (mcore_elf_check_relocs): Likewise. * elf32-metag.c (elf_metag_check_relocs): Likewise. * elf32-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_check_relocs): Likewise. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-sh.c (sh_elf_check_relocs): Likewise. * elf32-v850.c (v850_elf_check_relocs): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. * elf32-xstormy16.c (xstormy16_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-mmix.c (mmix_elf_check_relocs): Likewise. * elf64-ppc.c (ppc64_elf_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_s390_check_relocs): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elflink.c (bfd_elf_gc_record_vtinherit): Check for corrupt VTENTRY entry.
2019-04-11PR24435, buffer overflow reading dynamic entriesAlan Modra2-1/+7
PR 24435 * elflink.c (elf_link_add_object_symbols): Don't read partial dynamic entries from fuzzed objects.
2019-04-11AArch64: When DF_BIND_NOW don't use TLSDESC GOT value.Tamar Christina5-5/+41
When using DF_BIND_NOW on AArch64 we don't reserve the GOT slot for a TLSDESC, but we still emitted DT_TLSDESC_GOT and DT_TLSDESC_PLT. This caused random memory corruption as the "special" value of (bfd_vma)-1 would be set for dt_tlsdesc_got. Since we don't have a value of dt_tlsdesc_got I also don't emit DT_TLSDESC_PLT now becuase it would point to an incomplete PLT. To be able to write the PLT entry DT_TLSDESC_GOT is needed and since we don't have one we can't write the PLT entry either. It is my understanding that GLIBC doesn't need these two entries when not lazy loading. Conversely AArch32 does not reserve neither the GOT not the PLT slot when doing DF_BIND_NOW. AArch32 does not need these checks because these values are initialized to 0 and so the if (...) checks don't pass, but on AArch64 these are initialized to (bfd_vma)-1 and thus we need some extra checks. bfd/ChangeLog: PR ld/24302 * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Don't emit DT_TLSDESC_GOT and DT_TLSDESC_PLT when DF_BIND_NOW. (elfNN_aarch64_finish_dynamic_sections): Don't write PLT if DF_BIND_NOW. ld/ChangeLog: PR ld/24302 * testsuite/ld-aarch64/aarch64-elf.exp: Add new test. * testsuite/ld-aarch64/tls-relax-gdesc-le-now.d: New test.
2019-04-11[BINUTILS, AArch64, 2/2] Update Store Allocation Tag instructionsSudakshina Das14-198/+236
This patch updates the Store allocation tags instructions in Armv8.5-A Memory Tagging Extension. This is part of the changes that have been introduced recently in the 00bet10 release All of these instructions have an updated register operand (Xt -> <Xt|SP>) - STG <Xt|SP>, [<Xn|SP>, #<simm>] - STG <Xt|SP>, [<Xn|SP>, #<simm>]! - STG <Xt|SP>, [<Xn|SP>], #<simm> - STZG <Xt|SP>, [<Xn|SP>, #<simm>] - STZG <Xt|SP>, [<Xn|SP>, #<simm>]! - STZG <Xt|SP>, [<Xn|SP>], #<simm> - ST2G <Xt|SP>, [<Xn|SP>, #<simm>] - ST2G <Xt|SP>, [<Xn|SP>, #<simm>]! - ST2G <Xt|SP>, [<Xn|SP>], #<simm> - STZ2G <Xt|SP>, [<Xn|SP>, #<simm>] - STZ2G <Xt|SP>, [<Xn|SP>, #<simm>]! - STZ2G <Xt|SP>, [<Xn|SP>], #<simm> In order to accept <Rt|SP> a new operand type Rt_SP is introduced which has the same field as FLD_Rt but follows other semantics of Rn_SP. *** gas/ChangeLog *** 2019-04-11 Sudakshina Das <sudi.das@arm.com> * config/tc-aarch64.c (process_omitted_operand): Add case for AARCH64_OPND_Rt_SP. (parse_operands): Likewise. * testsuite/gas/aarch64/armv8_5-a-memtag.d: Update tests. * testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise. * testsuite/gas/aarch64/illegal-memtag.l: Likewise. * testsuite/gas/aarch64/illegal-memtag.s: Likewise. *** include/ChangeLog *** 2019-04-11 Sudakshina Das <sudi.das@arm.com> * opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_Rt_SP. *** opcodes/ChangeLog *** 2019-04-11 Sudakshina Das <sudi.das@arm.com> * aarch64-opc.c (aarch64_print_operand): Add case for AARCH64_OPND_Rt_SP. (verify_constraints): Likewise. * aarch64-tbl.h (QL_LDST_AT): Update to add SP qualifier. (struct aarch64_opcode): Update stg, stzg, st2g, stz2g instructions to accept Rt|SP as first operand. (AARCH64_OPERANDS): Add new Rt_SP. * aarch64-asm-2.c: Regenerated. * aarch64-dis-2.c: Regenerated. * aarch64-opc-2.c: Regenerated.
2019-04-11[BINUTILS, AArch64, 1/2] Add new LDGM/STGM instructionSudakshina Das10-1541/+1611
This patch adds the new LDGM/STGM instructions of the Armv8.5-A Memory Tagging Extension. This is part of the changes that have been introduced recently in the 00bet10 release The instructions are as follows: LDGM Xt, [<Xn|SP>] STGM Xt, [<Xn|SP>] *** gas/ChangeLog *** 2019-04-11 Sudakshina Das <sudi.das@arm.com> * testsuite/gas/aarch64/armv8_5-a-memtag.d: New tests for ldgm and stgm. * testsuite/gas/aarch64/armv8_5-a-memtag.s: Likewise. * testsuite/gas/aarch64/illegal-memtag.l: Likewise. * testsuite/gas/aarch64/illegal-memtag.s: Likewise. *** opcodes/ChangeLog *** 2019-04-11 Sudakshina Das <sudi.das@arm.com> * aarch64-asm-2.c: Regenerated. * aarch64-dis-2.c: Likewise. * aarch64-opc-2.c: Likewise. * aarch64-tbl.h (aarch64_opcode): Add new ldgm and stgm.
2019-04-11AArch64: Ensure regcache is reset between testsAlan Hayward4-6/+27
A recent change made the AArch64 self tests resuse the saved regs cache, rather than creating a new one. Ensure it is reset to default values between tests. Do this by splitting the reset functionality from trad_frame_alloc_saved_regs into a new function. Fixes selftest on AArch64. gdb/ChangeLog: * aarch64-tdep.c (aarch64_analyze_prologue_test): Reset saved regs. * trad-frame.c (trad_frame_reset_saved_regs): New function. (trad_frame_alloc_saved_regs): Call trad_frame_reset_saved_regs. * trad-frame.h (trad_frame_reset_saved_regs): New declaration.
2019-04-10ld: Don't define __rel[a]_iplt_start/__rel[a]_iplt_end in PIEH.J. Lu2-8/+18
__rel[a]_iplt_start and __rel[a]_iplt_end are defined to handle IFUNC in static executables. For PIE, since IFUNC is handled as the part of the normal dynamic relocation processing, there is no need to define these symbols in PIE. * scripttempl/elf.sc (CREATE_PIC): New. Set for CREATE_SHLIB or CREATE_PIE. (__rel_iplt_start): Don't define for CREATE_PIC. (__rel_iplt_end): Likewise. (__rela_iplt_start): Likewise. (__rela_iplt_end): Likewise.
2019-04-10Fix amd64->i386 linux syscall restart problemKevin Buettner4-2/+93
This commit fixes some failures in gdb.base/interrupt.exp when debugging a 32-bit i386 linux inferior from an amd64 host. When running the following test... make check RUNTESTFLAGS="--target_board unix/-m32 interrupt.exp" ... without this commit, I see the following output: FAIL: gdb.base/interrupt.exp: continue (the program exited) FAIL: gdb.base/interrupt.exp: echo data FAIL: gdb.base/interrupt.exp: Send Control-C, second time FAIL: gdb.base/interrupt.exp: signal SIGINT (the program is no longer running) ERROR: Undefined command "". ERROR: GDB process no longer exists === gdb Summary === When the test is run with this commit in place, we see 12 passes instead. This is the desired behavior. Analysis: On Linux, when a syscall is interrupted by a signal, the syscall may return -ERESTARTSYS when a signal occurs. Doing so indicates that the syscall is restartable. Then, depending on settings associated with the signal handler, and after the signal handler is called, the kernel can then either return -EINTR or can cause the syscall to be restarted. In this discussion, we are concerned with the latter case. On i386, the kernel returns this status via the EAX register. When debugging a 32-bit (i386) process from a 64-bit (amd64) GDB, the debugger fetches 64-bit registers even though the process being debugged is 32-bit. Since we're debugging a 32-bit target, only 32 bits are being saved in the register cache. Now, ideally, GDB would save all 64-bits in the regcache and then would be able to restore those same values when it comes time to continue the target. I've looked into doing this, but it's not easy and I don't see many benefits to doing so. One benefit, however, would be that EAX would appear as a negative value for doing syscall restarts. At the moment, GDB is setting the high 32 bits of RAX (and other registers too) to 0. So, when GDB restores EAX just prior to a syscall restart, the high 32 bits of RAX are zeroed, thus making it look like a positive value. For this particular purpose, we need to sign extend EAX so that RAX will appear as a negative value when EAX is set to -ERESTARTSYS. This in turn will cause the signal handling code in the kernel to recognize -ERESTARTSYS which will in turn cause the syscall to be restarted. This commit is based on work by Jan Kratochvil from 2009: https://sourceware.org/ml/gdb-patches/2009-11/msg00592.html Jan's patch had the sign extension code in amd64-nat.c. Several other native targets make use of this code, so it seemed better to move the sign extension code to a linux specific file. I also added similar code to gdbserver. Another approach is to fix the problem in the kernel. Hui Zhu tried to get a fix into the kernel back in 2014, but it was not accepted. Discussion regarding this approach may be found here: https://lore.kernel.org/patchwork/patch/457841/ Even if a fix were to be put into the kernel, we'd still need some kind of fix in GDB in order to support older kernels. Finally, I'll note that Fedora has been carrying a similar patch for at least nine years. Other distributions, including RHEL and CentOS have picked up this change and have been using it too. gdb/ChangeLog: * amd64-linux-nat.c (amd64_linux_collect_native_gregset): New function. (fill_gregset): Call amd64_linux_collect_native_gregset instead of amd64_collect_native_gregset. (amd64_linux_nat_target::store_registers): Likewise. gdb/gdbserver/ChangeLog: * linux-x86-low.c (x86_fill_gregset): Sign extend EAX value when using a 64-bit gdbserver.
2019-04-11Automatic date update in version.inGDB Administrator1-1/+1
2019-04-10Pull in patch for libiberty that fixes a stack exhaustion bug when ↵Nick Clifton2-22/+42
demangling a pathalogically constructed mangled name. PR 89394 * cp-demangle.c (cplus_demangle_fill_name): Reject negative lengths. (d_count_templates_scopes): Replace num_templates and num_scopes parameters with a struct d_print_info pointer parameter. Adjust body of the function accordingly. Add recursion counter and check that the recursion limit is not reached. (d_print_init): Pass dpi parameter to d_count_templates_scopes. Reset recursion counter afterwards, unless the recursion limit was reached.
2019-04-10Introduce a separate debug objfile iteratorTom Tromey5-54/+121
This introduces a new iterator and range adapter for iteration over the separate debug files of a given objfile. As in the current approach, the requested objfile is returned first, followed by the separate debug objfiles. gdb/ChangeLog 2019-04-10 Tom Tromey <tom@tromey.com> * symtab.c (lookup_global_symbol_from_objfile) (lookup_symbol_in_objfile_from_linkage_name): Use the iterator. * objfiles.h (class separate_debug_iterator): New. (class separate_debug_range): New. (struct objfile) <separate_debug_objfiles>: New method. (objfile_separate_debug_iterate): Don't declare. * objfiles.c (separate_debug_iterator::operator++): Rename from objfile_separate_debug_iterate. (objfile_relocate, objfile_rebase, objfile_has_symbols): Use the iterator. * minsyms.c (lookup_minimal_symbol_by_pc_section): Use the iterator.
2019-04-10Fix a couple of commentsTom Tromey3-7/+6
While working on objfiles I noticed a typo in one comment, and another comment that, as far as I can tell, has been obsolete for a very long time. gdb/ChangeLog 2019-04-10 Tom Tromey <tom@tromey.com> * symfile.c (reread_symbols): Remove old comment. * objfiles.c (free_all_objfiles): Fix a typo.
2019-04-10Remove some uses of "object_files"Tom Tromey4-20/+20
The "object_files" macro is sometimes used when iterating over objfiles. This patch removes a few such uses in favor of the new range adapter. gdb/ChangeLog 2019-04-10 Tom Tromey <tom@tromey.com> * ia64-tdep.c (ia64_get_dyn_info_list): Use foreach. * minsyms.c (lookup_minimal_symbol): Use foreach. (lookup_minimal_symbol_text, lookup_minimal_symbol_by_pc_name) (lookup_minimal_symbol_solib_trampoline): Likewise. * symfile.c (reread_symbols): Use foreach.
2019-04-10PR24427, bfd/doc/chew.c reads uninitialized memory and subtracts from ↵Michael Forney2-2/+7
function pointer PR 24427 * doc/chew.c (free_words): Correctly free "push_text" strings.
2019-04-10Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86Rainer Orth21-0/+426
The fix H.J. implemented for PR gas/22791 in the thread starting at [PATCH] x86-64: Treat PC32 relocation with branch as PLT32 https://sourceware.org/ml/binutils/2018-02/msg00065.html is causing problems on Solaris/x86. The native linker is strongly preferred there, and there's no intention of implementing the linker optimization he plans there. Besides, the kernel runtime linker, otherwise has no need to deal with that reloc at all, and instead of adding (possibly even more) workarounds with no benefit, it seems appropriate to disable the R_X86_64_PLT32 generation as branch marker on Solaris/x86 in the first place. The patch itself is trivial, the only complication is adapting the testsuite. Since I've found no way to have conditional sections in the .d files, I've instead used the solution already found elsewhere of having separate .d files for the affected tests in an i386/solaris subdirectory and skipping the original ones. Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without regressions. * config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE. * testsuite/gas/i386/solaris/solaris.exp: New driver. * testsuite/gas/i386/solaris/reloc64.d, testsuite/gas/i386/solaris/x86-64-jump.d, testsuite/gas/i386/solaris/x86-64-mpx-branch-1.d, testsuite/gas/i386/solaris/x86-64-mpx-branch-2.d, testsuite/gas/i386/solaris/x86-64-nop-3.d, testsuite/gas/i386/solaris/x86-64-nop-4.d, testsuite/gas/i386/solaris/x86-64-nop-5.d, testsuite/gas/i386/solaris/x86-64-relax-2.d, testsuite/gas/i386/solaris/x86-64-relax-3.d: New tests. * testsuite/gas/i386/reloc64.d, testsuite/gas/i386/x86-64-jump.d, testsuite/gas/i386/x86-64-mpx-branch-1.d, testsuite/gas/i386/x86-64-mpx-branch-2.d, testsuite/gas/i386/x86-64-nop-3.d, testsuite/gas/i386/x86-64-nop-4.d, testsuite/gas/i386/x86-64-nop-5.d, testsuite/gas/i386/x86-64-relax-2.d, testsuite/gas/i386/x86-64-relax-3.d: Skip on *-*-solaris*.
2019-04-10Re: XFAIL PR ld/20995 tests for lynxos and nto targetsAlan Modra2-2/+7
* testsuite/ld-elf/shared.exp: Don't xfail PR ld/20995 for powerpc-nto.
2019-04-10cskyelf.em branch stub handlingAlan Modra2-16/+23
This fixes the csky-elf ld-elf/pr21884 and ld-unique/pr21529 failures, by disabling branch stubs for binary (and other non-csky) output. The csky-linux target gets branch stubs off by default because presumably there are reasons why branch stubs were disabled, but rather than killing the support completely it can be enabled by --branch-stub. * emultempl/cskyelf.em (csk_elf_before_parse): New function, setting use_branch_stub false for linux. (csky_elf_create_output_section_statements): Do emit this function and all others in the file for linux, plus the branch option control. Disable branch stubs when non-ELF.
2019-04-10Fix some ld dependenciesAlan Modra8-58/+34
In looking at the csky-elf vs. csky-linux differences, the first thing I compared was csky_elf.sh and cskyelf_linux.sh. Those files are mostly the same but besides the real differences, annoyingly have some lines ordered differently. It's better in such cases to have one file source the other, making differences plain. This patch does that for csky and microblaze, removes an unused variable defined in a few places, and fixes ld makefile dependencies. * Makefile.am (eskyelf.c, eskyelf_linux.c): Depend on cskyelf.em. (ecskyelf_linux.c): Depend on cskyelf.sh. (eelf32microblazeel.c): Depend on elf32microblaze.sh. * Makefile.in: Regenerate. * emulparams/cskyelf.sh: Comment regarding cskelf_linux.sh. (PAGE_SIZE): Don't define. * emulparams/cskyelf_linux.sh: Source sckyelf.sh, leaving just the differing variable defs/undefs. * emulparams/elf32mcore.sh (PAGE_SIZE): Don't define. * emulparams/elf32microblaze.sh: Comment re. elf32microblazeel.sh. (OUTPUT_FORMAT): Use BIG_OUTPUT_FORMAT. (PAGE_SIZE): Don't define. * emulparams/elf32microblazeel.sh: Source elf32microblaze.sh, leaving just the differing OUTPUT_FORMAT.
2019-04-10Regen BLD-POTFILES.inAlan Modra2-1/+4
* po/BLD-POTFILES.in: Regenerate.
2019-04-10te-cloudabi.hAlan Modra5-6/+41
This patch is aimed a fixing large numbers of x86_64-cloudabi failures caused by gas selecting the wrong target name. * config/te-cloudabi.h: New file. * config/tc-aarch64.c (aarch64_after_parse_args): Use TE_CLOUDABI rather than TARGET_OS to select cloudabi. * config/tc-i386.h (ELF_TARGET_FORMAT64): Define for TE_CLOUDABI. * configure.tgt (*-*-cloudabi*): Set em=cloudabi.
2019-04-10Automatic date update in version.inGDB Administrator1-1/+1
2019-04-09Fix Rust lexer bugletTom Tromey2-2/+12
PR rust/24414 points out that the Rust lexer uses strtoul when lexing an integer, and that this can give the wrong results in some situations. This patch changes it to use strtoulst, like most of the rest of gdb. It also adds a self test. Tested on x86-64 Fedora 29 using an i686 build. gdb/ChangeLog 2019-04-09 Ivan Begert <ivanbegert@gmail.com> Tom Tromey <tromey@adacore.com> PR rust/24414: * rust-exp.y (rust_parser::lex_number): Use strtoulst. (rust_lex_int_test): Change "value" to be LONGEST. (rust_lex_tests): Add test for long integer literal.
2019-04-09Use find_thread_in_random in select_event_lwpTom Tromey2-31/+8
I noticed that find_thread_in_random duplicates the code in find_thread_in_random, so this patch changes the latter to use the former. There are two other spots in gdb that do this, but to unify all of them would require switching some code from using the "iterate over" idiom to using iterators. Another possible improvement is that find_thread_in_random could be made single-pass using reservoir sampling. Tested by the buildbot. gdb/gdbserver/ChangeLog 2019-04-09 Tom Tromey <tromey@adacore.com> * linux-low.c (select_event_lwp): Use find_thread_in_random.
2019-04-09Consistently use bool for fake_pid_pTom Tromey4-10/+20
I noticed a few spots where fake_pid_p is handled as an int, whereas the field in struct inferior has type bool. This patch changes the remaining places to use bool as well. Tested by the buildbot. gdb/ChangeLog 2019-04-09 Tom Tromey <tromey@adacore.com> * remote.c (remote_target::remote_add_inferior): Change fake_pid_p to bool. (extended_remote_target::attach): Update. (remote_target::remote_notice_new_inferior): Update. (remote_target::add_current_inferior_and_thread): Update. * inferior.c (exit_inferior_1): Use "false". * corelow.c (add_to_thread_list): Make fake_pid_p bool.
2019-04-09Fix typo in latest ChangeLog entrySimon Marchi1-1/+1
2019-04-09Use -qualified flag when setting temporary breakpoint in start commandSimon Marchi5-1/+84
When using the "start" command, GDB puts a temporary breakpoint on the "main" symbol (we literally invoke the tbreak command). However, since it does wild matching by default, it also puts a breakpoint on any C++ method or "main" function in a namespace. For example, when debugging GDB, it creates a total of 24 locations: (gdb) start Temporary breakpoint 1 at 0x198c1e9: main. (24 locations) as there are a bunch of methods called main in the selftests, such as selftests::string_view::capacity_1::main() If such method was called in the constructor of a global object, or a function marked with the attribute "constructor", then we would stop at the wrong place. Also, this causes a few extra symtabs (those that contain the "wrong" mains) to be expanded for nothing. The dummiest, most straightforward solution is to add -qualified when invoking tbreak. With this patch, "start" creates a single-location breakpoint, as expected. I copied the start.exp test to start-cpp.exp and made it use a C++ test file, which contains two main functions. The new test verifies that the output of "start" is the output we get when we set a single-location breakpoint. gdb/ChangeLog: * infcmd.c (run_command_1): Pass -qualified to tbreak when usind the "start" command. gdb/testsuite/ChangeLog: * gdb.base/start-cpp.exp: New file. * gdb.base/start-cpp.cc: New file.
2019-04-09[MIPS] Add RDHWR with the SEL field for MIPS R6.Robert Suchanek6-0/+76
In Release 6 of the MIPS architecture [1], instruction RDHWR supports a 3rd operand to serve as the 3-bit select field for the hardware register. [1] "MIPS Architecture for Programmers Volume II-A: The MIPS32 Instruction Set Manual", Imagination Technologies Ltd., Document Number: MD00086, Revision 6.06, December 15, 2016, Section 3.2 "Alphabetical List of Instructions", pp. 332-334 opcodes/ * mips-opc.c (mips_builtin_opcodes): Add RDHWR rt rd sel. gas/ * testsuite/gas/mips/mips.exp: Run hwr-names test. * testsuite/gas/mips/hwr-names.s: Add test cases for RDHWR with the SEL field. * testsuite/gas/mips/mipsr6@hwr-names.d: New file.
2019-04-08Rename python function thread_from_thread_handle to thread_from_handleKevin Buettner6-20/+50
This renaming was done to stay consistent with the naming of the new gdb.InferiorThread.handle method. I had initially named it "thread_handle" but Tom Tromey suggested just "handle". The old name (thread_from_thread_handle) still works, but is marked as deprecated in comments in the code as well as in the documentation. I have some code which uses these functions. I very much like the brevity of the new names. gdb/doc/ChangeLog: * python.texi (Inferiors In Python): Rename Inferior.thread_from_thread_handle to Inferior.thread_from_handle. Add note about the former being deprecated. gdb/ChangeLog: * python/py-inferior.c (infpy_thread_from_thread_handle): Adjust comments to reflect renaming of thread_from_thread_handle to thread_from_handle. Adjust keywords. Fix type error message. (inferior_object_methods): Add thread_from_handle. Retain thread_from_thread_handle, but mark it as deprecated. testsuite/ChangeLog: * gdb.python/py-thrhandle.exp: Adjust tests to call thread_from_handle instead of thread_from_thread_handle.
2019-04-08Documentation for python method InferiorThread.handleKevin Buettner2-0/+13
gdb/doc/ChangeLog: * python.texi (Threads In Python): Add description for method InferiorThread.handle.
2019-04-08Tests for gdb.InferiorThread.handleKevin Buettner2-3/+44
gdb/testsuite/ChangeLog: * gdb.python/py-thrhandle.exp: Add tests for gdb.InferiorThread.handle.
2019-04-08Support buffer objects as handles in Inferior.thread_from_thread_handle()Kevin Buettner4-10/+37
InferiorThread.handle() returns a python bytes object. We'd like to be able to pass the output of this function, a thread handle, to Inferior.thread_from_thread_handle(). Up to now, thread_from_thread_handle() expects to receive a gdb.Value input. This commit adds support to also allow a python buffer object to be passed as the handle. infpy_thread_from_thread_handle() calls find_thread_by_handle() which has the obvious functionality. It used to pass the thread handle via a struct value pointer. I've revised this interface to instead pass a gdb::array_view<const gdb_byte> object. (Thanks to Tom Tromey for suggesting this data structure over an earlier version which passed a gdb_byte pointer and length.) gdb/ChangeLog: * gdbthread.h (find_thread_by_handle): Revise declaration. * thread.c (find_thread_by_handle): Likewise. Adjust implementation too. * python/py-inferior.c (infpy_thread_from_thread_handle): Add support for buffer objects as handles.
2019-04-08Add python method InferiorThread.handleKevin Buettner2-0/+38
gdb/ChangeLog: * python/py-infthread.c (thpy_thread_handle): New function. (thread_object_methods): Register thpy_thread_handle.
2019-04-08Introduce target_ops method thread_info_to_thread_handleKevin Buettner7-0/+95
This patch adds a thread_info_to_thread_handle method to the target_ops struct. It also implements this functionality for remote targets and linux native threads. gdb/ChangeLog: * gdbthread.h (thread_to_thread_handle): Declare. * thread.c (gdbtypes.h): Include. (thread_to_thread_handle): New function. * target.h (struct target_ops): Add thread_info_to_thread_handle. (target_thread_info_to_thread_handle): Declare. * target.c (target_thread_info_to_thread_handle): New function. * target-debug.h (target_debug_print_gdb_byte_vector): Define. * target-delegates.c: Regenerate. * linux-thread-db.c (class thread_db_target): Add method thread_info_to_thread_handle. (thread_db_target::thread_info_to_thread_handle): Define. * remote.c (class remote_target): Add new method thread_info_to_thread_handle. (remote_target::thread_info_to_thread_handle): Define.
2019-04-08x86: Define GNU_PROPERTY_X86_ISA_1_AVX512_BF16H.J. Lu11-4/+30
Update assembler and readelf to support #define GNU_PROPERTY_X86_ISA_1_AVX512_BF16 (1U << 24) for AVX512_BF16. binutils/ * readelf.c (decode_x86_isa): Handle GNU_PROPERTY_X86_ISA_1_AVX512_BF16. * testsuite/binutils-all/i386/pr21231b.d: Updated. * testsuite/binutils-all/x86-64/pr21231b.d: Likewise. gas/ * config/tc-i386.c (output_insn): Support GNU_PROPERTY_X86_ISA_1_AVX512_BF16. * testsuite/gas/i386/property-2.s: Add AVX512_BF16 test. * testsuite/gas/i386/property-2.d: Updated. * testsuite/gas/i386/x86-64-property-2.d: Likewise. include/ * elf/common.h (GNU_PROPERTY_X86_ISA_1_AVX512_BF16): New.
2019-04-09Automatic date update in version.inGDB Administrator1-1/+1
2019-04-08XFAIL PR ld/20995 tests for lynxos and nto targetsH.J. Lu2-2/+9
lynxos and nto targets don't support RELRO. * testsuite/ld-elf/shared.exp: XFAIL PR ld/20995 tests for lynxos and nto targets.
2019-04-08Some gdb_exception{,error,quit} tweaksPedro Alves3-22/+43
- Explicitly include <string> for std::string. - Use std::make_shared to construct gdb_exception::message instead of operator new, avoiding one heap allocation (2 instead of 3). Add 'const char *fmt, va_list ap' parameters to gdb_exception{,error,quit}'s ctors, and do the std::make_shared in the gdb_exception ctor. - gdb_exception_error's constructor does not need to have an 'enum return_reason' parameter, since it is always RETURN_ERROR, by definition. - Similarly, gdb_exception_quit's contructor does not need to have 'enum return_reason'/'enum errors' parameters. - In the gdb_exception_{quit,_error} ctors that take a gdb_exception as argument, assert that they're being passed a gdb_exception object of the right 'reason'. gdb/ChangeLog: 2019-04-08 Pedro Alves <palves@redhat.com> * common/common-exceptions.c (throw_exception): Don't create named object to throw; throw directly. (throw_it): Likewise. Don't initialize gdb_exception::message here, with new; pass FMT and AP to the ctor instead. * common/common-exceptions.h: Include <string>. (gdb_exception::gdb_exception(enum return_reason, enum errors, const char *, va_list)): New ctor. Use std::make_shared. (gdb_exception_error::gdb_exception_error(enum return_reason, enum errors)): Delete. (gdb_exception_error::gdb_exception_error(enum errors, const char *, va_list)): New. (gdb_exception_error::gdb_exception_error(const gdb_exception &)): Add assertion. (gdb_exception_quit::gdb_exception_quit(enum return_reason, enum errors)): Delete. (gdb_exception_quit::gdb_exception_quit(const char *, va_list)): New. (gdb_exception_quit::gdb_exception_quit(const gdb_exception &)): Add assertion.
2019-04-08x86: Remove i386-*-kaos* and i386-*-chaos targetsH.J. Lu10-37/+18
Remove i386-*-kaos* and i386-*-chaos targets since they are no longer supported by config.sub: $ .../config.sub i386-kaos Invalid configuration `i386-kaos': system `kaos' not recognized $ .../config.sub i386-chaos Invalid configuration `i386-chaos': system `chaos' not recognized $ bfd/ * config.bfd: Remove i[3-7]86-*-kaos* and i[3-7]86-*-chaos targets. gas/ * configure.tgt: Remove i386-*-kaos* and i386-*-chaos targets. * testsuite/gas/i386/i386.exp: Remove *-*-caos* and "*-*-kaos* check. ld/ * Makefile.am (ALL_EMULATION_SOURCES): Remove eelf_i386_chaos.c. (eelf_i386_chaos.c): Removed. * Makefile.in: Regenerated. * configure.tgt: Remove i[3-7]86-*-kaos*. * emulparams/elf_i386_chaos.sh: Removed.
2019-04-08Count i386-moss as ELFH.J. Lu2-0/+5
* testsuite/binutils-all/nm.exp: Count i386-moss as ELF.
2019-04-08Use elf-x86.em for i386-moss and i386-beosH.J. Lu3-0/+7
* emulparams/elf_i386_be.sh (EXTRA_EM_FILE): New. * emulparams/i386moss.sh (EXTRA_EM_FILE): Likewise.
2019-04-08x86: Consolidate AVX512 BF16 entries in i386-opc.tblH.J. Lu3-282/+34
1. Use single entry for vcvtne2ps2bf16 and vdpbf16ps with Disp8ShiftVL. 2. Use 5 entries, instead of 8, for vcvtneps2bf16. * i386-opc.tbl: Consolidate AVX512 BF16 entries. * i386-init.h: Regenerated.
2019-04-08Replace throw_exception with throw in some casesTom Tromey36-71/+151
This replaces throw_exception with "throw;" when possible. This was written by script. The rule that is followed is that uses of the form: catch (... &name) { ... throw_exception (name); } ... can be rewritten. This should always be safe, because exceptions are caught by const reference, and therefore can't be modified in the body of the catch. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * valops.c (value_rtti_indirect_type): Replace throw_exception with throw. * tracefile-tfile.c (tfile_target_open): Replace throw_exception with throw. * thread.c (thr_try_catch_cmd): Replace throw_exception with throw. * target.c (target_translate_tls_address): Replace throw_exception with throw. * stack.c (frame_apply_command_count): Replace throw_exception with throw. * solib-spu.c (append_ocl_sos): Replace throw_exception with throw. * s390-tdep.c (s390_frame_unwind_cache): Replace throw_exception with throw. * rs6000-tdep.c (rs6000_frame_cache) (rs6000_epilogue_frame_cache): Replace throw_exception with throw. * remote.c: Replace throw_exception with throw. * record-full.c (record_full_message, record_full_wait_1) (record_full_restore): Replace throw_exception with throw. * record-btrace.c: (get_thread_current_frame_id, record_btrace_start_replaying) (cmd_record_btrace_bts_start, cmd_record_btrace_pt_start) (cmd_record_btrace_start): Replace throw_exception with throw. * parse.c (parse_exp_in_context_1): Replace throw_exception with throw. * linux-nat.c (detach_one_lwp, linux_resume_one_lwp) (resume_stopped_resumed_lwps): Replace throw_exception with throw. * linespec.c: (find_linespec_symbols): Replace throw_exception with throw. * infrun.c (displaced_step_prepare, resume): Replace throw_exception with throw. * infcmd.c (post_create_inferior): Replace throw_exception with throw. * inf-loop.c (inferior_event_handler): Replace throw_exception with throw. * i386-tdep.c (i386_frame_cache, i386_epilogue_frame_cache) (i386_sigtramp_frame_cache): Replace throw_exception with throw. * frame.c (frame_unwind_pc, get_prev_frame_if_no_cycle) (get_prev_frame_always, get_frame_pc_if_available) (get_frame_address_in_block_if_available, get_frame_language): Replace throw_exception with throw. * frame-unwind.c (frame_unwind_try_unwinder): Replace throw_exception with throw. * eval.c (fetch_subexp_value, evaluate_var_value) (evaluate_funcall, evaluate_subexp_standard): Replace throw_exception with throw. * dwarf2loc.c (call_site_find_chain) (dwarf2_evaluate_loc_desc_full, dwarf2_locexpr_baton_eval): Replace throw_exception with throw. * dwarf2-frame.c (dwarf2_frame_cache): Replace throw_exception with throw. * darwin-nat.c (darwin_attach_pid): Replace throw_exception with throw. * cp-abi.c (baseclass_offset): Replace throw_exception with throw. * completer.c (complete_line_internal): Replace throw_exception with throw. * compile/compile-object-run.c (compile_object_run): Replace throw_exception with throw. * cli/cli-script.c (process_next_line): Replace throw_exception with throw. * btrace.c (btrace_compute_ftrace_pt, btrace_compute_ftrace) (btrace_enable, btrace_maint_update_pt_packets): Replace throw_exception with throw. * breakpoint.c (create_breakpoint, save_breakpoints): Replace throw_exception with throw. * break-catch-throw.c (re_set_exception_catchpoint): Replace throw_exception with throw. * amd64-tdep.c (amd64_frame_cache, amd64_sigtramp_frame_cache) (amd64_epilogue_frame_cache): Replace throw_exception with throw. * aarch64-tdep.c (aarch64_make_prologue_cache) (aarch64_make_stub_cache): Replace throw_exception with throw. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * linux-low.c (linux_detach_one_lwp): Replace throw_exception with throw. (linux_resume_one_lwp): Likewise.
2019-04-08Make exception throwing a bit more efficientTom Tromey3-18/+37
This makes exception throwing a bit more efficient, by removing some copies. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * common/common-exceptions.c (throw_exception): Rename from throw_exception_cxx. Remove old copy. Make argument const. (throw_it): Create and throw exception objects directly. * common/common-exceptions.h (throw_exception): Make argument const. (struct gdb_exception_error): Add constructor. (struct gdb_exception_quit): Add constructor.
2019-04-08Remove some now-dead exception codeTom Tromey3-57/+13
After the rewriting to use try/catch, some of the exception code is now unused. This patch removes that code. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * common/common-exceptions.h (exception_rethrow): Don't declare. (TRY_SJLJ): Update comment. (TRY, CATCH, END_CATCH): Remove. * common/common-exceptions.c (exception_rethrow): Remove.
2019-04-08Rename gdb exception typesTom Tromey146-459/+606
This renames the gdb exception types. The old types were only needed due to the macros in common-exception.h that are now gone. The intermediate layer of gdb_exception_RETURN_MASK_ALL did not seem needed, so this patch removes it entirely. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * common/common-exceptions.h (gdb_exception_RETURN_MASK_ALL): Remove. (gdb_exception_error): Rename from gdb_exception_RETURN_MASK_ERROR. (gdb_exception_quit): Rename from gdb_exception_RETURN_MASK_QUIT. (gdb_quit_bad_alloc): Update. * aarch64-tdep.c: Update. * ada-lang.c: Update. * ada-typeprint.c: Update. * ada-valprint.c: Update. * amd64-tdep.c: Update. * arch-utils.c: Update. * break-catch-throw.c: Update. * breakpoint.c: Update. * btrace.c: Update. * c-varobj.c: Update. * cli/cli-cmds.c: Update. * cli/cli-interp.c: Update. * cli/cli-script.c: Update. * common/common-exceptions.c: Update. * common/new-op.c: Update. * common/selftest.c: Update. * compile/compile-c-symbols.c: Update. * compile/compile-cplus-symbols.c: Update. * compile/compile-object-load.c: Update. * compile/compile-object-run.c: Update. * completer.c: Update. * corelow.c: Update. * cp-abi.c: Update. * cp-support.c: Update. * cp-valprint.c: Update. * darwin-nat.c: Update. * disasm-selftests.c: Update. * dtrace-probe.c: Update. * dwarf-index-cache.c: Update. * dwarf-index-write.c: Update. * dwarf2-frame-tailcall.c: Update. * dwarf2-frame.c: Update. * dwarf2loc.c: Update. * dwarf2read.c: Update. * eval.c: Update. * event-loop.c: Update. * event-top.c: Update. * exec.c: Update. * f-valprint.c: Update. * fbsd-tdep.c: Update. * frame-unwind.c: Update. * frame.c: Update. * gdbtypes.c: Update. * gnu-v3-abi.c: Update. * guile/guile-internal.h: Update. * guile/scm-block.c: Update. * guile/scm-breakpoint.c: Update. * guile/scm-cmd.c: Update. * guile/scm-disasm.c: Update. * guile/scm-frame.c: Update. * guile/scm-lazy-string.c: Update. * guile/scm-math.c: Update. * guile/scm-param.c: Update. * guile/scm-ports.c: Update. * guile/scm-pretty-print.c: Update. * guile/scm-symbol.c: Update. * guile/scm-symtab.c: Update. * guile/scm-type.c: Update. * guile/scm-value.c: Update. * i386-linux-tdep.c: Update. * i386-tdep.c: Update. * inf-loop.c: Update. * infcall.c: Update. * infcmd.c: Update. * infrun.c: Update. * jit.c: Update. * language.c: Update. * linespec.c: Update. * linux-fork.c: Update. * linux-nat.c: Update. * linux-tdep.c: Update. * linux-thread-db.c: Update. * main.c: Update. * mi/mi-cmd-break.c: Update. * mi/mi-cmd-stack.c: Update. * mi/mi-interp.c: Update. * mi/mi-main.c: Update. * objc-lang.c: Update. * p-valprint.c: Update. * parse.c: Update. * ppc-linux-tdep.c: Update. * printcmd.c: Update. * python/py-arch.c: Update. * python/py-breakpoint.c: Update. * python/py-cmd.c: Update. * python/py-finishbreakpoint.c: Update. * python/py-frame.c: Update. * python/py-framefilter.c: Update. * python/py-gdb-readline.c: Update. * python/py-inferior.c: Update. * python/py-infthread.c: Update. * python/py-lazy-string.c: Update. * python/py-linetable.c: Update. * python/py-objfile.c: Update. * python/py-param.c: Update. * python/py-prettyprint.c: Update. * python/py-progspace.c: Update. * python/py-record-btrace.c: Update. * python/py-record.c: Update. * python/py-symbol.c: Update. * python/py-type.c: Update. * python/py-unwind.c: Update. * python/py-utils.c: Update. * python/py-value.c: Update. * python/python.c: Update. * record-btrace.c: Update. * record-full.c: Update. * remote-fileio.c: Update. * remote.c: Update. * riscv-tdep.c: Update. * rs6000-aix-tdep.c: Update. * rs6000-tdep.c: Update. * rust-exp.y: Update. * rust-lang.c: Update. * s390-tdep.c: Update. * selftest-arch.c: Update. * solib-dsbt.c: Update. * solib-frv.c: Update. * solib-spu.c: Update. * solib-svr4.c: Update. * solib.c: Update. * sparc64-linux-tdep.c: Update. * stack.c: Update. * symfile-mem.c: Update. * symmisc.c: Update. * target.c: Update. * thread.c: Update. * top.c: Update. * tracefile-tfile.c: Update. * tui/tui.c: Update. * typeprint.c: Update. * unittests/cli-utils-selftests.c: Update. * unittests/parse-connection-spec-selftests.c: Update. * valops.c: Update. * valprint.c: Update. * value.c: Update. * varobj.c: Update. * windows-nat.c: Update. * x86-linux-nat.c: Update. * xml-support.c: Update. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * gdbreplay.c: Update. * linux-low.c: Update. * server.c: Update.
2019-04-08Rewrite TRY/CATCHTom Tromey144-1326/+1033
This rewrites gdb's TRY/CATCH to plain C++ try/catch. The patch was largely written by script, though one change (to a comment in common-exceptions.h) was reverted by hand. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c: Use C++ exception handling. * x86-linux-nat.c: Use C++ exception handling. * windows-nat.c: Use C++ exception handling. * varobj.c: Use C++ exception handling. * value.c: Use C++ exception handling. * valprint.c: Use C++ exception handling. * valops.c: Use C++ exception handling. * unittests/parse-connection-spec-selftests.c: Use C++ exception handling. * unittests/cli-utils-selftests.c: Use C++ exception handling. * typeprint.c: Use C++ exception handling. * tui/tui.c: Use C++ exception handling. * tracefile-tfile.c: Use C++ exception handling. * top.c: Use C++ exception handling. * thread.c: Use C++ exception handling. * target.c: Use C++ exception handling. * symmisc.c: Use C++ exception handling. * symfile-mem.c: Use C++ exception handling. * stack.c: Use C++ exception handling. * sparc64-linux-tdep.c: Use C++ exception handling. * solib.c: Use C++ exception handling. * solib-svr4.c: Use C++ exception handling. * solib-spu.c: Use C++ exception handling. * solib-frv.c: Use C++ exception handling. * solib-dsbt.c: Use C++ exception handling. * selftest-arch.c: Use C++ exception handling. * s390-tdep.c: Use C++ exception handling. * rust-lang.c: Use C++ exception handling. * rust-exp.y: Use C++ exception handling. * rs6000-tdep.c: Use C++ exception handling. * rs6000-aix-tdep.c: Use C++ exception handling. * riscv-tdep.c: Use C++ exception handling. * remote.c: Use C++ exception handling. * remote-fileio.c: Use C++ exception handling. * record-full.c: Use C++ exception handling. * record-btrace.c: Use C++ exception handling. * python/python.c: Use C++ exception handling. * python/py-value.c: Use C++ exception handling. * python/py-utils.c: Use C++ exception handling. * python/py-unwind.c: Use C++ exception handling. * python/py-type.c: Use C++ exception handling. * python/py-symbol.c: Use C++ exception handling. * python/py-record.c: Use C++ exception handling. * python/py-record-btrace.c: Use C++ exception handling. * python/py-progspace.c: Use C++ exception handling. * python/py-prettyprint.c: Use C++ exception handling. * python/py-param.c: Use C++ exception handling. * python/py-objfile.c: Use C++ exception handling. * python/py-linetable.c: Use C++ exception handling. * python/py-lazy-string.c: Use C++ exception handling. * python/py-infthread.c: Use C++ exception handling. * python/py-inferior.c: Use C++ exception handling. * python/py-gdb-readline.c: Use C++ exception handling. * python/py-framefilter.c: Use C++ exception handling. * python/py-frame.c: Use C++ exception handling. * python/py-finishbreakpoint.c: Use C++ exception handling. * python/py-cmd.c: Use C++ exception handling. * python/py-breakpoint.c: Use C++ exception handling. * python/py-arch.c: Use C++ exception handling. * printcmd.c: Use C++ exception handling. * ppc-linux-tdep.c: Use C++ exception handling. * parse.c: Use C++ exception handling. * p-valprint.c: Use C++ exception handling. * objc-lang.c: Use C++ exception handling. * mi/mi-main.c: Use C++ exception handling. * mi/mi-interp.c: Use C++ exception handling. * mi/mi-cmd-stack.c: Use C++ exception handling. * mi/mi-cmd-break.c: Use C++ exception handling. * main.c: Use C++ exception handling. * linux-thread-db.c: Use C++ exception handling. * linux-tdep.c: Use C++ exception handling. * linux-nat.c: Use C++ exception handling. * linux-fork.c: Use C++ exception handling. * linespec.c: Use C++ exception handling. * language.c: Use C++ exception handling. * jit.c: Use C++ exception handling. * infrun.c: Use C++ exception handling. * infcmd.c: Use C++ exception handling. * infcall.c: Use C++ exception handling. * inf-loop.c: Use C++ exception handling. * i386-tdep.c: Use C++ exception handling. * i386-linux-tdep.c: Use C++ exception handling. * guile/scm-value.c: Use C++ exception handling. * guile/scm-type.c: Use C++ exception handling. * guile/scm-symtab.c: Use C++ exception handling. * guile/scm-symbol.c: Use C++ exception handling. * guile/scm-pretty-print.c: Use C++ exception handling. * guile/scm-ports.c: Use C++ exception handling. * guile/scm-param.c: Use C++ exception handling. * guile/scm-math.c: Use C++ exception handling. * guile/scm-lazy-string.c: Use C++ exception handling. * guile/scm-frame.c: Use C++ exception handling. * guile/scm-disasm.c: Use C++ exception handling. * guile/scm-cmd.c: Use C++ exception handling. * guile/scm-breakpoint.c: Use C++ exception handling. * guile/scm-block.c: Use C++ exception handling. * guile/guile-internal.h: Use C++ exception handling. * gnu-v3-abi.c: Use C++ exception handling. * gdbtypes.c: Use C++ exception handling. * frame.c: Use C++ exception handling. * frame-unwind.c: Use C++ exception handling. * fbsd-tdep.c: Use C++ exception handling. * f-valprint.c: Use C++ exception handling. * exec.c: Use C++ exception handling. * event-top.c: Use C++ exception handling. * event-loop.c: Use C++ exception handling. * eval.c: Use C++ exception handling. * dwarf2read.c: Use C++ exception handling. * dwarf2loc.c: Use C++ exception handling. * dwarf2-frame.c: Use C++ exception handling. * dwarf2-frame-tailcall.c: Use C++ exception handling. * dwarf-index-write.c: Use C++ exception handling. * dwarf-index-cache.c: Use C++ exception handling. * dtrace-probe.c: Use C++ exception handling. * disasm-selftests.c: Use C++ exception handling. * darwin-nat.c: Use C++ exception handling. * cp-valprint.c: Use C++ exception handling. * cp-support.c: Use C++ exception handling. * cp-abi.c: Use C++ exception handling. * corelow.c: Use C++ exception handling. * completer.c: Use C++ exception handling. * compile/compile-object-run.c: Use C++ exception handling. * compile/compile-object-load.c: Use C++ exception handling. * compile/compile-cplus-symbols.c: Use C++ exception handling. * compile/compile-c-symbols.c: Use C++ exception handling. * common/selftest.c: Use C++ exception handling. * common/new-op.c: Use C++ exception handling. * cli/cli-script.c: Use C++ exception handling. * cli/cli-interp.c: Use C++ exception handling. * cli/cli-cmds.c: Use C++ exception handling. * c-varobj.c: Use C++ exception handling. * btrace.c: Use C++ exception handling. * breakpoint.c: Use C++ exception handling. * break-catch-throw.c: Use C++ exception handling. * arch-utils.c: Use C++ exception handling. * amd64-tdep.c: Use C++ exception handling. * ada-valprint.c: Use C++ exception handling. * ada-typeprint.c: Use C++ exception handling. * ada-lang.c: Use C++ exception handling. * aarch64-tdep.c: Use C++ exception handling. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c: Use C++ exception handling. * linux-low.c: Use C++ exception handling. * gdbreplay.c: Use C++ exception handling.
2019-04-08Make exceptions use std::string and be self-managingTom Tromey43-245/+253
This changes the exception's "message" member to be a shared_ptr wrapping a std::string. This allows removing the stack of exception messages, because now exceptions will self-destruct when needed. This also adds a noexcept copy constructor and operator= to gdb_exception, plus a "what" method. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * xml-support.c (gdb_xml_parser::parse): Update. * x86-linux-nat.c (x86_linux_nat_target::enable_btrace): Update. * value.c (show_convenience): Update. * unittests/cli-utils-selftests.c (test_number_or_range_parser) (test_parse_flags_qcs): Update. * thread.c (thr_try_catch_cmd): Update. * target.c (target_translate_tls_address): Update. * stack.c (print_frame_arg, read_frame_local, read_frame_arg) (info_frame_command_core, frame_apply_command_count): Update. * rust-exp.y (rust_lex_exception_test): Update. * riscv-tdep.c (riscv_print_one_register_info): Update. * remote.c (remote_target::enable_btrace): Update. * record-btrace.c (record_btrace_enable_warn): Update. * python/py-utils.c (gdbpy_convert_exception): Update. * printcmd.c (do_one_display, print_variable_and_value): Update. * mi/mi-main.c (mi_print_exception): Update. * mi/mi-interp.c (mi_cmd_interpreter_exec): Use SCOPE_EXIT. * mi/mi-cmd-stack.c (list_arg_or_local): Update. * linux-nat.c (linux_nat_target::attach): Update. * linux-fork.c (class scoped_switch_fork_info): Update. * infrun.c (displaced_step_prepare): Update. * infcall.c (call_function_by_hand_dummy): Update. * guile/scm-exception.c (gdbscm_scm_from_gdb_exception): Update. * gnu-v3-abi.c (print_one_vtable): Update. * frame.c (get_prev_frame_always): Update. * f-valprint.c (info_common_command_for_block): Update. * exec.c (try_open_exec_file): Update. * exceptions.c (print_exception, exception_print) (exception_fprintf, exception_print_same): Update. * dwarf2-frame.c (dwarf2_build_frame_info): Update. * dwarf-index-cache.c (index_cache::store) (index_cache::lookup_gdb_index): Update. * darwin-nat.c (maybe_cache_shell): Update. * cp-valprint.c (cp_print_value_fields): Update. * compile/compile-cplus-symbols.c (gcc_cplus_convert_symbol) (gcc_cplus_symbol_address): Update. * compile/compile-c-symbols.c (gcc_convert_symbol) (gcc_symbol_address, generate_c_for_for_one_variable): Update. * common/selftest.c: Update. * common/common-exceptions.h (struct gdb_exception) <message>: Now a std::string. (exception_try_scope_entry, exception_try_scope_exit): Don't declare. (struct exception_try_scope): Remove. (TRY): Don't use exception_try_scope. (struct gdb_exception): Add constructor, operator=. <what>: New method. (struct gdb_exception_RETURN_MASK_ALL) (struct gdb_exception_RETURN_MASK_ERROR) (struct gdb_exception_RETURN_MASK_QUIT): Add constructor. (struct gdb_quit_bad_alloc): Update. * common/common-exceptions.c (exception_none): Change initializer. (struct catcher) <state, exception>: Initialize inline. <prev>: Remove member. (current_catcher): Remove. (catchers): New global. (exceptions_state_mc_init): Simplify. (catcher_pop): Remove. (exceptions_state_mc, exceptions_state_mc_catch): Update. (try_scope_depth, exception_try_scope_entry) (exception_try_scope_exit): Remove. (throw_exception_sjlj): Update. (exception_messages, exception_messages_size): Remove. (throw_it): Simplify. (gdb_exception_sliced_copy): Remove. (throw_exception_cxx): Update. * cli/cli-script.c (script_from_file): Update. * breakpoint.c (insert_bp_location, update_breakpoint_locations): Update. * ada-valprint.c (ada_val_print): Update. * ada-lang.c (ada_to_fixed_type_1, ada_exception_name_addr) (create_excep_cond_exprs): Update. gdb/gdbserver/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * server.c (handle_btrace_general_set, handle_qxfer_btrace) (handle_qxfer_btrace_conf, detach_or_kill_for_exit_cleanup) (captured_main, main): Update. * gdbreplay.c (main): Update.
2019-04-08Simplify exception handlingTom Tromey3-81/+10
Now that cleanups have been removed, TRY/CATCH can't be SJLJ-based any more. This patch simplifies the exception handling code, by removing the non-working variants. Note that the "pure" C++ exception handling code is removed as well; I think the route forward must be to change exceptions to be self-destructing, so that try_scope_depth can simply be removed. Some longjmp-based code remains, as it is needed to throw an exception through readline. gdb/ChangeLog 2019-04-08 Tom Tromey <tom@tromey.com> * common/common-exceptions.h (GDB_XCPT_SJMP, GDB_XCPT_TRY) (GDB_XCPT_RAW_TRY, GDB_XCPT): Remove. (TRY, CATCH, END_CATCH): Remove some definitions. * common/common-exceptions.c: Don't use GDB_XCPT. (catcher_list_size): Remove. (throw_exception, throw_it): Simplify.
2019-04-08Fix i386-lynxos and other runtime linker failsAlan Modra4-0/+9
Segfaults due to htab->params being NULL. * emulparams/elf64rdos.sh (EXTRA_EM_FILE): Define. * emulparams/i386lynx.sh (EXTRA_EM_FILE): Define. * emulparams/i386nto.sh (EXTRA_EM_FILE): Define.
2019-04-08Fix x86_64-rdos build failAlan Modra3-26/+33
x86_64-rdos is one of the few x86_64 targets that is 64-bit only and the x86_64 configure entries don't depend on elf-vxworks.lo. This results in undefined references from elfxx-x86.o. * configure.ac (elfxx_x86): Define and use. * configure: Regenerate.