Commit Graph

97304 Commits

Author SHA1 Message Date
Tom Tromey a70b814420 Rewrite TRY/CATCH
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-08 09:05:39 -06:00
Tom Tromey 3d6e9d2336 Make exceptions use std::string and be self-managing
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-08 09:05:38 -06:00
Tom Tromey c5c1011821 Simplify exception handling
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-08 09:05:37 -06:00
Alan Modra d970ee2bae Fix i386-lynxos and other runtime linker fails
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-08 14:11:57 +09:30
Alan Modra 5f2a6b8510 Fix x86_64-rdos build fail
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.
2019-04-08 14:11:57 +09:30
GDB Administrator 5a826ffff8 Automatic date update in version.in 2019-04-08 00:00:38 +00:00
Tom Tromey 48ab418ec7 Make "all" depend on "info"
I've broken "make info" a couple of times now, because I sometimes
forget to run "make info" after modifying a Texinfo file.

I don't know why gdb's "make all" doesn't build the info pages.  I
suspect this was some Cygnus-local oddity back in the day.

This patch changes doc/Makefile.in so that the info pages are built by
"make all".  As a point of reference, Automake has essentially always
worked this way.  According to the Automake manual (I didn't
double-check) this is required by the GNU coding standards.

The first time I sent this patch, I mentioned that I wanted to look
into some existing bugs in bugzilla about missing "makeinfo".
However, today I tried and I discovered that BFD requires makeinfo,
and builds its info file as part of "all".  So, I think this change
doesn't worsen the situation for users in any way, and can simply go
in.

gdb/doc/ChangeLog
2019-04-07  Tom Tromey  <tom@tromey.com>

	* Makefile.in (all): Depend on "info".
2019-04-07 17:01:18 -06:00
Alan Modra e392bad3ec print_insn_powerpc tidy
* ppc-dis.c (print_insn_powerpc): Use a tiny state machine
	op_separator to control printing of spaces, comma and parens
	rather than need_comma, need_paren and spaces vars.
2019-04-07 22:35:56 +09:30
Alan Modra dffaa15c48 PR24421, Wrong brackets in opcodes/arm-dis.c
PR 24421
	* arm-dis.c (print_insn_coprocessor): Correct bracket placement.
	(print_insn_neon, print_insn_arm): Likewise.
2019-04-07 22:35:56 +09:30
Alan Modra 07ffcfecac Merge libiberty from gcc 2019-04-07 20:49:49 +09:30
GDB Administrator 5f60cccf9d Automatic date update in version.in 2019-04-07 00:01:01 +00:00
Tom Tromey 4de283e4b5 Revert the header-sorting patch
Andreas Schwab and John Baldwin pointed out some bugs in the header
sorting patch; and I noticed that the output was not correct when
limited to a subset of files (a bug in my script).

So, I'm reverting the patch.  I may try again after fixing the issues
pointed out.

gdb/ChangeLog
2019-04-05  Tom Tromey  <tom@tromey.com>

	Revert the header-sorting patch.
	* ft32-tdep.c: Revert.
	* frv-tdep.c: Revert.
	* frv-linux-tdep.c: Revert.
	* frame.c: Revert.
	* frame-unwind.c: Revert.
	* frame-base.c: Revert.
	* fork-child.c: Revert.
	* findvar.c: Revert.
	* findcmd.c: Revert.
	* filesystem.c: Revert.
	* filename-seen-cache.h: Revert.
	* filename-seen-cache.c: Revert.
	* fbsd-tdep.c: Revert.
	* fbsd-nat.h: Revert.
	* fbsd-nat.c: Revert.
	* f-valprint.c: Revert.
	* f-typeprint.c: Revert.
	* f-lang.c: Revert.
	* extension.h: Revert.
	* extension.c: Revert.
	* extension-priv.h: Revert.
	* expprint.c: Revert.
	* exec.h: Revert.
	* exec.c: Revert.
	* exceptions.c: Revert.
	* event-top.c: Revert.
	* event-loop.c: Revert.
	* eval.c: Revert.
	* elfread.c: Revert.
	* dwarf2read.h: Revert.
	* dwarf2read.c: Revert.
	* dwarf2loc.c: Revert.
	* dwarf2expr.h: Revert.
	* dwarf2expr.c: Revert.
	* dwarf2-frame.c: Revert.
	* dwarf2-frame-tailcall.c: Revert.
	* dwarf-index-write.h: Revert.
	* dwarf-index-write.c: Revert.
	* dwarf-index-common.c: Revert.
	* dwarf-index-cache.h: Revert.
	* dwarf-index-cache.c: Revert.
	* dummy-frame.c: Revert.
	* dtrace-probe.c: Revert.
	* disasm.h: Revert.
	* disasm.c: Revert.
	* disasm-selftests.c: Revert.
	* dictionary.c: Revert.
	* dicos-tdep.c: Revert.
	* demangle.c: Revert.
	* dcache.h: Revert.
	* dcache.c: Revert.
	* darwin-nat.h: Revert.
	* darwin-nat.c: Revert.
	* darwin-nat-info.c: Revert.
	* d-valprint.c: Revert.
	* d-namespace.c: Revert.
	* d-lang.c: Revert.
	* ctf.c: Revert.
	* csky-tdep.c: Revert.
	* csky-linux-tdep.c: Revert.
	* cris-tdep.c: Revert.
	* cris-linux-tdep.c: Revert.
	* cp-valprint.c: Revert.
	* cp-support.c: Revert.
	* cp-namespace.c: Revert.
	* cp-abi.c: Revert.
	* corelow.c: Revert.
	* corefile.c: Revert.
	* continuations.c: Revert.
	* completer.h: Revert.
	* completer.c: Revert.
	* complaints.c: Revert.
	* coffread.c: Revert.
	* coff-pe-read.c: Revert.
	* cli-out.h: Revert.
	* cli-out.c: Revert.
	* charset.c: Revert.
	* c-varobj.c: Revert.
	* c-valprint.c: Revert.
	* c-typeprint.c: Revert.
	* c-lang.c: Revert.
	* buildsym.c: Revert.
	* buildsym-legacy.c: Revert.
	* build-id.h: Revert.
	* build-id.c: Revert.
	* btrace.c: Revert.
	* bsd-uthread.c: Revert.
	* breakpoint.h: Revert.
	* breakpoint.c: Revert.
	* break-catch-throw.c: Revert.
	* break-catch-syscall.c: Revert.
	* break-catch-sig.c: Revert.
	* blockframe.c: Revert.
	* block.c: Revert.
	* bfin-tdep.c: Revert.
	* bfin-linux-tdep.c: Revert.
	* bfd-target.c: Revert.
	* bcache.c: Revert.
	* ax-general.c: Revert.
	* ax-gdb.h: Revert.
	* ax-gdb.c: Revert.
	* avr-tdep.c: Revert.
	* auxv.c: Revert.
	* auto-load.c: Revert.
	* arm-wince-tdep.c: Revert.
	* arm-tdep.c: Revert.
	* arm-symbian-tdep.c: Revert.
	* arm-pikeos-tdep.c: Revert.
	* arm-obsd-tdep.c: Revert.
	* arm-nbsd-tdep.c: Revert.
	* arm-nbsd-nat.c: Revert.
	* arm-linux-tdep.c: Revert.
	* arm-linux-nat.c: Revert.
	* arm-fbsd-tdep.c: Revert.
	* arm-fbsd-nat.c: Revert.
	* arm-bsd-tdep.c: Revert.
	* arch-utils.c: Revert.
	* arc-tdep.c: Revert.
	* arc-newlib-tdep.c: Revert.
	* annotate.h: Revert.
	* annotate.c: Revert.
	* amd64-windows-tdep.c: Revert.
	* amd64-windows-nat.c: Revert.
	* amd64-tdep.c: Revert.
	* amd64-sol2-tdep.c: Revert.
	* amd64-obsd-tdep.c: Revert.
	* amd64-obsd-nat.c: Revert.
	* amd64-nbsd-tdep.c: Revert.
	* amd64-nbsd-nat.c: Revert.
	* amd64-nat.c: Revert.
	* amd64-linux-tdep.c: Revert.
	* amd64-linux-nat.c: Revert.
	* amd64-fbsd-tdep.c: Revert.
	* amd64-fbsd-nat.c: Revert.
	* amd64-dicos-tdep.c: Revert.
	* amd64-darwin-tdep.c: Revert.
	* amd64-bsd-nat.c: Revert.
	* alpha-tdep.c: Revert.
	* alpha-obsd-tdep.c: Revert.
	* alpha-nbsd-tdep.c: Revert.
	* alpha-mdebug-tdep.c: Revert.
	* alpha-linux-tdep.c: Revert.
	* alpha-linux-nat.c: Revert.
	* alpha-bsd-tdep.c: Revert.
	* alpha-bsd-nat.c: Revert.
	* aix-thread.c: Revert.
	* agent.c: Revert.
	* addrmap.c: Revert.
	* ada-varobj.c: Revert.
	* ada-valprint.c: Revert.
	* ada-typeprint.c: Revert.
	* ada-tasks.c: Revert.
	* ada-lang.c: Revert.
	* aarch64-tdep.c: Revert.
	* aarch64-ravenscar-thread.c: Revert.
	* aarch64-newlib-tdep.c: Revert.
	* aarch64-linux-tdep.c: Revert.
	* aarch64-linux-nat.c: Revert.
	* aarch64-fbsd-tdep.c: Revert.
	* aarch64-fbsd-nat.c: Revert.
	* aarch32-linux-nat.c: Revert.
2019-04-06 13:47:34 -06:00
H.J. Lu 5b9c07b278 x86: Move x86-specific linker options to elf_linker_x86_params
Remove x86-specific linker options from bfd_link_info and put them in
elf_linker_x86_params.  Add _bfd_elf_linker_x86_set_options to pass
x86-specific linker options from ld to bfd.

bfd/

	* elf-linker-x86.h: New file.
	* elf32-i386.c (elf_i386_convert_load_reloc): Use htab->params
	to get x86-specific linker options.
	* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
	(elf_x86_64_check_relocs): Likewise.
	(elf_x86_64_relocate_section): Likewise.
	(elf_x86_64_link_setup_gnu_properties): Likewise.
	* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Likewise.
	(_bfd_x86_elf_link_setup_gnu_properties): Likewise.
	(_bfd_elf_linker_x86_set_options): New function.
	* elfxx-x86.h: Include "elf-linker-x86.h".
	(elf_x86_link_hash_table): Add params.

include/

	* bfdlink.h (bfd_link_info): Remove x86-specific linker options.

ld/

	* Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emultempl/elf-x86.em.
	(eelf_i386_sol2.c): Also depend on
	$(srcdir)/emultempl/solaris2-x86.em.
	(eelf_x86_64_sol2.c): Likewise.
	* Makefile.in: Regenerated.
	* emulparams/call_nop.sh: Set x86-specific linker options via
	params.
	* emulparams/cet.sh: Likewise.
	* emulparams/reloc_overflow.sh: Likewise.
	* emulparams/elf32_x86_64.sh (EXTRA_EM_FILE): New.  Set to
	"elf-x86".
	* emulparams/elf_i386.sh: Likewise.
	* emulparams/elf_i386_be.sh: Likewise.
	* emulparams/elf_i386_chaos.sh: Likewise.
	* emulparams/elf_i386_ldso.sh: Likewise.
	* emulparams/elf_i386_vxworks.sh: Likewise.
	* emulparams/elf_iamcu.sh: Likewise.
	* emulparams/elf_k1om.sh: Likewise.
	* emulparams/elf_l1om.sh: Likewise.
	* emulparams/elf_x86_64.sh: Likewise.
	* emulparams/elf_i386_sol2.sh (EXTRA_EM_FILE): Changed to
	"solaris2-x86".
	* emulparams/elf_x86_64_sol2.sh: Likewise.
	* emultempl/elf-x86.em: New file.
	* emultempl/solaris2-x86.em: Likewise.
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Don't
	set link_info.call_nop_byte.
2019-04-06 07:25:31 -07:00
Tom Tromey d55e5aa6b2 Sort includes for files gdb/[a-f]*.[chyl].
This patch sorts the include files for the files [a-f]*.[chyl].
The patch was written by a script.

Tested by the buildbot.

I will follow up with patches to sort the remaining files, by sorting
a subset, testing them, and then checking them in.

gdb/ChangeLog
2019-04-05  Tom Tromey  <tom@tromey.com>

	* ft32-tdep.c: Sort headers.
	* frv-tdep.c: Sort headers.
	* frv-linux-tdep.c: Sort headers.
	* frame.c: Sort headers.
	* frame-unwind.c: Sort headers.
	* frame-base.c: Sort headers.
	* fork-child.c: Sort headers.
	* findvar.c: Sort headers.
	* findcmd.c: Sort headers.
	* filesystem.c: Sort headers.
	* filename-seen-cache.h: Sort headers.
	* filename-seen-cache.c: Sort headers.
	* fbsd-tdep.c: Sort headers.
	* fbsd-nat.h: Sort headers.
	* fbsd-nat.c: Sort headers.
	* f-valprint.c: Sort headers.
	* f-typeprint.c: Sort headers.
	* f-lang.c: Sort headers.
	* extension.h: Sort headers.
	* extension.c: Sort headers.
	* extension-priv.h: Sort headers.
	* expprint.c: Sort headers.
	* exec.h: Sort headers.
	* exec.c: Sort headers.
	* exceptions.c: Sort headers.
	* event-top.c: Sort headers.
	* event-loop.c: Sort headers.
	* eval.c: Sort headers.
	* elfread.c: Sort headers.
	* dwarf2read.h: Sort headers.
	* dwarf2read.c: Sort headers.
	* dwarf2loc.c: Sort headers.
	* dwarf2expr.h: Sort headers.
	* dwarf2expr.c: Sort headers.
	* dwarf2-frame.c: Sort headers.
	* dwarf2-frame-tailcall.c: Sort headers.
	* dwarf-index-write.h: Sort headers.
	* dwarf-index-write.c: Sort headers.
	* dwarf-index-common.c: Sort headers.
	* dwarf-index-cache.h: Sort headers.
	* dwarf-index-cache.c: Sort headers.
	* dummy-frame.c: Sort headers.
	* dtrace-probe.c: Sort headers.
	* disasm.h: Sort headers.
	* disasm.c: Sort headers.
	* disasm-selftests.c: Sort headers.
	* dictionary.c: Sort headers.
	* dicos-tdep.c: Sort headers.
	* demangle.c: Sort headers.
	* dcache.h: Sort headers.
	* dcache.c: Sort headers.
	* darwin-nat.h: Sort headers.
	* darwin-nat.c: Sort headers.
	* darwin-nat-info.c: Sort headers.
	* d-valprint.c: Sort headers.
	* d-namespace.c: Sort headers.
	* d-lang.c: Sort headers.
	* ctf.c: Sort headers.
	* csky-tdep.c: Sort headers.
	* csky-linux-tdep.c: Sort headers.
	* cris-tdep.c: Sort headers.
	* cris-linux-tdep.c: Sort headers.
	* cp-valprint.c: Sort headers.
	* cp-support.c: Sort headers.
	* cp-namespace.c: Sort headers.
	* cp-abi.c: Sort headers.
	* corelow.c: Sort headers.
	* corefile.c: Sort headers.
	* continuations.c: Sort headers.
	* completer.h: Sort headers.
	* completer.c: Sort headers.
	* complaints.c: Sort headers.
	* coffread.c: Sort headers.
	* coff-pe-read.c: Sort headers.
	* cli-out.h: Sort headers.
	* cli-out.c: Sort headers.
	* charset.c: Sort headers.
	* c-varobj.c: Sort headers.
	* c-valprint.c: Sort headers.
	* c-typeprint.c: Sort headers.
	* c-lang.c: Sort headers.
	* buildsym.c: Sort headers.
	* buildsym-legacy.c: Sort headers.
	* build-id.h: Sort headers.
	* build-id.c: Sort headers.
	* btrace.c: Sort headers.
	* bsd-uthread.c: Sort headers.
	* breakpoint.h: Sort headers.
	* breakpoint.c: Sort headers.
	* break-catch-throw.c: Sort headers.
	* break-catch-syscall.c: Sort headers.
	* break-catch-sig.c: Sort headers.
	* blockframe.c: Sort headers.
	* block.c: Sort headers.
	* bfin-tdep.c: Sort headers.
	* bfin-linux-tdep.c: Sort headers.
	* bfd-target.c: Sort headers.
	* bcache.c: Sort headers.
	* ax-general.c: Sort headers.
	* ax-gdb.h: Sort headers.
	* ax-gdb.c: Sort headers.
	* avr-tdep.c: Sort headers.
	* auxv.c: Sort headers.
	* auto-load.c: Sort headers.
	* arm-wince-tdep.c: Sort headers.
	* arm-tdep.c: Sort headers.
	* arm-symbian-tdep.c: Sort headers.
	* arm-pikeos-tdep.c: Sort headers.
	* arm-obsd-tdep.c: Sort headers.
	* arm-nbsd-tdep.c: Sort headers.
	* arm-nbsd-nat.c: Sort headers.
	* arm-linux-tdep.c: Sort headers.
	* arm-linux-nat.c: Sort headers.
	* arm-fbsd-tdep.c: Sort headers.
	* arm-fbsd-nat.c: Sort headers.
	* arm-bsd-tdep.c: Sort headers.
	* arch-utils.c: Sort headers.
	* arc-tdep.c: Sort headers.
	* arc-newlib-tdep.c: Sort headers.
	* annotate.h: Sort headers.
	* annotate.c: Sort headers.
	* amd64-windows-tdep.c: Sort headers.
	* amd64-windows-nat.c: Sort headers.
	* amd64-tdep.c: Sort headers.
	* amd64-sol2-tdep.c: Sort headers.
	* amd64-obsd-tdep.c: Sort headers.
	* amd64-obsd-nat.c: Sort headers.
	* amd64-nbsd-tdep.c: Sort headers.
	* amd64-nbsd-nat.c: Sort headers.
	* amd64-nat.c: Sort headers.
	* amd64-linux-tdep.c: Sort headers.
	* amd64-linux-nat.c: Sort headers.
	* amd64-fbsd-tdep.c: Sort headers.
	* amd64-fbsd-nat.c: Sort headers.
	* amd64-dicos-tdep.c: Sort headers.
	* amd64-darwin-tdep.c: Sort headers.
	* amd64-bsd-nat.c: Sort headers.
	* alpha-tdep.c: Sort headers.
	* alpha-obsd-tdep.c: Sort headers.
	* alpha-nbsd-tdep.c: Sort headers.
	* alpha-mdebug-tdep.c: Sort headers.
	* alpha-linux-tdep.c: Sort headers.
	* alpha-linux-nat.c: Sort headers.
	* alpha-bsd-tdep.c: Sort headers.
	* alpha-bsd-nat.c: Sort headers.
	* aix-thread.c: Sort headers.
	* agent.c: Sort headers.
	* addrmap.c: Sort headers.
	* ada-varobj.c: Sort headers.
	* ada-valprint.c: Sort headers.
	* ada-typeprint.c: Sort headers.
	* ada-tasks.c: Sort headers.
	* ada-lang.c: Sort headers.
	* aarch64-tdep.c: Sort headers.
	* aarch64-ravenscar-thread.c: Sort headers.
	* aarch64-newlib-tdep.c: Sort headers.
	* aarch64-linux-tdep.c: Sort headers.
	* aarch64-linux-nat.c: Sort headers.
	* aarch64-fbsd-tdep.c: Sort headers.
	* aarch64-fbsd-nat.c: Sort headers.
	* aarch32-linux-nat.c: Sort headers.
2019-04-05 19:09:35 -06:00
GDB Administrator d128f9b8d4 Automatic date update in version.in 2019-04-06 00:00:13 +00:00
H.J. Lu 4ef40579f9 x86: Add assembler -mx86-used-note=yes test
Check assembler -mx86-used-note=yes option and readelf -n output.

	* testsuite/gas/i386/i386.exp: Run -mx86-used-note=yes tests.
	* testsuite/gas/i386/property-2.d: New file.
	* testsuite/gas/i386/property-2.s: Likewise.
	* testsuite/gas/i386/x86-64-property-2.d: Likewise.
2019-04-05 12:43:18 -07:00
Xuepeng Guo d6aab7a11b x86: Support Intel AVX512 BF16
Add assembler and disassembler support Intel AVX512 BF16:

https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

gas/

2019-04-05  Xuepeng Guo  <xuepeng.guo@intel.com>

	* config/tc-i386.c (cpu_arch): Add .avx512_bf16.
	(cpu_noarch): Add noavx512_bf16.
	* doc/c-i386.texi: Document avx512_bf16.
	* testsuite/gas/i386/avx512_bf16.d: New file.
	* testsuite/gas/i386/avx512_bf16.s: Likewise.
	* testsuite/gas/i386/avx512_bf16_vl-inval.l: Likewise.
	* testsuite/gas/i386/avx512_bf16_vl-inval.s: Likewise.
	* testsuite/gas/i386/avx512_bf16_vl.d: Likewise.
	* testsuite/gas/i386/avx512_bf16_vl.s: Likewise.
	* testsuite/gas/i386/x86-64-avx512_bf16.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512_bf16.s: Likewise.
	* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.l: Likesie.
	* testsuite/gas/i386/x86-64-avx512_bf16_vl-inval.s: Likewise.
	* testsuite/gas/i386/x86-64-avx512_bf16_vl.d: Likewise.
	* testsuite/gas/i386/x86-64-avx512_bf16_vl.s: Likewise.
	* testsuite/gas/i386/i386.exp: Add BF16 related tests.

opcodes/

2019-04-05  Xuepeng Guo  <xuepeng.guo@intel.com>

	* i386-dis-evex.h (evex_table): Updated to support BF16
	instructions.
	* i386-dis.c (enum): Add EVEX_W_0F3852_P_1, EVEX_W_0F3872_P_1
	and EVEX_W_0F3872_P_3.
	* i386-gen.c (cpu_flag_init): Add CPU_AVX512_BF16_FLAGS.
	(cpu_flags): Add bitfield for CpuAVX512_BF16.
	* i386-opc.h (enum): Add CpuAVX512_BF16.
	(i386_cpu_flags): Add bitfield for cpuavx512_bf16.
	* i386-opc.tbl: Add AVX512 BF16 instructions.
	* i386-init.h: Regenerated.
	* i386-tbl.h: Likewise.
2019-04-05 11:03:13 -07:00
Pedro Franco de Carvalho 0570503dd3 Use linux_get_auxv to get AT_PHDR in the PPC stub
This patch fixes a build error due to a call to ppc_get_auxv that was
left over after linux_get_hwcap and linux_get_hwcap2 were introduced
in:

974c89e088 gdbserver: Add
linux_get_hwcap

Because the missing call fetched AT_PHDR and not AT_HWCAP,
linux_get_auxv is now visible.

This use also required ppc_get_auxv to return a status variable
indicating that the AT_PHDR entry was not found separately from the
actual value of of the auxv entry.  Therefore, the new linux_get_auxv
function is changed to return a status variable and write the entry
value to a pointer passed as an argument.

Note that linux_get_hwcap and linux_get_hwcap2 still use the return
value as both an indicator of that the entry wasn't found and as the
actual value of the entry.

gdb/gdbserver/ChangeLog:
2019-04-05  Pedro Franco de Carvalho  <pedromfc@linux.ibm.com>

	* linux-low.c (linux_get_auxv): Remove static.  Return auxv entry
	value in argument pointer, return 1 if the entry is found and 0
	otherwise.  Move comment.
	(linux_get_hwcap, linux_get_hwcap2): Use modified linux_get_auxv.
	* linux-low.h (linux_get_auxv): Declare.
	* linux-ppc-low.c (is_elfv2_inferior): Use linux_get_auxv.
2019-04-05 14:19:08 -03:00
Tom Tromey 227a9e65b9 Use upper-case for metasyntactic in gdbserver help
I noticed that "gdbserver --help" contains a few metasyntactic
variables that aren't in upper-case.  This patch fixes them to conform
to the GNU standard.

gdb/gdbserver/ChangeLog
2019-04-05  Tom Tromey  <tromey@adacore.com>

	* server.c (gdbserver_usage): Use upper-case for metasyntactic
	variables.
2019-04-05 07:29:24 -06:00
Tom Tromey 699bd4cfa8 Move innermost_block_tracker global to parse_state
This changes the parsing API so that callers that are interested in
tracking the innermost block must instantiate an
innermost_block_tracker and pass it in.  Then, a pointer to this
object is stored in the parser_state.

2019-04-04  Tom Tromey  <tom@tromey.com>

	* varobj.c (varobj_create): Update.
	* rust-exp.y (struct rust_parser) <update_innermost_block,
	lookup_symbol>: New methods.
	(rust_parser::update_innermost_block, rust_parser::lookup_symbol):
	Rename.
	(rust_parser::rust_lookup_type)
	(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
	* printcmd.c (display_command, do_one_display): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add
	"tracker" parameter.
	(block_tracker): New member.
	(class innermost_block_tracker) <innermost_block_tracker>: Add
	"types" parameter.
	<reset>: Remove method.
	(innermost_block): Don't declare.
	(null_post_parser): Update.
	* parse.c (innermost_block): Remove global.
	(write_dollar_variable): Update.
	(parse_exp_1, parse_exp_in_context): Add "tracker" parameter.
	Remove "tracker_types" parameter.
	(parse_expression): Add "tracker" parameter.
	(parse_expression_for_completion): Update.
	(null_post_parser): Add "tracker" parameter.
	* p-exp.y: Update rules.
	* m2-exp.y: Update rules.
	* language.h (struct language_defn) <la_post_parser>: Add
	"tracker" parameter.
	* go-exp.y: Update rules.
	* f-exp.y: Update rules.
	* expression.h (parse_expression, parse_exp_1): Add "tracker"
	parameter.
	* d-exp.y: Update rules.
	* c-exp.y: Update rules.
	* breakpoint.c (set_breakpoint_condition): Create an
	innermost_block_tracker.
	(watch_command_1): Likewise.
	* ada-lang.c (resolve): Add "tracker" parameter.
	(resolve_subexp): Likewise.
	* ada-exp.y (write_var_from_sym): Update.
2019-04-04 19:55:11 -06:00
Tom Tromey dac43e327d Move type stack handling to a new class
This introduces a new "type_stack" class, and moves all the parser
type stack handling to this class.  Parsers that wish to use this
facility must now instantiate this class somehow.  I chose this
approach because a minority of the existing parsers require this.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* type-stack.h: New file.
	* type-stack.c: New file.
	* parser-defs.h (enum type_pieces, union type_stack_elt): Move to
	type-stack.h.
	(insert_into_type_stack, insert_type, push_type, push_type_int)
	(insert_type_address_space, pop_type, pop_type_int)
	(pop_typelist, pop_type_stack, append_type_stack)
	(push_type_stack, get_type_stack, push_typelist)
	(follow_type_instance_flags, follow_types): Don't declare.
	* parse.c (type_stack): Remove global.
	(parse_exp_in_context): Update.
	(insert_into_type_stack, insert_type, push_type, push_type_int)
	(insert_type_address_space, pop_type, pop_type_int)
	(pop_typelist, pop_type_stack, append_type_stack)
	(push_type_stack, get_type_stack, push_typelist)
	(follow_type_instance_flags, follow_types): Remove (moved to
	type-stack.c).
	* f-exp.y (type_stack): New global.
	Update rules.
	(push_kind_type, f_parse): Update.
	* d-exp.y (type_stack): New global.
	Update rules.
	(d_parse): Update.
	* c-exp.y (struct c_parse_state) <type_stack>: New member.
	Update rules.
	* Makefile.in (COMMON_SFILES): Add type-stack.c.
	(HFILES_NO_SRCDIR): Add type-stack.h.
2019-04-04 19:55:11 -06:00
Tom Tromey 2a61252965 Move completion parsing to parser_state
This moves the globals and functions related to parsing for completion
to parser_state.  A new structure is introduced in order to return
completion results from the parse back to
parse_expression_for_completion.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rust_parser::lex_identifier, rustyylex)
	(rust_parser::convert_ast_to_expression, rust_parse)
	(rust_lex_test_completion, rust_lex_tests): Update.
	* parser-defs.h (struct expr_completion_state): New.
	(struct parser_state) <parser_state>: Add completion parameter.
	<mark_struct_expression, mark_completion_tag>: New methods.
	<parse_completion, m_completion_state>: New members.
	(prefixify_expression, null_post_parser): Update.
	(mark_struct_expression, mark_completion_tag): Don't declare.
	* parse.c (parse_completion, expout_last_struct)
	(expout_tag_completion_type, expout_completion_name): Remove
	globals.
	(parser_state::mark_struct_expression)
	(parser_state::mark_completion_tag): Now methods.
	(prefixify_expression): Add last_struct parameter.
	(prefixify_subexp): Likewise.
	(parse_exp_1): Update.
	(parse_exp_in_context): Add cstate parameter.  Update.
	(parse_expression_for_completion): Create an
	expr_completion_state.
	(null_post_parser): Add "completion" parameter.
	* p-exp.y: Update rules.
	(yylex): Update.
	* language.h (struct language_defn) <la_post_parser>: Add
	"completing" parameter.
	* go-exp.y: Update rules.
	(lex_one_token): Update.
	* expression.h (parse_completion): Don't declare.
	* d-exp.y: Update rules.
	(lex_one_token): Update rules.
	* c-exp.y: Update rules.
	(lex_one_token): Update.
	* ada-lang.c (resolve): Add "parse_completion" parameter.
	(resolve_subexp): Likewise.
	(ada_resolve_function): Likewise.
2019-04-04 19:55:11 -06:00
Tom Tromey 43476f0b1b Move arglist_len et al to parser_state
This moves arglist_len, start_arglist, and end_arglist to
parser_state.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* parser-defs.h (struct parser_state) <start_arglist,
	end_arglist>: New methods.
	<arglist_len, m_funcall_chain>: New members.
	(arglist_len, start_arglist, end_arglist): Don't declare.
	* parse.c (arglist_len, funcall_chain): Remove global.
	(start_arglist, end_arglist): Remove functions.
	(parse_exp_in_context): Update.
	* p-exp.y: Update rules.
	* m2-exp.y: Update rules.
	* go-exp.y: Update rules.
	* f-exp.y: Update rules.
	* d-exp.y: Update rules.
	* c-exp.y: Update rules.
2019-04-04 19:55:11 -06:00
Tom Tromey 5776fca307 Move lexptr and prev_lexptr to parser_state
This removes the lexptr and prev_lexptr globals, in favor of members
of parser_state.  prev_lexptr could be isolated to each parser, but
since every parser uses it, that did not seem necessary.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (struct rust_parser) <lex_hex, lex_escape,
	lex_operator, push_back>: New methods.
	Update all rules.
	(rust_parser::lex_hex, lex_escape): Rename and update.
	(rust_parser::lex_string, rust_parser::lex_identifier): Update.
	(rust_parser::lex_operator): Rename and update.
	(rust_parser::lex_number, rustyylex, rustyyerror)
	(rust_lex_test_init, rust_lex_test_sequence)
	(rust_lex_test_push_back, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add "input"
	parameter.
	<lexptr, prev_lexptr>: New members.
	(lexptr, prev_lexptr): Don't declare.
	* parse.c (lexptr, prev_lexptr): Remove globals.
	(parse_exp_in_context): Update.
	* p-exp.y (yylex, yyerror): Update.
	* m2-exp.y (parse_number, yylex, yyerror): Update.
	* go-exp.y (lex_one_token, yyerror): Update.
	* f-exp.y (match_string_literal, yylex, yyerror): Update.
	* d-exp.y (lex_one_token, yyerror): Update.
	* c-exp.y (scan_macro_expansion, finished_macro_expansion)
	(lex_one_token, yyerror): Update.
	* ada-lex.l (YY_INPUT): Update.
	(rewind_to_char): Update.
	* ada-exp.y (yyerror): Update.
2019-04-04 19:55:11 -06:00
Tom Tromey 8621b685bf Move comma_terminates global to parser_state
This moves the comma_terminates global to parser_state.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rustyylex, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add new
	parameter.
	<comma_terminates>: New member.
	(comma_terminates): Don't declare global.
	* parse.c (comma_terminates): Remove global.
	(parse_exp_in_context): Update.
	* p-exp.y (yylex): Update.
	* m2-exp.y (yylex): Update.
	* go-exp.y (lex_one_token): Update.
	* f-exp.y (yylex): Update.
	* d-exp.y (lex_one_token): Update.
	* c-exp.y (lex_one_token): Update.
	* ada-lex.l: Update.
2019-04-04 19:55:11 -06:00
Tom Tromey 28aaf3fdf9 Remove paren_depth global
This removes the "paren_depth" global.  In most cases, it is made into
a static global in a given parser.  I consider this a slight
improvement, because it makes it clear that the variable isn't used
for communication between different modules of gdb.  The one exception
is the Rust parser, which already incorporates all local state into a
transient object; in this case the parser depth is now a member.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (struct rust_parser) <paren_depth>: New member.
	(rustyylex, rust_lex_test_init, rust_lex_test_one)
	(rust_lex_test_sequence, rust_lex_test_push_back): Update.
	* parser-defs.h (paren_depth): Don't declare.
	* parse.c (paren_depth): Remove global.
	(parse_exp_in_context): Update.
	* p-exp.y (paren_depth): New global.
	(pascal_parse): Initialize it.
	* m2-exp.y (paren_depth): New global.
	(m2_parse): Initialize it.
	* go-exp.y (paren_depth): New global.
	(go_parse): Initialize it.
	* f-exp.y (paren_depth): New global.
	(f_parse): Initialize it.
	* d-exp.y (paren_depth): New global.
	(d_parse): Initialize it.
	* c-exp.y (paren_depth): New global.
	(c_parse): Initialize it.
	* ada-lex.l (paren_depth): New global.
	(lexer_init): Initialize it.
2019-04-04 19:55:10 -06:00
Tom Tromey 1e58a4a4db Move expression_context_* globals to parser_state
This moves the expression_context_block and expression_context_pc
globals to be members of parser_state and updates the parsers.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y (rust_parser::crate_name, rust_parser::super_name)
	(rust_parser::convert_ast_to_type)
	(rust_parser::convert_ast_to_expression, rust_lex_tests): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Add
	parameters.  Initialize new members.
	<expression_context_block, expression_context_pc>: New members.
	* parse.c (expression_context_block, expression_context_pc):
	Remove globals.
	(parse_exp_in_context): Update.
	* p-exp.y: Update all rules.
	(yylex): Update.
	* m2-exp.y: Update all rules.
	(yylex): Update.
	* go-exp.y (yylex): Update.
	* f-exp.y (yylex): Update.
	* d-exp.y: Update all rules.
	(yylex): Update.
	* c-exp.y: Update all rules.
	(lex_one_token, classify_name, yylex, c_parse): Update.
	* ada-exp.y (write_var_or_type, write_name_assoc): Update.
2019-04-04 19:55:10 -06:00
Tom Tromey 37eedb3982 Make base class for parser_state
This makes a new base class, expr_builder, for parser_state.  This
separates the state needed to construct an expression from the state
needed by the parsers.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* gdbarch.h, gdbarch.c: Rebuild.
	* gdbarch.sh (dtrace_parse_probe_argument): Change type.
	* stap-probe.h:
	(struct stap_parse_info): Replace "parser_state" with
	"expr_builder".
	* parser-defs.h (struct expr_builder): Rename from "parser_state".
	(parser_state): New class.
	* parse.c (expr_builder): Rename.
	(expr_builder::release): Rename.
	(write_exp_elt, write_exp_elt_opcode, write_exp_elt_sym)
	(write_exp_elt_msym, write_exp_elt_block, write_exp_elt_objfile)
	(write_exp_elt_longcst, write_exp_elt_floatcst)
	(write_exp_elt_type, write_exp_elt_intern, write_exp_string)
	(write_exp_string_vector, write_exp_bitstring)
	(write_exp_msymbol, mark_struct_expression)
	(write_dollar_variable)
	(insert_type_address_space, increase_expout_size): Replace
	"parser_state" with "expr_builder".
	* dtrace-probe.c: Replace "parser_state" with "expr_builder".
	* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Replace
	"parser_state" with "expr_builder".
2019-04-04 19:55:10 -06:00
Tom Tromey 73923d7eed Turn parse_language into a method
This changes parse_language into a method of parser_state.  This patch
was written by a script.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y: Replace "parse_language" with method call.
	* p-exp.y:
	(yylex): Replace "parse_language" with method call.
	* m2-exp.y:
	(yylex): Replace "parse_language" with method call.
	* go-exp.y (classify_name): Replace "parse_language" with method
	call.
	* f-exp.y (yylex): Replace "parse_language" with method call.
	* d-exp.y (lex_one_token): Replace "parse_language" with method
	call.
	* c-exp.y:
	(lex_one_token, classify_name, yylex): Replace "parse_language"
	with method call.
	* ada-exp.y (find_primitive_type, type_char)
	(type_system_address): Replace "parse_language" with method call.
2019-04-04 19:55:10 -06:00
Tom Tromey fa9f5be683 Turn parse_gdbarch into a method
This changes parse_gdbarch into a method of parser_state.  This patch
was written by a script.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* rust-exp.y: Replace "parse_gdbarch" with method call.
	* parse.c (write_dollar_variable, insert_type_address_space):
	Replace "parse_gdbarch" with method call.
	* p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method
	call.
	* objc-lang.c (end_msglist): Replace "parse_gdbarch" with method
	call.
	* m2-exp.y (parse_type, parse_m2_type, yylex): Replace
	"parse_gdbarch" with method call.
	* go-exp.y (parse_type, classify_name): Replace "parse_gdbarch"
	with method call.
	* f-exp.y (parse_type, parse_f_type, yylex): Replace
	"parse_gdbarch" with method call.
	* d-exp.y (parse_type, parse_d_type, lex_one_token): Replace
	"parse_gdbarch" with method call.
	* c-exp.y (parse_type, parse_number, classify_name): Replace
	"parse_gdbarch" with method call.
	* ada-lex.l: Replace "parse_gdbarch" with method call.
	* ada-exp.y (parse_type, find_primitive_type, type_char)
	(type_system_address): Replace "parse_gdbarch" with method call.
2019-04-04 19:55:10 -06:00
Tom Tromey 1201a264c8 Remove parser_state "initial_size" parameter
All the real (not test) uses of parser_state pass 10 as the
"initial_size" parameter, and it seems to me that there's no real
reason to require callers to set this.  This patch removes this
parameter.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
	* stap-probe.c (stap_parse_argument): Update.
	* stap-probe.h (struct stap_parse_info) <stap_parse_info>: Remove
	initial_size parameter.
	* rust-exp.y (rust_lex_tests): Update.
	* parse.c (parser_state): Update.
	(parse_exp_in_context): Update.
	* parser-defs.h (struct parser_state) <parser_state>: Remove
	"initial_size" parameter.
2019-04-04 19:55:10 -06:00
Tom Tromey e3980ce2a9 Make increase_expout_size static
increase_expout_size is only called from parse.c, and probably only
should be.  This makes it "static".  Tested by rebuilding.

gdb/ChangeLog
2019-04-04  Tom Tromey  <tom@tromey.com>

	* parser-defs.h (increase_expout_size): Don't declare.
	* parse.c (increase_expout_size): Now static.
2019-04-04 19:55:10 -06:00
Alan Modra bec858ea4d PowerPC conditional branch test
Adds a new test checking conditional branch BO values.

	* testsuite/gas/ppc/bc.s,
	* testsuite/gas/ppc/bcat.d,
	* testsuite/gas/ppc/bcaterr.d,
	* testsuite/gas/ppc/bcaterr.l,
	* testsuite/gas/ppc/bcy.d,
	* testsuite/gas/ppc/bcyerr.d,
	* testsuite/gas/ppc/bcyerr.l: New tests.
	* testsuite/gas/ppc/ppc.exp: Run them.
2019-04-05 12:20:49 +10:30
Alan Modra 66e8546085 PowerPC bc extended branch mnemonics and "y" hints
This patch fixes a problem with disassembly of branch instructions
for processors complying with PowerPC ISA versions prior to version
2.0, ie. those that use "y" bit branch taken hints.  Many of the
extended bcctr and bclr mnemonics that should have disassembled with a
"-" suffix, ie. not taken, did not display the "-" due to the ordering
in powerpc_opcodes.  I believe it's been that way from the original
85dcf36d72 commit of ppc-opc.c.

I've also added a BH field (optional) to a few opcodes.  This gives
better disassembly in raw mode, showing the branch taken hint in the
mnemonic as is done for bc.  It would be reasonable to add a BH
field to all bcctr, bclr, and bctar extended mnemonics but that runs
into a small difficulty:  Currently we print all or none of the
optional operands.  That means for example that "bgectr cr2" would
display as "bgectr cr2,0" if a BH field is added to bgectr.

	* ppc-opc.c (XLBH_MASK): Subtract off BH field from BB_MASK.
	(powerpc_opcodes): Reorder bcctr and bclr extended mnemonics
	to favour printing of "-" branch hint when using the "y" bit.
	Allow BH field on bc{ctr,lr,tar}{,l}{-,+}.
2019-04-05 12:20:49 +10:30
Alan Modra c2b1c27545 PowerPC disassembler: Don't emit trailing spaces
When an instruction has operands, the PowerPC disassembler prints
spaces after the opcode so as to line up operands.  If the operands
are all optional and all default value, then no operands are printed,
leaving trailing spaces.  This patch fixes that.

opcodes/
	* ppc-dis.c (print_insn_powerpc): Delay printing spaces after
	opcode until first operand is output.
gas/
	* testsuite/gas/ppc/476.d: Remove trailing spaces.
	* testsuite/gas/ppc/a2.d: Likewise.
	* testsuite/gas/ppc/booke.d: Likewise.
	* testsuite/gas/ppc/booke_xcoff.d: Likewise.
	* testsuite/gas/ppc/e500.d: Likewise.
	* testsuite/gas/ppc/e500mc.d: Likewise.
	* testsuite/gas/ppc/e6500.d: Likewise.
	* testsuite/gas/ppc/htm.d: Likewise.
	* testsuite/gas/ppc/power6.d: Likewise.
	* testsuite/gas/ppc/power8.d: Likewise.
	* testsuite/gas/ppc/power9.d: Likewise.
	* testsuite/gas/ppc/vle.d: Likewise.
ld/
	* testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces.
	* testsuite/ld-powerpc/tlsopt5.d: Likewise.
	* testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
2019-04-05 12:20:49 +10:30
GDB Administrator 82477cd28a Automatic date update in version.in 2019-04-05 00:00:21 +00:00
Peter Bergner aae9718e4d Add extended mnemonics for bctar. Fix setting of 'at' branch hints.
opcodes/
	PR gas/24349
	* ppc-opc.c (valid_bo_pre_v2): Add comments.
	(valid_bo_post_v2): Add support for 'at' branch hints.
	(insert_bo): Only error on branch on ctr.
	(get_bo_hint_mask): New function.
	(insert_boe): Add new 'branch_taken' formal argument.  Add support
	for inserting 'at' branch hints.
	(extract_boe): Add new 'branch_taken' formal argument.  Add support
	for extracting 'at' branch hints.
	(insert_bom, extract_bom, insert_bop, extract_bop): New functions.
	(BOE): Delete operand.
	(BOM, BOP): New operands.
	(RM): Update value.
	(XLYLK, XLYLK_MASK, XLYBB_MASK): Delete.
	(powerpc_opcodes) <bc-, bcl-, bca-, bcla-, bclr-, bclrl-, bcctr-,
	bcctrl-, bctar-, bctarl->: Replace BOE with BOM.
	(powerpc_opcodes) <bc+, bcl+, bca+, bcla+, bclr+, bclrl+, bcctr+,
	bcctrl+, bctar+, bctarl+>: Replace BOE with BOP.
	<bdnztar, bdnztarl, bdztar, bdztarl, btar, btarl, bdnztar-, bdnztarl-,
	bdnztar+, bdnztarl+, bdztar-, bdztarl-, bdztar+, bdztarl+, bgetar,
	bnltar, bgetarl, bnltarl, bletar, bngtar, bletarl, bngtarl, bnetar,
	bnetarl, bnstar, bnutar, bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-,
	bnltarl-, bletar-, bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-,
	bnstar-, bnutar-, bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+,
	bnltarl+, bletar+, bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+,
	bnstar+, bnutar+, bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl,
	beqtar, beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
	bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
	buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
	bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
	bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
	bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
	bttarl+>: New extended mnemonics.

gas/
	PR gas/24349
	* testsuite/gas/ppc/power8.s: (bdnztar, bdnztarl, bdztar, bdztarl,
	btar, btarl, bdnztar-, bdnztarl-, bdnztar+, bdnztarl+, bdztar-,
	bdztarl-, bdztar+, bdztarl+, bgetar, bnltar, bgetarl, bnltarl,
	bletar, bngtar, bletarl, bngtarl, bnetar, bnetarl, bnstar, bnutar,
	bnstarl, bnutarl, bgetar-, bnltar-, bgetarl-, bnltarl-, bletar-,
	bngtar-, bletarl-, bngtarl-, bnetar-, bnetarl-, bnstar-, bnutar-,
	bnstarl-, bnutarl-, bgetar+, bnltar+, bgetarl+, bnltarl+, bletar+,
	bngtar+, bletarl+, bngtarl+, bnetar+, bnetarl+, bnstar+, bnutar+,
	bnstarl+, bnutarl+, blttar, blttarl, bgttar, bgttarl, beqtar,
	beqtarl, bsotar, buntar, bsotarl, buntarl, blttar-, blttarl-,
	bgttar-, bgttarl-, beqtar-, beqtarl-, bsotar-, buntar-, bsotarl-,
	buntarl-, blttar+, blttarl+, bgttar+, bgttarl+, beqtar+, beqtarl+,
	bsotar+, buntar+, bsotarl+, buntarl+, bdnzftar, bdnzftarl, bdzftar,
	bdzftarl, bftar, bftarl, bftar-, bftarl-, bftar+, bftarl+, bdnzttar,
	bdnzttarl, bdzttar, bdzttarl, bttar, bttarl, bttar-, bttarl-, bttar+,
	bttarl+): Add tests of extended mnemonics.
	* testsuite/gas/ppc/power8.d: Likewise.  Update previous bctar tests
	to expect new extended mnemonics.
	* testsuite/gas/ppc/a2.s: <bc, bc-, bc+, bcl, bcl-, bcl+>: Update test
	to not use illegal BO value.  Use a more convenient BI value.
	* testsuite/gas/ppc/a2.d: Update tests for new expect output.
2019-04-04 09:00:29 -05:00
Thomas Schwinge e9f8e3f109 [GDB, Hurd] Fix build; 'target_waitstatus_to_string' call
Recent commit c29705b71a removed an incomplete
local implementation in favor of 'target_waitstatus_to_string' (thanks!), but
introduced a small typing error:

    In file included from [...]/gdb/gnu-nat.c:24:0:
    [...]/gdb/gnu-nat.c: In member function 'virtual ptid_t gnu_nat_target::wait(ptid_t, target_waitstatus*, int)':
    [...]/gdb/gnu-nat.c:1652:43: error: cannot convert 'target_waitstatus**' to 'const target_waitstatus*' for argument '1' to 'std::__cxx11::string target_waitstatus_to_string(const target_waitstatus*)'
           target_waitstatus_to_string (&status).c_str ());
                                               ^
    [...]/gdb/gnu-nat.h:119:32: note: in definition of macro 'debug'
            __FILE__ , __LINE__ , ##args); } while (0)
                                    ^~~~
    [...]/gdb/gnu-nat.c:1650:3: note: in expansion of macro 'inf_debug'
       inf_debug (inf, "returning ptid = %s, %s",
       ^~~~~~~~~

	gdb/
	* gnu-nat.c (gnu_nat_target::wait): Fix
	target_waitstatus_to_string call.
2019-04-04 11:20:12 +02:00
GDB Administrator e691a46f7d Automatic date update in version.in 2019-04-04 00:00:15 +00:00
Max Filippov 403b0b61f6 gas: use literals/const16 for xtensa loop relaxation
Loop opcode relaxation that uses addi/addmi doesn't work well with other
relaxations that may cause code movement. Instead of encoding fixed loop
end offset in the relaxed sequence use l32r or a pair of const16 to load
loop end address. This way the address of the loop end gets a relocation
record and it gets updated appropriately.

gas/
2019-04-03  Max Filippov  <jcmvbkbc@gmail.com>

	* config/tc-xtensa.c (convert_frag_immed): Drop
	convert_frag_immed_finish_loop invocation.
	(convert_frag_immed_finish_loop): Drop declaration and
	definition.
	* config/xtensa-relax.c (widen_spec_list): Replace loop
	widening that uses addi/addmi with widening that uses l32r
	and const16.
2019-04-03 10:24:15 -07:00
Alan Modra 1c6aafe894 PR24411, Division is not accepted in MEMORY length expression
Let's hope no one has section names starting with '/' in scripts.  If
they do, this change to fix parsing of '/' in expressiongs will break
their project.

	PR 24411
	ldlex.l (SYMBOLNAMECHAR1): Don't match '/'.
	(<EXPRESSION>"/DISCARD/"): New.
2019-04-03 13:01:49 +10:30
Alan Modra 092da96ac4 ldlex.l tidy
Underscore was specified twice in all these patterns, and backslash
twice in some.  Flex warned about the $SYSROOT rule, which is covered
by earlier rules:  "ldlex.l:386: warning, rule cannot be matched".

	* ldlex.l: Formatting.
	(CMDFILENAMECHAR, CMDFILENAMECHAR1): Delete.
	(FILENAMECHAR1, SYMBOLNAMECHAR1, FILENAMECHAR, WILDCHAR),
	(NOCFILENAMECHAR): Remove duplicate chars.  Reorder.
	(SYMBOLCHARN): Likewise.  Rename to SYMBOLNAMECHAR.
	(<INPUTLIST>"$SYSROOT"..): Delete rule.
2019-04-03 13:01:32 +10:30
Alan Modra 4b24dd1aca BFD whitespace fixes
* coff-i386.c, * coff-x86_64.c, * coffgen.c, * dwarf2.c,
	* elf-m10200.c, * elf.c, * elf32-arm.c, * elf32-bfin.c,
	* elf32-csky.c, * elf32-m32r.c, * elf32-microblaze.c, * elf32-pru.c,
	* elf32-rx.c, * elf32-xgate.c, * elf64-sparc.c, * elfnn-ia64.c,
	* elfxx-riscv.c, * elfxx-sparc.c, * linker.c, * mach-o.c,
	* pe-x86_64.c, * pei-x86_64.c, * plugin.c: Whitespace fixes.
2019-04-03 12:50:39 +10:30
GDB Administrator 49149495da Automatic date update in version.in 2019-04-03 00:00:14 +00:00
Jim Wilson 87f98bacb7 RISC-V: Don't check ABI flags if no code section.
This fixes a glib build failure reported in PR 24389.  Using ld -b binary
creates an object file with no elf header flags set which has the wrong ABI
info for riscv64-linux.  But the file also has no code sections, so I added
code borrowed from the arm port that only checks the ELF header ABI flags if
there is a code section.

	bfd/
	PR 24389
	* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of
	ELF header flags to after check for ELF object file.  Loop through
	sections looking for code sections, if none, then skip ABI checks.
2019-04-02 13:30:07 -07:00
GDB Administrator 4c7c79dd98 Automatic date update in version.in 2019-04-02 00:00:43 +00:00
Andrew Burgess d7df654955 gdb/fortran: Handle internal function calls
If an convenience function is defined in python (or guile), then
currently this will not work in Fortran, instead the user is given
this message:

  (gdb) set language fortran
  (gdb) p $myfunc (3)
  Cannot perform substring on this type

Compare this to C:

  (gdb) set language c
  (gdb) p $myfunc (3)
  $1 = 1

After this patch we see the same behaviour in both C and Fortran.
I've extended the test to check that all languages can call the
convenience functions - only Fortran was broken.

When calling convenience functions in Fortran we don't need to perform
the same value preparation (passing by pointer) that we would for
calling a native function - passing the real value is fine.

gdb/ChangeLog:

	* eval.c (evaluate_subexp_standard): Handle internal functions
	during Fortran function call handling.

gdb/testsuite/ChangeLog:

	* gdb.python/py-function.exp: Check calling helper function from
	all languages.
	* lib/gdb.exp (gdb_supported_languages): New proc.
2019-04-01 21:41:51 +01:00
Andrew Burgess 8bdc16587e gdb: Add $_cimag and $_creal internal functions
Add two new internal functions $_cimag and $_creal that extract the
imaginary and real parts of a complex value.

These internal functions can take a complex value of any type 'float
complex', 'double complex', or 'long double complex' and return a
suitable floating point value 'float', 'double', or 'long double'.
So we can now do this:

    (gdb) p z1
    $1 = 1.5 + 4.5 * I
    (gdb) p $_cimag (z1)
    $4 = 4.5
    (gdb) p $_creal (z1)
    $4 = 1.5

The components of a complex value are not strictly named types in
DWARF, as the complex type is itself the base type.  However, once we
are able to extract the components it makes sense to be able to ask
what the type of these components is and get a sensible answer back,
rather than the error we would currently get.  Currently GDB says:

    (gdb) ptype z1
    type = complex double
    (gdb) p $_cimag (z1)
    $4 = 4.5
    (gdb) ptype $
    type = <invalid type code 9>

With the changes in dwarf2read.c, GDB now says:

    (gdb) ptype z1
    type = complex double
    (gdb) p $_cimag (z1)
    $4 = 4.5
    (gdb) ptype $
    type = double

Which seems to make more sense.

gdb/ChangeLog:

	* NEWS: Mention new internal functions.
	* dwarf2read.c (dwarf2_init_complex_target_type): New function.
	(read_base_type): Use dwarf2_init_complex_target_type.
	* value.c (creal_internal_fn): New function.
	(cimag_internal_fn): New function.
	(_initialize_values): Register new internal functions.

gdb/doc/ChangeLog:

	* gdb.texinfo (Convenience Funs): Document '$_creal' and
	'$_cimag'.

gdb/testsuite/ChangeLog:

	* gdb.base/complex-parts.c: New file.
	* gdb.base/complex-parts.exp: New file.
2019-04-01 21:41:49 +01:00
Philippe Waroquiers c29705b71a Fix internal error and improve 'set debug infrun 1'/target wait kind trace
The test  gdb.threads/watchthreads-reorder.exp verifies that the
'set debug infrun 1' debug output does not crash GDB.

Under high load, the test can still cause a GDB internal error (see details
below).

This patch fixes this crash, and improves/factorises some wait kind traces.

Tested on debian/amd64 + run one test with 'set debug infrun 1'.

Changes compared to the first version:
  * Handles the suggestions of Kevin to trace the relevant elements
    of the wait status (this is done by calling target_waitstatus_to_string).
  * Some other changes to factorise wait status tracing.

Note that using target_waitstatus_to_string instead of the 'locally printed'
status kind strings means that debug trace that was using strings such as:
   "EXITED" or "TARGET_WAITKIND_EXITED"
will now use what is printed by target_waitstatus_to_string e.g.
   "exited".

gdb/ChangeLog
2019-04-01  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* infrun.c (stop_all_threads): If debug_infrun, always
	trace the wait status after wait_one, using
	target_waitstatus_to_string and target_pid_to_str.
	(handle_inferior_event): Replace various trace of
	wait status kind by a single trace.
	* gdb/gnu-nat.c (gnu_nat_target::wait): Replace local
	wait status kind image by target_waitstatus_to_string.
	* target/waitstatus.c (target_waitstatus_to_string): Fix
	obsolete comment.

  (top-gdb) bt
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
  #1  0x00007f3d54a0642a in __GI_abort () at abort.c:89
  #2  0x0000555c24c60e66 in dump_core () at ../../fixleaks/gdb/utils.c:201
  #3  0x0000555c24c63d49 in internal_vproblem(internal_problem *, const char *, int, const char *, typedef __va_list_tag __va_list_tag *) (problem=problem@entry=0x555c25338d40 <internal_error_problem>, file=<optimized out>, line=287,
      fmt=<optimized out>, ap=<optimized out>) at ../../fixleaks/gdb/utils.c:411
  #4  0x0000555c24c63eab in internal_verror (file=<optimized out>, line=<optimized out>, fmt=<optimized out>,
      ap=<optimized out>) at ../../fixleaks/gdb/utils.c:436
  #5  0x0000555c249e8c22 in internal_error (file=file@entry=0x555c24e0f2ad "../../fixleaks/gdb/inferior.c",
      line=line@entry=287, fmt=<optimized out>) at ../../fixleaks/gdb/common/errors.c:55
  #6  0x0000555c247d3f5c in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:287
  #7  0x0000555c24ad2248 in find_inferior_pid (pid=<optimized out>) at ../../fixleaks/gdb/inferior.c:302
  #8  find_inferior_ptid (ptid=...) at ../../fixleaks/gdb/inferior.c:301
  #9  0x0000555c24c35f25 in find_thread_ptid (ptid=...) at ../../fixleaks/gdb/thread.c:522
  #10 0x0000555c24b0ab4d in thread_db_target::pid_to_str[abi:cxx11](ptid_t) (
      this=0x555c2532e3e0 <the_thread_db_target>, ptid=...) at ../../fixleaks/gdb/linux-thread-db.c:1637
  #11 0x0000555c24c2f420 in target_pid_to_str[abi:cxx11](ptid_t) (ptid=...) at ../../fixleaks/gdb/target.c:2083
  #12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373
  #13 0x0000555c24ada00f in stop_waiting (ecs=<optimized out>) at ../../fixleaks/gdb/infrun.c:7464
  #14 0x0000555c24adc401 in process_event_stop_test (ecs=ecs@entry=0x7ffc9402d9d0) at ../../fixleaks/gdb/infrun.c:6181
  ...
  (top-gdb) fr 12
  #12 0x0000555c24ad9cab in stop_all_threads () at ../../fixleaks/gdb/infrun.c:4373
  (top-gdb) p event_ptid
  $5 = {m_pid = 25419, m_lwp = 25427, m_tid = 0}
  (top-gdb) p ptid
  $6 = {m_pid = 0, m_lwp = 0, m_tid = 0}
  (top-gdb) p ws
  $7 = {kind = TARGET_WAITKIND_THREAD_EXITED, value = {integer = 0, sig = GDB_SIGNAL_0, related_pid = {m_pid = 0,
        m_lwp = 0, m_tid = 0}, execd_pathname = 0x0, syscall_number = 0}}
  (top-gdb)

The gdb.log corresponding to the above crash is:
  (gdb) PASS: gdb.threads/watchthreads-reorder.exp: reorder1: set debug infrun 1
  continue
  Continuing.
  infrun: clear_proceed_status_thread (Thread 0x7ffff7fcfb40 (LWP 25419))
  infrun: clear_proceed_status_thread (Thread 0x7ffff7310700 (LWP 25427))
  infrun: clear_proceed_status_thread (Thread 0x7ffff6b0f700 (LWP 25428))
  infrun: proceed (addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT)
  infrun: proceed: resuming Thread 0x7ffff7fcfb40 (LWP 25419)
  infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7fcfb40 (LWP 25419)] at 0x7ffff7344317
  infrun: infrun_async(1)
  infrun: prepare_to_wait
  infrun: proceed: resuming Thread 0x7ffff7310700 (LWP 25427)
  infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff7310700 (LWP 25427)] at 0x5555555553d7
  infrun: prepare_to_wait
  infrun: proceed: resuming Thread 0x7ffff6b0f700 (LWP 25428)
  infrun: resume (step=0, signal=GDB_SIGNAL_0), trap_expected=0, current thread [Thread 0x7ffff6b0f700 (LWP 25428)] at 0x5555555554c8
  infrun: prepare_to_wait
  infrun: target_wait (-1.0.0, status) =
  infrun:   -1.0.0 [process -1],
  infrun:   status->kind = ignore
  infrun: TARGET_WAITKIND_IGNORE
  infrun: prepare_to_wait
  Joining the threads.
  [Thread 0x7ffff6b0f700 (LWP 25428) exited]
  infrun: target_wait (-1.0.0, status) =
  infrun:   -1.0.0 [process -1],
  infrun:   status->kind = ignore
  infrun: TARGET_WAITKIND_IGNORE
  infrun: prepare_to_wait
  infrun: target_wait (-1.0.0, status) =
  infrun:   25419.25419.0 [Thread 0x7ffff7fcfb40 (LWP 25419)],
  infrun:   status->kind = stopped, signal = GDB_SIGNAL_TRAP
  infrun: TARGET_WAITKIND_STOPPED
  infrun: stop_pc = 0x555555555e50
  infrun: context switch
  infrun: Switching context from Thread 0x7ffff6b0f700 (LWP 25428) to Thread 0x7ffff7fcfb40 (LWP 25419)
  infrun: BPSTAT_WHAT_STOP_NOISY
  infrun: stop_waiting
  infrun: stop_all_threads
  infrun: stop_all_threads, pass=0, iterations=0
  infrun:   Thread 0x7ffff7fcfb40 (LWP 25419) not executing
  infrun:   Thread 0x7ffff7310700 (LWP 25427) executing, need stop
  [Thread 0x7ffff7310700 (LWP 25427) exited]
  infrun: target_wait (-1.0.0, status) =
  infrun:   25419.25427.0 [LWP 25427],
  infrun:   status->kind = thread exited, status = 0
  infrun: infrun_async(0)
  ../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n) FAIL: gdb.threads/watchthreads-reorder.exp: reorder1: continue to breakpoint: break-at-exit (GDB internal error)
  Resyncing due to internal error.
  n
  infrun: infrun_async(1)

  This is a bug, please report it.  For instructions, see:
  <http://www.gnu.org/software/gdb/bugs/>.

  infrun: infrun_async(0)
  ../../fixleaks/gdb/inferior.c:287: internal-error: inferior* find_inferior_pid(int): Assertion `pid != 0' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Create a core file of GDB? (y or n) y
2019-04-01 20:51:59 +02:00
Tom Tromey 05caa1d236 Handle DW_AT_ranges when reading partial symtabs
add_partial_subprogram does not handle DW_AT_ranges, while the full
symtab reader does.  This can lead to discrepancies where a function
is not put into a partial symtab, and so is not available to "break"
and the like -- but is available if the full symtab has somehow been
read.

This patch fixes the bug by arranging to read DW_AT_ranges when
reading partial DIEs.

This is PR symtab/23331.

The new test case is derived from dw2-ranges-func.exp, which is why I
kept the copyright dates.

gdb/ChangeLog
2019-04-01  Tom Tromey  <tromey@adacore.com>

	PR symtab/23331:
	* dwarf2read.c (partial_die_info::read): Handle DW_AT_ranges.

gdb/testsuite/ChangeLog
2019-04-01  Tom Tromey  <tromey@adacore.com>

	PR symtab/23331:
	* gdb.dwarf2/dw2-ranges-main.c: New file.
	* gdb.dwarf2/dw2-ranges-psym.c: New file.
	* gdb.dwarf2/dw2-ranges-psym.exp: New file.
2019-04-01 10:36:58 -06:00