Commit Graph

28 Commits

Author SHA1 Message Date
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
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
Joel Brobecker 42a4f53d2b Update copyright year range in all GDB files.
This commit applies all changes made after running the gdb/copyright.py
script.

Note that one file was flagged by the script, due to an invalid
copyright header
(gdb/unittests/basic_string_view/element_access/char/empty.cc).
As the file was copied from GCC's libstdc++-v3 testsuite, this commit
leaves this file untouched for the time being; a patch to fix the header
was sent to gcc-patches first.

gdb/ChangeLog:

	Update copyright year range in all GDB files.
2019-01-01 10:01:51 +04:00
Pedro Alves 6b1747cd13 invoke_xmethod & array_view
This replaces more pointer+length with gdb::array_view.  This time,
around invoke_xmethod, and then propagating the fallout around, which
inevitably leaks to the overload resolution code.

There are several places in the code that want to grab a slice of an
array, by advancing the array pointer, and decreasing the length
pointer.  This patch introduces a pair of new
gdb::array_view::slice(...) methods to make that convenient and clear.
Unit test included.

gdb/ChangeLog:
2018-11-21  Pedro Alves  <palves@redhat.com>

	* common/array-view.h (array_view::splice(size_type, size_t)): New.
	(array_view::splice(size_type)): New.
	* eval.c (eval_call, evaluate_funcall): Adjust to use array_view.
	* extension.c (xmethod_worker::get_arg_types): Adjust to return an
	std::vector.
	(xmethod_worker::get_result_type): Adjust to use gdb::array_view.
	* extension.h: Include "common/array-view.h".
	(xmethod_worker::invoke): Adjust to use gdb::array_view.
	(xmethod_worker::get_arg_types): Adjust to return an std::vector.
	(xmethod_worker::get_result_type): Adjust to use gdb::array_view.
	(xmethod_worker::do_get_arg_types): Adjust to use std::vector.
	(xmethod_worker::do_get_result_type): Adjust to use
	gdb::array_view.
	* gdbtypes.c (rank_function): Adjust to use gdb::array_view.
	* gdbtypes.h: Include "common/array-view.h".
	(rank_function): Adjust to use gdb::array_view.
	* python/py-xmethods.c (python_xmethod_worker::invoke)
	(python_xmethod_worker::do_get_arg_types)
	(python_xmethod_worker::do_get_result_type)
	(python_xmethod_worker::invoke): Adjust to new interfaces.
	* valarith.c (value_user_defined_cpp_op, value_user_defined_op)
	(value_x_binop, value_x_unop): Adjust to use gdb::array_view.
	* valops.c (find_overload_match, find_oload_champ_namespace)
	(find_oload_champ_namespace_loop, find_oload_champ): Adjust to use
	gdb:array_view and the new xmethod_worker interfaces.
	* value.c (result_type_of_xmethod, call_xmethod): Adjust to use
	gdb::array_view.
	* value.h (find_overload_match, result_type_of_xmethod)
	(call_xmethod): Adjust to use gdb::array_view.
	* unittests/array-view-selftests.c: Add slicing tests.
2018-11-21 12:06:20 +00:00
Tom Tromey c819b2c0b2 C++-ify typedef hash
This changes the typedef_hash_table structure to be a C++ class.  It
adds constructors and destructors and changes some functions to be
methods of the class.  Then it changes the various users of this class
to adapt.  This allows for the removal of some cleanups.

Regression tested by the buildbot.

gdb/ChangeLog
2018-03-27  Tom Tromey  <tom@tromey.com>

	* typeprint.h (struct type_print_options) <local_typedefs,
	global_typedefs>: Remove "struct" keyword.
	(class typedef_hash_table): New class.
	(recursively_update_typedef_hash, add_template_parameters)
	(create_typedef_hash, free_typedef_hash, copy_typedef_hash)
	(find_typedef_in_hash): Don't declare.
	* typeprint.c (struct typedef_hash_table): Move to typeprint.h.
	(typedef_hash_table::recursively_update): Rename from
	recursively_update_typedef_hash.  Now a member.
	(typedef_hash_table::add_template_parameters): Rename from
	add_template_parameters.  Now a member.
	(typedef_hash_table::typedef_hash_table): Now a constructor;
	rename from create_typedef_hash.
	(typedef_hash_table::~typedef_hash_table): Now a destructor;
	rename from free_typedef_hash.
	(do_free_typedef_hash, make_cleanup_free_typedef_hash)
	(do_free_global_table): Remove.
	(typedef_hash_table::typedef_hash_table): New constructor; renamed
	from copy_type_recursive.
	(create_global_typedef_table): Remove.
	(typedef_hash_table::find_global_typedef): Now a member of
	typedef_hash_table.
	(typedef_hash_table::find_typedef): Rename from
	find_typedef_in_hash; now a member.
	(whatis_exp): Update.
	* extension.h (struct ext_lang_type_printers): Add constructor and
	destructor.
	(start_ext_lang_type_printers, free_ext_lang_type_printers): Don't
	declare.
	* extension.c (ext_lang_type_printers::ext_lang_type_printers):
	Now a constructor; rename from start_ext_lang_type_printers.
	(ext_lang_type_printers): Now a destructor; rename from
	free_ext_lang_type_printers.
	* c-typeprint.c (find_typedef_for_canonicalize, c_print_type_1):
	Update.
	(c_type_print_base_struct_union): Update.  Remove cleanups.
2018-03-27 10:09:25 -06:00
Tom Tromey 76727919ce Convert observers to C++
This converts observers from using a special source-generating script
to be plain C++.  This version of the patch takes advantage of C++11
by using std::function and variadic templates; incorporates Pedro's
patches; and renames the header file to "observable.h" (this change
eliminates the need for a clean rebuild).

Note that Pedro's patches used a template lambda in tui-hooks.c, but
this failed to compile on some buildbot instances (presumably due to
differing C++ versions); I replaced this with an ordinary template
function.

Regression tested on the buildbot.

gdb/ChangeLog
2018-03-19  Pedro Alves  <palves@redhat.com>
	    Tom Tromey  <tom@tromey.com>

	* unittests/observable-selftests.c: New file.
	* common/observable.h: New file.
	* observable.h: New file.
	* ada-lang.c, ada-tasks.c, agent.c, aix-thread.c, annotate.c,
	arm-tdep.c, auto-load.c, auxv.c, break-catch-syscall.c,
	breakpoint.c, bsd-uthread.c, cli/cli-interp.c, cli/cli-setshow.c,
	corefile.c, dummy-frame.c, event-loop.c, event-top.c, exec.c,
	extension.c, frame.c, gdbarch.c, guile/scm-breakpoint.c,
	infcall.c, infcmd.c, inferior.c, inflow.c, infrun.c, jit.c,
	linux-tdep.c, linux-thread-db.c, m68klinux-tdep.c,
	mi/mi-cmd-break.c, mi/mi-interp.c, mi/mi-main.c, objfiles.c,
	ppc-linux-nat.c, ppc-linux-tdep.c, printcmd.c, procfs.c,
	python/py-breakpoint.c, python/py-finishbreakpoint.c,
	python/py-inferior.c, python/py-unwind.c, ravenscar-thread.c,
	record-btrace.c, record-full.c, record.c, regcache.c, remote.c,
	riscv-tdep.c, sol-thread.c, solib-aix.c, solib-spu.c, solib.c,
	spu-multiarch.c, spu-tdep.c, stack.c, symfile-mem.c, symfile.c,
	symtab.c, thread.c, top.c, tracepoint.c, tui/tui-hooks.c,
	tui/tui-interp.c, valops.c: Update all users.
	* tui/tui-hooks.c (tui_bp_created_observer)
	(tui_bp_deleted_observer, tui_bp_modified_observer)
	(tui_inferior_exit_observer, tui_before_prompt_observer)
	(tui_normal_stop_observer, tui_register_changed_observer):
	Remove.
	(tui_observers_token): New global.
	(attach_or_detach, tui_attach_detach_observers): New functions.
	(tui_install_hooks, tui_remove_hooks): Use
	tui_attach_detach_observers.
	* record-btrace.c (record_btrace_thread_observer): Remove.
	(record_btrace_thread_observer_token): New global.
	* observer.sh: Remove.
	* observer.c: Rename to observable.c.
	* observable.c (namespace gdb_observers): Define new objects.
	(observer_debug): Move into gdb_observers namespace.
	(struct observer, struct observer_list, xalloc_observer_list_node)
	(xfree_observer_list_node, generic_observer_attach)
	(generic_observer_detach, generic_observer_notify): Remove.
	(_initialize_observer): Update.
	Don't include observer.inc.
	* Makefile.in (generated_files): Remove observer.h, observer.inc.
	(clean mostlyclean): Likewise.
	(observer.h, observer.inc): Remove targets.
	(SUBDIR_UNITTESTS_SRCS): Add observable-selftests.c.
	(COMMON_SFILES): Use observable.c, not observer.c.
	* .gitignore: Remove observer.h.

gdb/doc/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

	* observer.texi: Remove.

gdb/testsuite/ChangeLog
2018-03-19  Tom Tromey  <tom@tromey.com>

	* gdb.gdb/observer.exp: Remove.
2018-03-19 09:37:49 -06:00
Tom Tromey d4dd32824a Change frame_filter_flags to use DEF_ENUM_FLAGS_TYPE
This changes frame_filter_flags to use DEF_ENUM_FLAGS_TYPE, and
updates all the uses.  It also changes the enum constants to use <<,
as suggested by Sergio.

ChangeLog
2018-02-26  Tom Tromey  <tom@tromey.com>

	* stack.c (backtrace_command_1): Update.
	* python/python-internal.h (gdbpy_apply_frame_filter): Change type
	of "flags".
	* python/py-framefilter.c (py_print_frame)
	(gdbpy_apply_frame_filter): Change type of "flags".
	* mi/mi-cmd-stack.c (mi_apply_ext_lang_frame_filter): Change type
	of "flags".
	(mi_cmd_stack_list_frames, mi_cmd_stack_list_locals)
	(mi_cmd_stack_list_args, mi_cmd_stack_list_variables): Update.
	* extension.h (enum frame_filter_flag): Rename from
	frame_filter_flags.
	(frame_filter_flags): Define using DEF_ENUM_FLAGS_TYPE.
	(apply_ext_lang_frame_filter): Change type of "flags".
	* extension.c (apply_ext_lang_frame_filter): Change type of
	"flags".
	* extension-priv.h (struct extension_language_ops)
	<apply_frame_filter>: Change type of "flags".
2018-02-26 09:37:03 -07:00
Simon Marchi ba18742c3a C++ify xmethod_worker, get rid of VEC(xmethod_worker_ptr)
The initial goal of this patch was to remove the usage of
VEC(xmethod_worker_ptr) and corresponding cleanups.  I ended up having
to  C++ify the xmethod_worker code, to be able to have xmethod_workers
free their data in destructors, and therefore be able to use vectors of
xmethod_worker unique_ptr.

The operations in extension_language_ops that act on one instance of
xmethod_worker (get result type, get args type, invoke) are transformed
to methods of xmethod_worker.  xmethod_worker becomes an abstract base
class with virtual pure methods which python_xmethod_worker implements.
The only xmethod-related operation left in extension_language_ops is
get_matching_xmethod_workers, which returns a list of xmethod_workers.

The changes are relatively straightforward, but here are some notes on
things that may raise eyebrows:

  - I was not really comfortable with the value_of_xmethod function.  At
  first it looks like a simple getter, so I considered making it a
  method of xmethod_worker.  But actually it creates a value and
  transfers the ownership of the xmethod_worker to it.  It would be a
  bit weird and error-prone if calling a method on an object silently
  removed the ownership of the object from the caller.  To reflect the
  behavior more accurately, I renamed it to value_from_xmethod and made
  it accept an rvalue-reference (so the caller knows it gives away the
  ownership).  I noticed the backlink from xmethod_worker to its owning
  value was not used, so I removed it.

  - Some code, like get_matching_xmethod_workers, made each callee fill
  a new vector, which was then merged in the result vector.  I think
  it's safe if we always pass the same vector around, and each
  implementation just appends to it.

  - The clone operation does not seem particularly useful, it is removed
  in the following patch.

gdb/ChangeLog:

	* extension-priv.h (enum ext_lang_rc): Remove, move to extension.h.
	(struct extension_language_ops) <clone_xmethod_worker_data>: Remove.
	<free_xmethod_worker_data>: Remove.
	<get_matching_xmethod_workers>: Chance VEC to std::vector.
	<get_xmethod_arg_types>: Remove.
	<get_xmethod_result_type>: Remove.
	<invoke_xmethod>: Remove.
	* extension.c (new_xmethod_worker): Remove.
	(clone_xmethod_worker): Remove.
	(get_matching_xmethod_workers): Return void, pass std::vector by
	pointer.
	(get_xmethod_arg_types): Rename to...
	(xmethod_worker::get_arg_types): ... this, and adjust.
	(get_xmethod_result_type): Rename to...
	(xmethod_worker::get_result_type): ... this, and adjust.
	(invoke_xmethod): Remove.
	(free_xmethod_worker): Remove.
	(free_xmethod_worker_vec): Remove.
	* extension.h (enum ext_lang_rc): Move here from
	extension-priv.h.
	(struct xmethod_worker): Add constructor and destructor.
	<data>: Remove.
	<value>: Remove.
	<invoke, clone, do_get_result_type, do_get_arg_types>: New
	virtual pure methods.
	<get_arg_types, get_result_type>: New methods.
	(xmethod_worker_ptr): Remove typedef.
	(DEF_VEC_P (xmethod_worker_ptr)): Remove.
	(xmethod_worker_vec): Remove typedef.
	(xmethod_worker_up): New typedef.
	(invoke_xmethod): Remove.
	(clone_xmethod_worker): Remove.
	(free_xmethod_worker): Remove.
	(free_xmethod_worker_vec): Remove.
	(get_xmethod_arg_types): Remove.
	(get_xmethod_result_type): Remove.
	* valops.c (find_method_list): Use std::vector, don't use
	intermediate vector.
	(value_find_oload_method_list): Use std::vector.
	(find_overload_match): Use std::vector.
	(find_oload_champ): Use std::vector.
	* value.c (value_free): Use operator delete.
	(value_of_xmethod): Rename to...
	(value_from_xmethod): ... this.  Don't assign
	xmethod_worker::value, take rvalue-reference.
	(result_type_of_xmethod): Adjust.
	(call_xmethod): Adjust.
	* value.h: Include extension.h.
	(struct xmethod_worker): Don't forward-declare.
	(value_of_xmethod): Rename to...
	(value_from_xmethod): ... this, take rvalue-reference.
	* python/py-xmethods.c (struct gdbpy_worker_data): Rename to...
	(struct python_xmethod_worker): ... this, add constructor and
	destructor.
	<invoke, clone, do_get_arg_types, do_get_result_type>: Implement.
	(gdbpy_free_xmethod_worker_data): Rename to...
	(python_xmethod_worker::~python_xmethod_worker): ... this and
	adjust.
	(gdbpy_clone_xmethod_worker_data): Rename to...
	(python_xmethod_worker::clone): ... this and adjust.
	(gdbpy_get_matching_xmethod_workers): Use std::vector, don't use
	temporary vector.
	(gdbpy_get_xmethod_arg_types): Rename to...
	(python_xmethod_worker::do_get_arg_types): ... this and adjust.
	(gdbpy_get_xmethod_result_type): Rename to...
	(python_xmethod_worker::do_get_result_type): ... this and
	adjust.
	(gdbpy_invoke_xmethod): Rename to...
	(python_xmethod_worker::invoke): ... this and adjust.
	(new_python_xmethod_worker): Rename to...
	(python_xmethod_worker::python_xmethod_worker): ... this and
	adjust.
	* python/python-internal.h (gdbpy_clone_xmethod_worker_data):
	Remove.
	(gdbpy_free_xmethod_worker_data): Remove.
	(gdbpy_get_matching_xmethod_workers): Use std::vector.
	(gdbpy_get_xmethod_arg_types): Remove.
	(gdbpy_get_xmethod_result_type): Remove.
	(gdbpy_invoke_xmethod): Remove.
	* python/python.c (python_extension_ops): Remove obsolete
	callbacks.
2018-01-07 09:25:32 -05:00
Joel Brobecker e2882c8578 Update copyright year range in all GDB files
gdb/ChangeLog:

        Update copyright year range in all GDB files
2018-01-02 07:38:06 +04:00
Tom Tromey 223ffa714c Remove make_cleanup_restore_target_terminal
This removes make_cleanup_restore_target_terminal and generally
C++-ifies target terminal handling.  It changes all target_terminal_*
functions to be static members of a new target_terminal class and
changes the cleanup to be a scoped_* class.
make_cleanup_override_quit_handler is also removed in favor of simply
using scoped_restore.

Note that there are some files in this patch that I could not compile.
Considering that some of the rewrites were automated, and that none of
these files involed cleanups, I feel that this is relatively safe.

Regression tested by the buildbot.

gdb/ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* windows-nat.c (get_windows_debug_event, windows_wait)
	(do_initial_windows_stuff, windows_attach): Update.
	* utils.c (vwarning, internal_vproblem): Update.
	(ui_unregister_input_event_handler_cleanup)
	(prepare_to_handle_input): Remove.
	(class scoped_input_handler): New.
	(defaulted_query, prompt_for_continue): Update.
	* tui/tui-hooks.c (tui_refresh_frame_and_register_information):
	Update.
	* top.c (undo_terminal_modifications_before_exit): Update.
	* target/target.h (target_terminal_init, target_terminal_inferior)
	(target_terminal_ours): Don't declare.
	(class target_terminal): New.
	* target.h (target_terminal_is_inferior, target_terminal_is_ours)
	(target_terminal_ours_for_output)
	(make_cleanup_restore_target_terminal): Don't declare.
	(target_terminal_info): Remove.
	* target.c (enum terminal_state, terminal_state): Remove.
	(target_terminal::terminal_state): Define.
	(target_terminal::init): Rename from target_terminal_init.
	(target_terminal::inferior): Rename from
	target_terminal_inferior.
	(target_terminal::ours): Rename from target_terminal_ours.
	(target_terminal::ours_for_output): Rename from
	target_terminal_ours_for_output.
	(target_terminal::info): New method.
	(cleanup_restore_target_terminal)
	(make_cleanup_restore_target_terminal): Remove.
	* solib.c (handle_solib_event): Update.
	* remote.c (remote_serial_quit_handler): Update.
	(remote_terminal_inferior, remote_wait_as): Update.
	* record-full.c (record_full_wait_1): Update.
	* nto-procfs.c (procfs_create_inferior): Update.
	* nat/fork-inferior.c (startup_inferior): Update.
	* mi/mi-interp.c (mi_new_thread, mi_thread_exit)
	(mi_record_changed, mi_inferior_added, mi_inferior_appeared)
	(mi_inferior_exit, mi_inferior_removed, mi_traceframe_changed)
	(mi_tsv_created, mi_tsv_deleted, mi_tsv_modified)
	(mi_breakpoint_created, mi_breakpoint_deleted)
	(mi_breakpoint_modified, mi_on_resume, mi_solib_loaded)
	(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
	(mi_user_selected_context_changed, report_initial_inferior):
	Update.
	* linux-nat.c (linux_nat_attach, linux_nat_terminal_ours)
	(linux_nat_terminal_inferior): Update.
	* infrun.c (follow_fork_inferior)
	(handle_vfork_child_exec_or_exit, do_target_resume)
	(check_curr_ui_sync_execution_done, handle_inferior_event_1)
	(handle_signal_stop, maybe_remove_breakpoints, normal_stop):
	Update.
	* inflow.c (child_terminal_init, info_terminal_command): Update.
	* infcmd.c (post_create_inferior, continue_1, prepare_one_step)
	(attach_command): Update.
	* infcall.c (call_thread_fsm_should_stop): Update.
	* gnu-nat.c (gnu_attach): Update.
	* extension.c (struct active_ext_lang_state)
	(restore_active_ext_lang): Update.
	* exceptions.c (print_flush): Update.
	* event-top.c (async_enable_stdin, default_quit_handler): Update.
	(struct quit_handler_cleanup_data, restore_quit_handler)
	(restore_quit_handler_dtor, make_cleanup_override_quit_handler):
	Remove.
	* cp-support.c (gdb_demangle): Update.
	* breakpoint.c (update_inserted_breakpoint_locations)
	(insert_breakpoint_locations, handle_jit_event)
	(disable_breakpoints_in_unloaded_shlib): Update.
	* annotate.c (annotate_breakpoints_invalid)
	(annotate_frames_invalid): Update.

gdb/gdbserver/ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* target.c (target_terminal::terminal_state): Define.
	(target_terminal::init): Rename from target_terminal_init.
	(target_terminal::inferior): Rename from
	target_terminal_inferior.
	(target_terminal::ours): Rename from target_terminal_ours.
	(target_terminal::ours_for_output, target_terminal::info): New.
2017-09-20 16:09:50 -06:00
John Baldwin 481695ed5f Remove unnecessary function prototypes.
These prototypes were required when compiling GDB as C but are not
required for C++.

gdb/ChangeLog:

	* aarch64-linux-nat.c: Remove _initialize_aarch64_linux_nat
	prototype.
	* aarch64-linux-tdep.c: Remove _initialize_aarch64_linux_tdep
	prototype.
	* aarch64-newlib-tdep.c: Remove _initialize_aarch64_newlib_tdep
	prototype.
	* aarch64-tdep.c: Remove _initialize_aarch64_tdep prototype.
	* ada-exp.y: Remove _initialize_ada_exp prototype.
	* ada-lang.c: Remove _initialize_ada_language prototype.
	* ada-tasks.c: Remove _initialize_tasks prototype.
	* addrmap.c: Remove _initialize_addrmap prototype.
	* agent.c: Remove _initialize_agent prototype.
	* aix-thread.c: Remove _initialize_aix_thread prototype.
	* alpha-bsd-nat.c: Remove _initialize_alphabsd_nat prototype.
	* alpha-linux-nat.c: Remove _initialize_alpha_linux_nat prototype.
	* alpha-linux-tdep.c: Remove _initialize_alpha_linux_tdep
	prototype.
	* alpha-nbsd-tdep.c: Remove _initialize_alphanbsd_tdep prototype.
	* alpha-obsd-tdep.c: Remove _initialize_alphaobsd_tdep prototype.
	* alpha-tdep.c: Remove _initialize_alpha_tdep prototype.
	* amd64-darwin-tdep.c: Remove _initialize_amd64_darwin_tdep
	prototype.
	* amd64-dicos-tdep.c: Remove _initialize_amd64_dicos_tdep
	prototype.
	* amd64-fbsd-nat.c: Remove _initialize_amd64fbsd_nat prototype.
	* amd64-fbsd-tdep.c: Remove _initialize_amd64fbsd_tdep prototype.
	* amd64-linux-nat.c: Remove _initialize_amd64_linux_nat prototype.
	* amd64-linux-tdep.c: Remove _initialize_amd64_linux_tdep
	prototype.
	* amd64-nbsd-nat.c: Remove _initialize_amd64nbsd_nat prototype.
	* amd64-nbsd-tdep.c: Remove _initialize_amd64nbsd_tdep prototype.
	* amd64-obsd-nat.c: Remove _initialize_amd64obsd_nat prototype.
	* amd64-obsd-tdep.c: Remove _initialize_amd64obsd_tdep prototype.
	* amd64-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* amd64-tdep.c: Remove _initialize_amd64_tdep prototype.
	* amd64-windows-nat.c: Remove _initialize_amd64_windows_nat
	prototype.
	* amd64-windows-tdep.c: Remove _initialize_amd64_windows_tdep
	prototype.
	* annotate.c: Remove _initialize_annotate prototype.
	* arc-newlib-tdep.c: Remove _initialize_arc_newlib_tdep prototype.
	* arc-tdep.c: Remove _initialize_arc_tdep prototype.
	* arch-utils.c: Remove _initialize_gdbarch_utils prototype.
	* arm-linux-nat.c: Remove _initialize_arm_linux_nat prototype.
	* arm-linux-tdep.c: Remove _initialize_arm_linux_tdep prototype.
	* arm-nbsd-tdep.c: Remove _initialize_arm_netbsd_tdep prototype.
	* arm-obsd-tdep.c: Remove _initialize_armobsd_tdep prototype.
	* arm-symbian-tdep.c: Remove _initialize_arm_symbian_tdep
	prototype.
	* arm-tdep.c: Remove _initialize_arm_tdep prototype.
	* arm-wince-tdep.c: Remove _initialize_arm_wince_tdep prototype.
	* auto-load.c: Remove _initialize_auto_load prototype.
	* auxv.c: Remove _initialize_auxv prototype.
	* avr-tdep.c: Remove _initialize_avr_tdep prototype.
	* ax-gdb.c: Remove _initialize_ax_gdb prototype.
	* bfin-linux-tdep.c: Remove _initialize_bfin_linux_tdep prototype.
	* bfin-tdep.c: Remove _initialize_bfin_tdep prototype.
	* break-catch-sig.c: Remove _initialize_break_catch_sig prototype.
	* break-catch-syscall.c: Remove _initialize_break_catch_syscall
	prototype.
	* break-catch-throw.c: Remove _initialize_break_catch_throw
	prototype.
	* breakpoint.c: Remove _initialize_breakpoint prototype.
	* bsd-uthread.c: Remove _initialize_bsd_uthread prototype.
	* btrace.c: Remove _initialize_btrace prototype.
	* charset.c: Remove _initialize_charset prototype.
	* cli/cli-cmds.c: Remove _initialize_cli_cmds prototype.
	* cli/cli-dump.c: Remove _initialize_cli_dump prototype.
	* cli/cli-interp.c: Remove _initialize_cli_interp prototype.
	* cli/cli-logging.c: Remove _initialize_cli_logging prototype.
	* cli/cli-script.c: Remove _initialize_cli_script prototype.
	* coff-pe-read.c: Remove _initialize_coff_pe_read prototype.
	* coffread.c: Remove _initialize_coffread prototype.
	* compile/compile.c: Remove _initialize_compile prototype.
	* complaints.c: Remove _initialize_complaints prototype.
	* completer.c: Remove _initialize_completer prototype.
	* copying.awk: Remove _initialize_copying prototype.
	* copying.c: Regenerate.
	* core-regset.c: Remove _initialize_core_regset prototype.
	* corefile.c: Remove _initialize_core prototype.
	* corelow.c: Remove _initialize_corelow prototype.
	* cp-abi.c: Remove _initialize_cp_abi prototype.
	* cp-namespace.c: Remove _initialize_cp_namespace prototype.
	* cp-support.c: Remove _initialize_cp_support prototype.
	* cp-valprint.c: Remove _initialize_cp_valprint prototype.
	* cris-linux-tdep.c: Remove _initialize_cris_linux_tdep prototype.
	* cris-tdep.c: Remove _initialize_cris_tdep prototype.
	* ctf.c: Remove _initialize_ctf prototype.
	* d-lang.c: Remove _initialize_d_language prototype.
	* darwin-nat-info.c: Remove _initialize_darwin_info_commands
	prototype.
	* darwin-nat.c: Remove _initialize_darwin_inferior prototype.
	* dbxread.c: Remove _initialize_dbxread prototype.
	* dcache.c: Remove _initialize_dcache prototype.
	* demangle.c: Remove _initialize_demangler prototype.
	* disasm-selftests.c: Remove _initialize_disasm_selftests
	prototype.
	* disasm.c: Remove _initialize_disasm prototype.
	* dtrace-probe.c: Remove _initialize_dtrace_probe prototype.
	* dummy-frame.c: Remove _initialize_dummy_frame prototype.
	* dwarf2-frame-tailcall.c: Remove _initialize_tailcall_frame
	prototype.
	* dwarf2-frame.c: Remove _initialize_dwarf2_frame prototype.
	* dwarf2expr.c: Remove _initialize_dwarf2expr prototype.
	* dwarf2loc.c: Remove _initialize_dwarf2loc prototype.
	* dwarf2read.c: Remove _initialize_dwarf2_read prototype.
	* elfread.c: Remove _initialize_elfread prototype.
	* exec.c: Remove _initialize_exec prototype.
	* extension.c: Remove _initialize_extension prototype.
	* f-lang.c: Remove _initialize_f_language prototype.
	* f-valprint.c: Remove _initialize_f_valprint prototype.
	* fbsd-nat.c: Remove _initialize_fbsd_nat prototype.
	* fbsd-tdep.c: Remove _initialize_fbsd_tdep prototype.
	* filesystem.c: Remove _initialize_filesystem prototype.
	* findcmd.c: Remove _initialize_mem_search prototype.
	* fork-child.c: Remove _initialize_fork_child prototype.
	* frame-base.c: Remove _initialize_frame_base prototype.
	* frame-unwind.c: Remove _initialize_frame_unwind prototype.
	* frame.c: Remove _initialize_frame prototype.
	* frv-linux-tdep.c: Remove _initialize_frv_linux_tdep prototype.
	* frv-tdep.c: Remove _initialize_frv_tdep prototype.
	* ft32-tdep.c: Remove _initialize_ft32_tdep prototype.
	* gcore.c: Remove _initialize_gcore prototype.
	* gdb_bfd.c: Remove _initialize_gdb_bfd prototype.
	* gdbarch.c: Regenerate.
	* gdbarch.sh: Remove _initialize_gdbarch prototype.
	* gdbtypes.c: Remove _initialize_gdbtypes prototype.
	* gnu-nat.c: Remove _initialize_gnu_nat prototype.
	* gnu-v2-abi.c: Remove _initialize_gnu_v2_abi prototype.
	* gnu-v3-abi.c: Remove _initialize_gnu_v3_abi prototype.
	* go-lang.c: Remove _initialize_go_language prototype.
	* go32-nat.c: Remove _initialize_go32_nat prototype.
	* guile/guile.c: Remove _initialize_guile prototype.
	* h8300-tdep.c: Remove _initialize_h8300_tdep prototype.
	* hppa-linux-nat.c: Remove _initialize_hppa_linux_nat prototype.
	* hppa-linux-tdep.c: Remove _initialize_hppa_linux_tdep prototype.
	* hppa-nbsd-nat.c: Remove _initialize_hppanbsd_nat prototype.
	* hppa-nbsd-tdep.c: Remove _initialize_hppanbsd_tdep prototype.
	* hppa-obsd-nat.c: Remove _initialize_hppaobsd_nat prototype.
	* hppa-obsd-tdep.c: Remove _initialize_hppaobsd_tdep prototype.
	* hppa-tdep.c: Remove _initialize_hppa_tdep prototype.
	* i386-bsd-nat.c: Remove _initialize_i386bsd_nat prototype.
	* i386-cygwin-tdep.c: Remove _initialize_i386_cygwin_tdep
	prototype.
	* i386-darwin-tdep.c: Remove _initialize_i386_darwin_tdep
	prototype.
	* i386-dicos-tdep.c: Remove _initialize_i386_dicos_tdep prototype.
	* i386-fbsd-nat.c: Remove _initialize_i386fbsd_nat prototype.
	* i386-fbsd-tdep.c: Remove _initialize_i386fbsd_tdep prototype.
	* i386-gnu-nat.c: Remove _initialize_i386gnu_nat prototype.
	* i386-gnu-tdep.c: Remove _initialize_i386gnu_tdep prototype.
	* i386-linux-nat.c: Remove _initialize_i386_linux_nat prototype.
	* i386-linux-tdep.c: Remove _initialize_i386_linux_tdep prototype.
	* i386-nbsd-nat.c: Remove _initialize_i386nbsd_nat prototype.
	* i386-nbsd-tdep.c: Remove _initialize_i386nbsd_tdep prototype.
	* i386-nto-tdep.c: Remove _initialize_i386nto_tdep prototype.
	* i386-obsd-nat.c: Remove _initialize_i386obsd_nat prototype.
	* i386-obsd-tdep.c: Remove _initialize_i386obsd_tdep prototype.
	* i386-sol2-nat.c: Remove _initialize_amd64_sol2_nat prototype.
	* i386-sol2-tdep.c: Remove _initialize_amd64_sol2_tdep prototype.
	* i386-tdep.c: Remove _initialize_i386_tdep prototype.
	* i386-windows-nat.c: Remove _initialize_i386_windows_nat
	prototype.
	* ia64-libunwind-tdep.c: Remove _initialize_libunwind_frame
	prototype.
	* ia64-linux-nat.c: Remove _initialize_ia64_linux_nat prototype.
	* ia64-linux-tdep.c: Remove _initialize_ia64_linux_tdep prototype.
	* ia64-tdep.c: Remove _initialize_ia64_tdep prototype.
	* ia64-vms-tdep.c: Remove _initialize_ia64_vms_tdep prototype.
	* infcall.c: Remove _initialize_infcall prototype.
	* infcmd.c: Remove _initialize_infcmd prototype.
	* inferior.c: Remove _initialize_inferiors prototype.
	* inflow.c: Remove _initialize_inflow prototype.
	* infrun.c: Remove _initialize_infrun prototype.
	* interps.c: Remove _initialize_interpreter prototype.
	* iq2000-tdep.c: Remove _initialize_iq2000_tdep prototype.
	* jit.c: Remove _initialize_jit prototype.
	* language.c: Remove _initialize_language prototype.
	* linux-fork.c: Remove _initialize_linux_fork prototype.
	* linux-nat.c: Remove _initialize_linux_nat prototype.
	* linux-tdep.c: Remove _initialize_linux_tdep prototype.
	* linux-thread-db.c: Remove _initialize_thread_db prototype.
	* lm32-tdep.c: Remove _initialize_lm32_tdep prototype.
	* m2-lang.c: Remove _initialize_m2_language prototype.
	* m32c-tdep.c: Remove _initialize_m32c_tdep prototype.
	* m32r-linux-nat.c: Remove _initialize_m32r_linux_nat prototype.
	* m32r-linux-tdep.c: Remove _initialize_m32r_linux_tdep prototype.
	* m32r-tdep.c: Remove _initialize_m32r_tdep prototype.
	* m68hc11-tdep.c: Remove _initialize_m68hc11_tdep prototype.
	* m68k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m68k-bsd-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* m68k-linux-nat.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-linux-tdep.c: Remove _initialize_m68k_linux_tdep prototype.
	* m68k-tdep.c: Remove _initialize_m68k_tdep prototype.
	* m88k-bsd-nat.c: Remove _initialize_m68kbsd_nat prototype.
	* m88k-tdep.c: Remove _initialize_m68kbsd_tdep prototype.
	* machoread.c: Remove _initialize_machoread prototype.
	* macrocmd.c: Remove _initialize_macrocmd prototype.
	* macroscope.c: Remove _initialize_macroscope prototype.
	* maint.c: Remove _initialize_maint_cmds prototype.
	* mdebugread.c: Remove _initialize_mdebugread prototype.
	* memattr.c: Remove _initialize_mem prototype.
	* mep-tdep.c: Remove _initialize_mep_tdep prototype.
	* mi/mi-cmd-env.c: Remove _initialize_mi_cmd_env prototype.
	* mi/mi-cmds.c: Remove _initialize_mi_cmds prototype.
	* mi/mi-interp.c: Remove _initialize_mi_interp prototype.
	* mi/mi-main.c: Remove _initialize_mi_main prototype.
	* microblaze-linux-tdep.c: Remove
	_initialize_microblaze_linux_tdep prototype.
	* microblaze-tdep.c: Remove _initialize_microblaze_tdep prototype.
	* mips-fbsd-nat.c: Remove _initialize_mips_fbsd_nat prototype.
	* mips-fbsd-tdep.c: Remove _initialize_mips_fbsd_tdep prototype.
	* mips-linux-nat.c: Remove _initialize_mips_linux_nat prototype.
	* mips-linux-tdep.c: Remove _initialize_mips_linux_tdep prototype.
	* mips-nbsd-nat.c: Remove _initialize_mipsnbsd_nat prototype.
	* mips-nbsd-tdep.c: Remove _initialize_mipsnbsd_tdep prototype.
	* mips-sde-tdep.c: Remove _initialize_mips_sde_tdep prototype.
	* mips-tdep.c: Remove _initialize_mips_tdep prototype.
	* mips64-obsd-nat.c: Remove _initialize_mips64obsd_nat prototype.
	* mips64-obsd-tdep.c: Remove _initialize_mips64obsd_tdep
	prototype.
	* mipsread.c: Remove _initialize_mipsread prototype.
	* mn10300-linux-tdep.c: Remove _initialize_mn10300_linux_tdep
	prototype.
	* mn10300-tdep.c: Remove _initialize_mn10300_tdep prototype.
	* moxie-tdep.c: Remove _initialize_moxie_tdep prototype.
	* msp430-tdep.c: Remove _initialize_msp430_tdep prototype.
	* mt-tdep.c: Remove _initialize_mt_tdep prototype.
	* nds32-tdep.c: Remove _initialize_nds32_tdep prototype.
	* nios2-linux-tdep.c: Remove _initialize_nios2_linux_tdep
	prototype.
	* nios2-tdep.c: Remove _initialize_nios2_tdep prototype.
	* nto-procfs.c: Remove _initialize_procfs prototype.
	* nto-tdep.c: Remove _initialize_nto_tdep prototype.
	* objc-lang.c: Remove _initialize_objc_language prototype.
	* objfiles.c: Remove _initialize_objfiles prototype.
	* observer.c: Remove observer_test_first_notification_function,
	observer_test_second_notification_function,
	observer_test_third_notification_function, and
	_initialize_observer prototypes.
	* opencl-lang.c: Remove _initialize_opencl_language prototypes.
	* osabi.c: Remove _initialize_gdb_osabi prototype.
	* osdata.c: Remove _initialize_osdata prototype.
	* p-valprint.c: Remove _initialize_pascal_valprint prototype.
	* parse.c: Remove _initialize_parse prototype.
	* ppc-fbsd-nat.c: Remove _initialize_ppcfbsd_nat prototype.
	* ppc-fbsd-tdep.c: Remove _initialize_ppcfbsd_tdep prototype.
	* ppc-linux-nat.c: Remove _initialize_ppc_linux_nat prototype.
	* ppc-linux-tdep.c: Remove _initialize_ppc_linux_tdep prototype.
	* ppc-nbsd-nat.c: Remove _initialize_ppcnbsd_nat prototype.
	* ppc-nbsd-tdep.c: Remove _initialize_ppcnbsd_tdep prototype.
	* ppc-obsd-nat.c: Remove _initialize_ppcobsd_nat prototype.
	* ppc-obsd-tdep.c: Remove _initialize_ppcobsd_tdep prototype.
	* printcmd.c: Remove _initialize_printcmd prototype.
	* probe.c: Remove _initialize_probe prototype.
	* proc-api.c: Remove _initialize_proc_api prototype.
	* proc-events.c: Remove _initialize_proc_events prototype.
	* proc-service.c: Remove _initialize_proc_service prototype.
	* procfs.c: Remove _initialize_procfs prototype.
	* psymtab.c: Remove _initialize_psymtab prototype.
	* python/python.c: Remove _initialize_python prototype.
	* ravenscar-thread.c: Remove _initialize_ravenscar prototype.
	* record-btrace.c: Remove _initialize_record_btrace prototype.
	* record-full.c: Remove _initialize_record_full prototype.
	* record.c: Remove _initialize_record prototype.
	* regcache.c: Remove _initialize_regcache prototype.
	* reggroups.c: Remove _initialize_reggroup prototype.
	* remote-notif.c: Remove _initialize_notif prototype.
	* remote-sim.c: Remove _initialize_remote_sim prototype.
	* remote.c: Remove _initialize_remote prototype.
	* reverse.c: Remove _initialize_reverse prototype.
	* rl78-tdep.c: Remove _initialize_rl78_tdep prototype.
	* rs6000-aix-tdep.c: Remove _initialize_rs6000_aix_tdep prototype.
	* rs6000-lynx178-tdep.c: Remove _initialize_rs6000_lynx178_tdep
	prototype.
	* rs6000-nat.c: Remove _initialize_rs6000_nat prototype.
	* rs6000-tdep.c: Remove _initialize_rs6000_tdep prototype.
	* rust-exp.y: Remove _initialize_rust_exp prototype.
	* rx-tdep.c: Remove _initialize_rx_tdep prototype.
	* s390-linux-nat.c: Remove _initialize_s390_nat prototype.
	* s390-linux-tdep.c: Remove _initialize_s390_tdep prototype.
	* score-tdep.c: Remove _initialize_score_tdep prototype.
	* selftest-arch.c: Remove _initialize_selftests_foreach_arch
	prototype.
	* ser-go32.c: Remove _initialize_ser_dos prototype.
	* ser-mingw.c: Remove _initialize_ser_windows prototype.
	* ser-pipe.c: Remove _initialize_ser_pipe prototype.
	* ser-tcp.c: Remove _initialize_ser_tcp prototype.
	* ser-unix.c: Remove _initialize_ser_hardwire prototype.
	* serial.c: Remove _initialize_serial prototype.
	* sh-linux-tdep.c: Remove _initialize_sh_linux_tdep prototype.
	* sh-nbsd-nat.c: Remove _initialize_shnbsd_nat prototype.
	* sh-nbsd-tdep.c: Remove _initialize_shnbsd_tdep prototype.
	* sh-tdep.c: Remove _initialize_sh_tdep prototype.
	* skip.c: Remove _initialize_step_skip prototype.
	* sol-thread.c: Remove _initialize_sol_thread prototype.
	* solib-aix.c: Remove _initialize_solib_aix prototype.
	* solib-darwin.c: Remove _initialize_darwin_solib prototype.
	* solib-dsbt.c: Remove _initialize_dsbt_solib prototype.
	* solib-frv.c: Remove _initialize_frv_solib prototype.
	* solib-spu.c: Remove _initialize_spu_solib prototype.
	* solib-svr4.c: Remove _initialize_svr4_solib prototype.
	* solib-target.c: Remove _initialize_solib_target prototype.
	* solib.c: Remove _initialize_solib prototype.
	* source.c: Remove _initialize_source prototype.
	* sparc-linux-nat.c: Remove _initialize_sparc_linux_nat prototype.
	* sparc-linux-tdep.c: Remove _initialize_sparc_linux_tdep
	prototype.
	* sparc-nat.c: Remove _initialize_sparc_nat prototype.
	* sparc-nbsd-nat.c: Remove _initialize_sparcnbsd_nat prototype.
	* sparc-nbsd-tdep.c: Remove _initialize_sparcnbsd_tdep prototype.
	* sparc-obsd-tdep.c: Remove _initialize_sparc32obsd_tdep
	prototype.
	* sparc-sol2-nat.c: Remove _initialize_sparc_sol2_nat prototype.
	* sparc-sol2-tdep.c: Remove _initialize_sparc_sol2_tdep prototype.
	* sparc-tdep.c: Remove _initialize_sparc_tdep prototype.
	* sparc64-fbsd-nat.c: Remove _initialize_sparc64fbsd_nat
	prototype.
	* sparc64-fbsd-tdep.c: Remove _initialize_sparc64fbsd_tdep
	prototype.
	* sparc64-linux-nat.c: Remove _initialize_sparc64_linux_nat
	prototype.
	* sparc64-linux-tdep.c: Remove _initialize_sparc64_linux_tdep
	prototype.
	* sparc64-nat.c: Remove _initialize_sparc64_nat prototype.
	* sparc64-nbsd-nat.c: Remove _initialize_sparc64nbsd_nat
	prototype.
	* sparc64-nbsd-tdep.c: Remove _initialize_sparc64nbsd_tdep
	prototype.
	* sparc64-obsd-nat.c: Remove _initialize_sparc64obsd_nat
	prototype.
	* sparc64-obsd-tdep.c: Remove _initialize_sparc64obsd_tdep
	prototype.
	* sparc64-sol2-tdep.c: Remove _initialize_sparc64_sol2_tdep
	prototype.
	* spu-linux-nat.c: Remove _initialize_spu_nat prototype.
	* spu-multiarch.c: Remove _initialize_spu_multiarch prototype.
	* spu-tdep.c: Remove _initialize_spu_tdep prototype.
	* stabsread.c: Remove _initialize_stabsread prototype.
	* stack.c: Remove _initialize_stack prototype.
	* stap-probe.c: Remove _initialize_stap_probe prototype.
	* std-regs.c: Remove _initialize_frame_reg prototype.
	* symfile-debug.c: Remove _initialize_symfile_debug prototype.
	* symfile-mem.c: Remove _initialize_symfile_mem prototype.
	* symfile.c: Remove _initialize_symfile prototype.
	* symmisc.c: Remove _initialize_symmisc prototype.
	* symtab.c: Remove _initialize_symtab prototype.
	* target-dcache.c: Remove _initialize_target_dcache prototype.
	* target-descriptions.c: Remove _initialize_target_descriptions
	prototype.
	* thread.c: Remove _initialize_thread prototype.
	* tic6x-linux-tdep.c: Remove _initialize_tic6x_linux_tdep
	prototype.
	* tic6x-tdep.c: Remove _initialize_tic6x_tdep prototype.
	* tilegx-linux-nat.c: Remove _initialize_tile_linux_nat prototype.
	* tilegx-linux-tdep.c: Remove _initialize_tilegx_linux_tdep
	prototype.
	* tilegx-tdep.c: Remove _initialize_tilegx_tdep prototype.
	* tracefile-tfile.c: Remove _initialize_tracefile_tfile prototype.
	* tracefile.c: Remove _initialize_tracefile prototype.
	* tracepoint.c: Remove _initialize_tracepoint prototype.
	* tui/tui-hooks.c: Remove _initialize_tui_hooks prototype.
	* tui/tui-interp.c: Remove _initialize_tui_interp prototype.
	* tui/tui-layout.c: Remove _initialize_tui_layout prototype.
	* tui/tui-regs.c: Remove _initialize_tui_regs prototype.
	* tui/tui-stack.c: Remove _initialize_tui_stack prototype.
	* tui/tui-win.c: Remove _initialize_tui_win prototype.
	* tui/tui.c: Remove _initialize_tui prototype.
	* typeprint.c: Remove _initialize_typeprint prototype.
	* user-regs.c: Remove _initialize_user_regs prototype.
	* utils.c: Remove _initialize_utils prototype.
	* v850-tdep.c: Remove _initialize_v850_tdep prototype.
	* valarith.c: Remove _initialize_valarith prototype.
	* valops.c: Remove _initialize_valops prototype.
	* valprint.c: Remove _initialize_valprint prototype.
	* value.c: Remove _initialize_values prototype.
	* varobj.c: Remove _initialize_varobj prototype.
	* vax-bsd-nat.c: Remove _initialize_vaxbsd_nat prototype.
	* vax-nbsd-tdep.c: Remove _initialize_vaxnbsd_tdep prototype.
	* vax-tdep.c: Remove _initialize_vax_tdep prototype.
	* windows-nat.c: Remove _initialize_windows_nat,
	_initialize_check_for_gdb_ini, and _initialize_loadable
	prototypes.
	* windows-tdep.c: Remove _initialize_windows_tdep prototype.
	* xcoffread.c: Remove _initialize_xcoffread prototype.
	* xml-support.c: Remove _initialize_xml_support prototype.
	* xstormy16-tdep.c: Remove _initialize_xstormy16_tdep prototype.
	* xtensa-linux-nat.c: Remove _initialize_xtensa_linux_nat
	prototype.
	* xtensa-linux-tdep.c: Remove _initialize_xtensa_linux_tdep
	prototype.
	* xtensa-tdep.c: Remove _initialize_xtensa_tdep prototype.
2017-09-09 11:02:37 -07:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Yao Qi 668e167446 Remove apply_val_pretty_printer parameter valaddr
This patch removes the parameter valaddr of
extension_language_ops::apply_val_pretty_printer and remove const from
"struct value *val".  valaddr can be got in each extension language's
implementation of apply_val_pretty_printer.

gdb:

2016-11-11  Yao Qi  <yao.qi@linaro.org>

	* cp-valprint.c (cp_print_value): Remove local base_valaddr.
	* extension-priv.h (struct extension_language_ops)
	<apply_val_pretty_printer>: Remove the second parameter.
	Remove const from "struct value *".  Callers updated.
	* extension.c (apply_ext_lang_val_pretty_printer): Update
	comments.  Remove parameter valaddr.  Remove const from
	"struct value *".
	* extension.h (apply_ext_lang_val_pretty_printer): Update
	declaration.
	* guile/guile-internal.h (gdbscm_apply_val_pretty_printer):
	Update declaration.
	* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
	Remove parameter valaddr.  Remove const from "struct value *".
	* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer):
	Likewise.
	* python/python-internal.h (gdbpy_apply_val_pretty_printer):
	Update declaration.
2016-11-11 08:38:31 +00:00
David Taylor 6b8505468e Support structure offsets that are 512K or larger.
GDB computes structure byte offsets using a 32 bit integer.  And,
first it computes the offset in bits and then converts to bytes.  The
result is that any offset that if 512K bytes or larger overflows.
This patch changes GDB to use LONGEST for such calculations.

	PR gdb/17520 Structure offset wrong when 1/4 GB or greater.
	* c-lang.h: Change all parameters, variables, and struct or union
	members used as struct or union fie3ld offsets from int to
	LONGEST.
	* c-valprint.c: Likewise.
	* cp-abi.c: Likewise.
	* cp-abi.h: Likewise.
	* cp-valprint.c: Likewise.
	* d-valprint.c: Likewise.
	* dwarf2loc.c: Likewise.
	* eval.c: Likewise.
	* extension-priv.h: Likewise.
	* extension.c: Likewise.
	* extension.h: Likewise.
	* findvar.c: Likewise.
	* gdbtypes.h: Likewise.
	* gnu-v2-abi.c: Likewise.
	* gnu-v3-abi.c: Likewise.
	* go-valprint.c: Likewise.
	* guile/guile-internal.h: Likewise.
	* guile/scm-pretty-print.c: Likewise.
	* jv-valprint.c Likewise.
	* opencl-lang.c: Likewise.
	* p-lang.h: Likewise.
	* python/py-prettyprint.c: Likewise.
	* python/python-internal.h: Likewise.
	* spu-tdep.c: Likewise.
	* typeprint.c: Likewise.
	* valarith.c: Likewise.
	* valops.c: Likewise.
	* valprint.c: Likewise.
	* valprint.h: Likewise.
	* value.c: Likewise.
	* value.h: Likewise.
	* p-valprint.c: Likewise.
	* c-typeprint.c (c_type_print_base): When printing offset, use
	plongest, not %d.
	* gdbtypes.c (recursive_dump_type): Ditto.
2016-06-24 21:02:36 -04:00
Trevor Saunders 870f88f755 remove trivialy unused variables
gdb/ChangeLog:

2016-05-07  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* aarch64-linux-tdep.c (aarch64_linux_sigframe_init): Remove unused
	variables.
	* aarch64-tdep.c (aarch64_skip_prologue): Likewise.
	(aarch64_scan_prologue): Likewise.
	(aarch64_prologue_prev_register): Likewise.
	(aarch64_dwarf2_prev_register): Likewise.
	(pass_in_v): Likewise.
	(aarch64_push_dummy_call): Likewise.
	(aarch64_breakpoint_from_pc): Likewise.
	(aarch64_return_in_memory): Likewise.
	(aarch64_return_value): Likewise.
	(aarch64_displaced_step_b_cond): Likewise.
	(aarch64_displaced_step_cb): Likewise.
	(aarch64_displaced_step_tb): Likewise.
	(aarch64_gdbarch_init): Likewise.
	(aarch64_process_record): Likewise.
	* alpha-mdebug-tdep.c (alpha_mdebug_init_abi): Likewise.
	* alpha-tdep.c (_initialize_alpha_tdep): Likewise.
	* amd64-dicos-tdep.c (amd64_dicos_init_abi): Likewise.
	* amd64-linux-tdep.c (amd64_dtrace_parse_probe_argument): Likewise.
	* amd64-tdep.c (fixup_riprel): Likewise.
	* amd64-windows-tdep.c (amd64_windows_frame_decode_epilogue): Likewise.
	(amd64_windows_frame_decode_insns): Likewise.
	(amd64_windows_frame_cache): Likewise.
	(amd64_windows_frame_prev_register): Likewise.
	(amd64_windows_frame_this_id): Likewise.
	(amd64_windows_init_abi): Likewise.
	* arm-linux-tdep.c (arm_linux_get_syscall_number): Likewise.
	(arm_linux_get_next_pcs_syscall_next_pc): Likewise.
	* arm-symbian-tdep.c (arm_symbian_init_abi): Likewise.
	* arm-tdep.c (arm_make_epilogue_frame_cache): Likewise.
	(arm_epilogue_frame_prev_register): Likewise.
	(arm_record_vdata_transfer_insn): Likewise.
	(arm_record_exreg_ld_st_insn): Likewise.
	* auto-load.c (execute_script_contents): Likewise.
	(print_scripts): Likewise.
	* avr-tdep.c (avr_frame_prev_register): Likewise.
	(avr_push_dummy_call): Likewise.
	* bfin-linux-tdep.c (bfin_linux_sigframe_init): Likewise.
	* bfin-tdep.c (bfin_gdbarch_init): Likewise.
	* blockframe.c (find_pc_partial_function_gnu_ifunc): Likewise.
	* break-catch-throw.c (fetch_probe_arguments): Likewise.
	* breakpoint.c (breakpoint_xfer_memory): Likewise.
	(breakpoint_init_inferior): Likewise.
	(breakpoint_inserted_here_p): Likewise.
	(software_breakpoint_inserted_here_p): Likewise.
	(hardware_breakpoint_inserted_here_p): Likewise.
	(bpstat_what): Likewise.
	(break_range_command): Likewise.
	(save_breakpoints): Likewise.
	* coffread.c (coff_symfile_read): Likewise.
	* cris-tdep.c (cris_push_dummy_call): Likewise.
	(cris_scan_prologue): Likewise.
	(cris_register_size): Likewise.
	(_initialize_cris_tdep): Likewise.
	* d-exp.y: Likewise.
	* dbxread.c (dbx_read_symtab): Likewise.
	(process_one_symbol): Likewise.
	(coffstab_build_psymtabs): Likewise.
	(elfstab_build_psymtabs): Likewise.
	* dicos-tdep.c (dicos_init_abi): Likewise.
	* disasm.c (do_mixed_source_and_assembly): Likewise.
	(gdb_disassembly): Likewise.
	* dtrace-probe.c (dtrace_process_dof): Likewise.
	* dwarf2read.c (error_check_comp_unit_head): Likewise.
	(build_type_psymtabs_1): Likewise.
	(skip_one_die): Likewise.
	(process_imported_unit_die): Likewise.
	(dwarf2_physname): Likewise.
	(read_file_scope): Likewise.
	(setup_type_unit_groups): Likewise.
	(create_dwo_cu_reader): Likewise.
	(create_dwo_cu): Likewise.
	(create_dwo_unit_in_dwp_v1): Likewise.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(lookup_dwo_unit_in_dwp): Likewise.
	(free_dwo_file): Likewise.
	(check_producer): Likewise.
	(dwarf2_add_typedef): Likewise.
	(dwarf2_add_member_fn): Likewise.
	(read_unsigned_leb128): Likewise.
	(read_signed_leb128): Likewise.
	(dwarf2_const_value): Likewise.
	(follow_die_sig_1): Likewise.
	(dwarf_decode_macro_bytes): Likewise.
	* extension.c (restore_active_ext_lang): Likewise.
	* frv-linux-tdep.c (frv_linux_sigtramp_frame_cache): Likewise.
	* ft32-tdep.c (ft32_analyze_prologue): Likewise.
	* gdbtypes.c (lookup_typename): Likewise.
	(resolve_dynamic_range): Likewise.
	(check_typedef): Likewise.
	* h8300-tdep.c (h8300_is_argument_spill): Likewise.
	(h8300_gdbarch_init): Likewise.
	* hppa-tdep.c (hppa32_push_dummy_call): Likewise.
	(hppa_frame_this_id): Likewise.
	(_initialize_hppa_tdep): Likewise.
	* hppanbsd-tdep.c (hppanbsd_sigtramp_cache_init): Likewise.
	* hppaobsd-tdep.c (hppaobsd_supply_fpregset): Likewise.
	* i386-dicos-tdep.c (i386_dicos_init_abi): Likewise.
	* i386-tdep.c (i386_bnd_type): Likewise.
	(i386_gdbarch_init): Likewise.
	(i386_mpx_bd_base): Likewise.
	* i386nbsd-tdep.c (i386nbsd_sigtramp_cache_init): Likewise.
	* i386obsd-tdep.c (i386obsd_elf_init_abi): Likewise.
	* ia64-tdep.c (examine_prologue): Likewise.
	(ia64_frame_cache): Likewise.
	(ia64_push_dummy_call): Likewise.
	* infcmd.c (finish_command_fsm_async_reply_reason): Likewise.
	(default_print_one_register_info): Likewise.
	* infrun.c (infrun_thread_ptid_changed): Likewise.
	(thread_still_needs_step_over): Likewise.
	(stop_all_threads): Likewise.
	(restart_threads): Likewise.
	(keep_going_stepped_thread): Likewise.
	* iq2000-tdep.c (iq2000_scan_prologue): Likewise.
	* language.c (language_init_primitive_type_symbols): Likewise.
	* linespec.c (add_sal_to_sals): Likewise.
	* linux-nat.c (status_callback): Likewise.
	(kill_unfollowed_fork_children): Likewise.
	(linux_nat_kill): Likewise.
	* linux-tdep.c (linux_fill_prpsinfo): Likewise.
	* linux-thread-db.c (thread_db_notice_clone): Likewise.
	(record_thread): Likewise.
	* location.c (string_to_event_location_basic): Likewise.
	* m32c-tdep.c (m32c_prev_register): Likewise.
	* m32r-linux-tdep.c (m32r_linux_init_abi): Likewise.
	* m32r-tdep.c (decode_prologue): Likewise.
	* m68klinux-tdep.c (m68k_linux_sigtramp_frame_cache): Likewise.
	* machoread.c (macho_symtab_read): Likewise.
	(macho_symfile_read): Likewise.
	(macho_symfile_offsets): Likewise.
	* maint.c (set_per_command_cmd): Likewise.
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals): Likewise.
	(mi_cmd_stack_list_variables): Likewise.
	* mi/mi-main.c (mi_cmd_exec_run): Likewise.
	(output_register): Likewise.
	(mi_cmd_execute): Likewise.
	(mi_cmd_trace_define_variable): Likewise.
	(print_variable_or_computed): Likewise.
	* minsyms.c (prim_record_minimal_symbol_full): Likewise.
	* mn10300-tdep.c (mn10300_frame_prev_register): Likewise.
	* msp430-tdep.c (msp430_pseudo_register_write): Likewise.
	* mt-tdep.c (mt_registers_info): Likewise.
	* nios2-tdep.c (nios2_analyze_prologue): Likewise.
	(nios2_push_dummy_call): Likewise.
	(nios2_frame_unwind_cache): Likewise.
	(nios2_stub_frame_cache): Likewise.
	(nios2_stub_frame_sniffer): Likewise.
	(nios2_gdbarch_init): Likewise.
	* ppc-ravenscar-thread.c: Likewise.
	* ppcfbsd-tdep.c (ppcfbsd_sigtramp_frame_cache): Likewise.
	* python/py-evts.c (add_new_registry): Likewise.
	* python/py-finishbreakpoint.c (bpfinishpy_init): Likewise.
	(bpfinishpy_detect_out_scope_cb): Likewise.
	* python/py-framefilter.c (py_print_value): Likewise.
	* python/py-inferior.c (infpy_write_memory): Likewise.
	* python/py-infevents.c (create_inferior_call_event_object): Likewise.
	* python/py-infthread.c (thpy_get_ptid): Likewise.
	* python/py-linetable.c (ltpy_get_pcs_for_line): Likewise.
	(ltpy_get_all_source_lines): Likewise.
	(ltpy_is_valid): Likewise.
	(ltpy_iternext): Likewise.
	* python/py-symtab.c (symtab_and_line_to_sal_object): Likewise.
	* python/py-unwind.c (pyuw_object_attribute_to_pointer): Likewise.
	(unwind_infopy_str): Likewise.
	* python/py-varobj.c (py_varobj_get_iterator): Likewise.
	* ravenscar-thread.c (ravenscar_inferior_created): Likewise.
	* rs6000-aix-tdep.c (rs6000_push_dummy_call): Likewise.
	* rs6000-lynx178-tdep.c (rs6000_lynx178_push_dummy_call): Likewise.
	* rs6000-tdep.c (ppc_deal_with_atomic_sequence): Likewise.
	* s390-linux-tdep.c (s390_supply_tdb_regset): Likewise.
	(s390_frame_prev_register): Likewise.
	(s390_dwarf2_frame_init_reg): Likewise.
	(s390_record_vr): Likewise.
	(s390_process_record): Likewise.
	* score-tdep.c (score_push_dummy_call): Likewise.
	(score3_analyze_prologue): Likewise.
	* sh-tdep.c (sh_extract_return_value_nofpu): Likewise.
	* sh64-tdep.c (sh64_analyze_prologue): Likewise.
	(sh64_push_dummy_call): Likewise.
	(sh64_extract_return_value): Likewise.
	(sh64_do_fp_register): Likewise.
	* solib-aix.c (solib_aix_get_section_offsets): Likewise.
	* solib-darwin.c (darwin_read_exec_load_addr_from_dyld): Likewise.
	(darwin_solib_read_all_image_info_addr): Likewise.
	* solib-dsbt.c (enable_break): Likewise.
	* solib-frv.c (enable_break2): Likewise.
	(frv_fdpic_find_canonical_descriptor): Likewise.
	* solib-svr4.c (svr4_handle_solib_event): Likewise.
	* sparc-tdep.c (sparc_skip_stack_check): Likewise.
	* sparc64-linux-tdep.c (sparc64_linux_get_longjmp_target): Likewise.
	* sparcobsd-tdep.c (sparc32obsd_init_abi): Likewise.
	* spu-tdep.c (info_spu_dma_cmdlist): Likewise.
	* stack.c (read_frame_local): Likewise.
	* symfile.c (symbol_file_add_separate): Likewise.
	(remove_symbol_file_command): Likewise.
	* symmisc.c (maintenance_print_one_line_table): Likewise.
	* symtab.c (symbol_cache_flush): Likewise.
	(basic_lookup_transparent_type): Likewise.
	(sort_search_symbols_remove_dups): Likewise.
	* target.c (target_memory_map): Likewise.
	(target_detach): Likewise.
	(target_resume): Likewise.
	(acquire_fileio_fd): Likewise.
	(target_store_registers): Likewise.
	* thread.c (print_thread_info_1): Likewise.
	* tic6x-tdep.c (tic6x_analyze_prologue): Likewise.
	* tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Likewise.
	* tilegx-tdep.c (tilegx_push_dummy_call): Likewise.
	(tilegx_analyze_prologue): Likewise.
	(tilegx_stack_frame_destroyed_p): Likewise.
	(tilegx_frame_cache): Likewise.
	* tracefile.c (trace_save): Likewise.
	* tracepoint.c (encode_actions_and_make_cleanup): Likewise.
	(start_tracing): Likewise.
	(print_one_static_tracepoint_marker): Likewise.
	* tui/tui.c (tui_enable): Likewise.
	* valops.c (value_struct_elt_bitpos): Likewise.
	(find_overload_match): Likewise.
	(find_oload_champ): Likewise.
	* value.c (value_contents_copy_raw): Likewise.
	* windows-tdep.c (windows_get_tlb_type): Likewise.
	* x86-linux-nat.c (x86_linux_enable_btrace): Likewise.
	* xcoffread.c (record_minimal_symbol): Likewise.
	(scan_xcoff_symtab): Likewise.
	* xtensa-tdep.c (execute_code): Likewise.
	(xtensa_gdbarch_init): Likewise.
	(_initialize_xtensa_tdep): Likewise.
2016-05-07 20:12:53 -04:00
Pedro Alves a149683b0c Eliminate clear_quit_flag
Nothing calls this anymore.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* defs.h (clear_quit_flag): Remove declaration.
	* extension-priv.h (struct extension_language_ops)
	<clear_quit_flag>: Remove field and update comments.
	* extension.c (clear_quit_flag): Delete.
	* guile/guile.c (guile_extension_ops): Adjust.
	* python/python.c (python_extension_ops): Adjust.
	(gdbpy_clear_quit_flag): Delete.
2016-04-12 16:56:15 +01:00
Pedro Alves f0881b37b6 Introduce interruptible_select
We have places where we call a blocking gdb_select expecting that a
Ctrl-C will unblock it.  However, if the Ctrl-C is pressed just before
gdb_select, the SIGINT handler runs before gdb_select, and thus
gdb_select won't return.

For example gdb_readline_no_editing:

       QUIT;

       /* Wait until at least one byte of data is available.  Control-C
          can interrupt gdb_select, but not fgetc.  */
       FD_ZERO (&readfds);
       FD_SET (fd, &readfds);
       if (gdb_select (fd + 1, &readfds, NULL, NULL, NULL) == -1)

and stdio_file_read:

     /* For the benefit of Windows, call gdb_select before reading from
	the file.  Wait until at least one byte of data is available.
	Control-C can interrupt gdb_select, but not read.  */
     {
       fd_set readfds;
       FD_ZERO (&readfds);
       FD_SET (stdio->fd, &readfds);
       if (gdb_select (stdio->fd + 1, &readfds, NULL, NULL, NULL) == -1)
	 return -1;
     }
     return read (stdio->fd, buf, length_buf);


This is a race classically fixed with either the self-pipe trick, or
by blocking SIGINT and then using pselect instead of select.

Blocking SIGINT most of the time would mean that check_quit_flag (and
thus QUIT) would need to do a syscall every time it is called, which
sounds best avoided, since QUIT is called in many loops.  Thus we take
the self-pipe trick route (wrapped in a serial event).

Instead of having all places that need this manually add an extra file
descriptor to the set of gdb_select's watched file descriptors, we
introduce a wrapper, interruptible_select, that does that.

The Windows version of gdb_select actually does not suffer from this,
because mingw-hdep.c:gdb_call_async_signal_handler sets a Windows
event that gdb_select always waits on.  So this patch can be seen as
generalization of that technique.  We can't remove that extra event
from mingw-hdep.c until we get rid of immediate_quit though.

gdb/ChangeLog:
2016-04-12  Pedro Alves  <palves@redhat.com>

	* defs.h: Extend QUIT-related comments to mention
	interruptible_select.
	(quit_serial_event_set, quit_serial_event_clear): Declare.
	* event-top.c: Include "ser-event.h" and "gdb_select.h".
	(quit_serial_event): New global.
	(async_init_signals): Make quit_serial_event.
	(quit_serial_event_set, quit_serial_event_clear)
	(quit_serial_event_fd, interruptible_select): New functions.
	* extension.c (set_quit_flag): Set the quit serial event.
	(check_quit_flag): Clear the quit serial event.
	* gdb_select.h (interruptible_select): New declaration.
	* guile/scm-ports.c (ioscm_input_waiting): Use
	interruptible_select instead of gdb_select.
	* top.c (gdb_readline_no_editing): Likewise.
	* ui-file.c (stdio_file_read): Likewise.
2016-04-12 16:54:03 +01:00
Yao Qi 2f99e8fc9c Change SIGINT handler for extension languages only when target terminal is ours
I see a timeout in gdb.base/random-signal.exp,

 Continuing.^M
 PASS: gdb.base/random-signal.exp: continue
 ^CPython Exception <type 'exceptions.KeyboardInterrupt'> <type
 exceptions.KeyboardInterrupt'>: ^M
 FAIL: gdb.base/random-signal.exp: stop with control-c (timeout)

it can be reproduced by running random-signal.exp with native-gdbserver
in a loop, like this, and the fail will be shown in about 20 runs,

$ (set -e; while true; do make check RUNTESTFLAGS="--target_board=native-gdbserver random-signal.exp"; done)

In the test, the program is being single-stepped for software watchpoint,
and in each internal stop, python unwinder sniffer is used,

 #0  pyuw_sniffer (self=<optimised out>, this_frame=<optimised out>, cache_ptr=0xd554f8) at /home/yao/SourceCode/gnu/gdb/git/gdb/python/py-unwind.c:608
 #1  0x00000000006a10ae in frame_unwind_try_unwinder (this_frame=this_frame@entry=0xd554e0, this_cache=this_cache@entry=0xd554f8, unwinder=0xecd540)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/frame-unwind.c:107
 #2  0x00000000006a143f in frame_unwind_find_by_frame (this_frame=this_frame@entry=0xd554e0, this_cache=this_cache@entry=0xd554f8)
     at /home/yao/SourceCode/gnu/gdb/git/gdb/frame-unwind.c:163
 #3  0x000000000069dc6b in compute_frame_id (fi=0xd554e0) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:454
 #4  get_prev_frame_if_no_cycle (this_frame=this_frame@entry=0xd55410) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1781
 #5  0x000000000069fdb9 in get_prev_frame_always_1 (this_frame=0xd55410) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1955
 #6  get_prev_frame_always (this_frame=this_frame@entry=0xd55410) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:1971
 #7  0x00000000006a04b1 in get_prev_frame (this_frame=this_frame@entry=0xd55410) at /home/yao/SourceCode/gnu/gdb/git/gdb/frame.c:2213

when GDB goes to python extension, or other language extension, the
SIGINT handler is changed, and is restored when GDB leaves extension
language.  GDB only stays in extension language for a very short period
in this case, but if ctrl-c is pressed at that moment, python extension
will handle the SIGINT, and exceptions.KeyboardInterrupt is shown.

Language extension is used in GDB side rather than inferior side,
so GDB should only change SIGINT handler for extension language when
the terminal is ours (not inferior's).  This is what this patch does.
With this patch applied, I run random-signal.exp in a loop for 18
hours, and no fail is shown.

gdb:

2016-01-08  Yao Qi  <yao.qi@linaro.org>

	* extension.c: Include target.h.
	(set_active_ext_lang): Only call install_gdb_sigint_handler,
	check_quit_flag, and set_quit_flag if target_terminal_is_ours
	returns false.
	(restore_active_ext_lang): Likewise.
	* target.c (target_terminal_is_ours): New function.
	* target.h (target_terminal_is_ours): Declare.
2016-01-08 11:06:00 +00:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Pedro Alves a40805d4a7 gdb: Use sighandler_t everywhere
This fixes 14 build errors like these in C++ mode:

 src/gdb/extension.c: In function ‘void install_sigint_handler(const signal_handler*)’:
 src/gdb/extension.c:698:41: error: invalid conversion from ‘void (*)()’ to ‘__sighandler_t {aka void (*)(int)}’ [-fpermissive]
    signal (SIGINT, handler_state->handler);
					  ^
 In file included from build-gnulib/import/signal.h:52:0,
		  from ../../src/gdb/extension.c:24:
 /usr/include/signal.h:102:23: error:   initializing argument 2 of ‘void (* signal(int, __sighandler_t))(int)’ [-fpermissive]
  extern __sighandler_t signal (int __sig, __sighandler_t __handler)
			^

Instead of this everywhere:

 -  RETSIGTYPE (*handle_sigint_for_compare) () = handle_sigint;
 +  RETSIGTYPE (*handle_sigint_for_compare) (int) = handle_sigint;

Use sighandler_t (a GNU extension).  That's OK to use unconditionaly
because gnulib's signal.h replacement makes sure that it is available.

gdb/ChangeLog:
2015-08-27  Pedro Alves  <palves@redhat.com>

	* cp-support.c (gdb_demangle): Use sighandler_t.  Remove cast.
	* extension-priv.h: Include signal.h.
	(struct signal_handler) <handler>: Change type to sighandler_t.
	* extension.c (install_gdb_sigint_handler): Use sighandler_t.
	* inflow.c (sigint_ours, sigquit_ours): Change type to
	sighandler_t.
	(child_terminal_inferior): Remove casts.
	(child_terminal_ours_1, new_tty): Use sighandler_t.  Remove casts.
	(osig): Change type to sighandler_t.
	* nto-procfs.c (ofunc): Change type to sighandler_t.
	(procfs_wait): Remove casts.
	* remote-m32r-sdi.c (m32r_wait, m32r_load): Use sighandler_t.
	* remote-sim.c (gdbsim_wait): Use sighandler_t.
	* utils.c (wait_to_die_with_timeout): Use sighandler_t.
2015-08-27 13:26:23 +01:00
Doug Evans 2ce1cdbf84 PR python/18285
gdb/ChangeLog:

	PR python/18285
	* NEWS: Document new gdb.XMethodWorker.get_result_type method.
	* eval.c (evaluate_subexp_standard) <OP_FUNCALL>: Handle
	EVAL_AVOID_SIDE_EFFECTS for xmethods.
	* extension-priv.h (struct extension_language_ops)
	<get_xmethod_result_type>: New member.
	* extension.c (get_xmethod_result_type): New function.
	* extension.h (get_xmethod_result_type): Declare.
	* python/py-xmethods.c (get_result_type_method_name): New static
	global.
	(py_get_result_type_method_name): Ditto.
	(gdbpy_get_xmethod_result_type): New function.
	(gdbpy_initialize_xmethods): Initialize py_get_result_type_method_name.
	* python/python-internal.h (gdbpy_get_xmethod_result_type): Declare.
	* python/python.c (python_extension_ops): Add
	gdbpy_get_xmethod_result_type.
	* python/lib/gdb/xmethod.py (XMethodWorker): Add get_result_type.
	* valarith.c (value_x_binop): Handle EVAL_AVOID_SIDE_EFFECTS for
	xmethods.
	(value_x_unop): Ditto.
	* value.c (result_type_of_xmethod): New function.
	* value.h (result_type_of_xmethod): Declare.

gdb/testsuite/ChangeLog:

	* gdb.python/py-xmethods.exp: Add ptype tests.
	* gdb.python/py-xmethods.py (E_method_char_worker): Add
	get_result_type method.

gdb/doc/ChangeLog:

	* python.texi (Xmethod API) <gdb.XMethodWorker.get_result_type>:
	Document.
	(Writing an Xmethod): Add get_result_type to example.
2015-04-29 13:24:21 -07:00
Doug Evans 9f0500621b Add support for inlining scripts into .debug_gdb_scripts.
include/gdb/ChangeLog:

	* section-scripts.h: Remove "future extension" comment.
	(SECTION_SCRIPT_ID_PYTHON_TEXT): New macro.
	(SECTION_SCRIPT_ID_SCHEME_TEXT): New macro.

gdb/ChangeLog:

	* NEWS: Mention inlined scripts in .debug_gdb_scripts section.
	* auto-load.c: #include ctype.h.
	(struct auto_load_pspace_info): Replace member loaded_scripts with
	new members loaded_script_files, loaded_script_texts.
	(auto_load_pspace_data_cleanup): Update.
	(init_loaded_scripts_info): Update.
	(get_auto_load_pspace_data_for_loading): Update.
	(maybe_add_script_file): Renamed from maybe_add_script.  All callers
	updated.
	(maybe_add_script_text): New function.
	(clear_section_scripts): Update.
	(source_script_file, execute_script_contents): New functions.
	(source_section_scripts): Add support for
	SECTION_SCRIPT_ID_PYTHON_TEXT, SECTION_SCRIPT_ID_GUILE_TEXT.
	(print_scripts): New function.
	(auto_load_info_scripts): Also print inlined scripts.
	(maybe_print_unsupported_script_warning): Renamed from
	unsupported_script_warning_print.  All callers updated.
	(maybe_print_script_not_found_warning): Renamed from
	script_not_found_warning_print.  All callers updated.
	* extension-priv.h (struct extension_language_script_ops): New member
	objfile_script_executor.
	* extension.c (ext_lang_objfile_script_executor): New function.
	* extension.h (objfile_script_executor_func): New typedef.
	(ext_lang_objfile_script_executor): Declare.
	* guile/guile-internal.h (gdbscm_execute_objfile_script): Declare.
	* guile/guile.c (guile_extension_script_ops): Update.
	* guile/scm-objfile.c (gdbscm_execute_objfile_script): New function.
	* python/python.c (python_extension_script_ops): Update.
	(gdbpy_execute_objfile_script): New function.

gdb/doc/ChangeLog:

	* gdb.texinfo (dotdebug_gdb_scripts section): Update docs to
	distinguish script files vs inlined scripts.
	* python.texi (Python Auto-loading): Ditto.

gdb/testsuite/ChangeLog:

	* gdb.guile/scm-section-script.c: Add duplicate inlined section script
	entries.  Duplicate file section script entries.
	* gdb.guile/scm-section-script.exp: Add tests for duplicate entries,
	inlined entries.  Add test for safe-path rejection.
	* gdb.python/py-section-script.c: Add duplicate inlined section script
	entries.  Duplicate file section script entries.
	* gdb.python/py-section-script.exp: Add tests for duplicate entries,
	inlined entries.  Add test for safe-path rejection.
2015-01-31 12:01:13 -08:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Siva Chandra e81e7f5e38 Add xmethod interface to the extension language API.
* defs.h (enum lval_type): New enumerator "lval_xcallable".
	* extension-priv.h (struct extension_language_ops): Add the
	xmethod interface.
	* extension.c (new_xmethod_worker, clone_xmethod_worker,
	get_matching_xmethod_workers, get_xmethod_argtypes,
	invoke_xmethod, free_xmethod_worker,
	free_xmethod_worker_vec): New functions.
	* extension.h: #include "common/vec.h".
	New function declarations.
	(struct xmethod_worker): New struct.
	(VEC (xmethod_worker_ptr)): New vector type.
	(xmethod_worker_ptr): New typedef.
	(xmethod_worker_vec): Likewise.
	* gdbtypes.c (gdbtypes_post_init): Initialize "xmethod" field of
	builtin_type.
	* gdbtypes.h (enum type_code): New enumerator TYPE_CODE_XMETHOD.
	(struct builtin_type): New field "xmethod".
	* valarith.c (value_ptradd): Assert that the value argument is not
	lval_xcallable.
	* valops.c (value_must_coerce_to_target): Return 0 for
	lval_xcallable values.
	* value.c (struct value): New field XM_WORKER in the field
	LOCATION.
	(value_address, value_raw_address): Return 0 for lval_xcallable
	values.
	(set_value_address): Assert that the value is not an
	lval_xcallable.
	(value_free): Free the associated xmethod worker when freeing
	lval_xcallable values.
	(set_value_component_location): Assert that the WHOLE value is not
	lval_xcallable.
	(value_of_xmethod, call_xmethod): New functions.
	* value.h: Declare "struct xmethod_worker".
	Declare new functions value_of_xmethod, call_xmethod.
2014-06-03 09:49:26 -07:00
Doug Evans feef67abfa * extension.c (eval_ext_lang_from_control_command): Avoid dereferencing
NULL pointer.

	testsuite/
	* gdb.python/python.exp (python not supported): Verify multi-line
	python command issues an error.
2014-03-22 02:44:39 -04:00
Doug Evans ed3ef33944 Add Guile as an extension language.
* NEWS: Mention Guile scripting.
	* Makefile.in (SUBDIR_GUILE_OBS): New variable.
	(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
	(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
	(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
	(CLIBS): Add GUILE_LIBS.
	(install-guile): New rule.
	(guile.o): New rule.
	(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
	(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
	(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
	(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
	(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
	(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
	(scm-type.o, scm-utils.o, scm-value.o): New rules.
	* configure.ac: New option --with-guile.
	* configure: Regenerate.
	* config.in: Regenerate.
	* auto-load.c: Remove #include "python/python.h".  Add #include
	"gdb/section-scripts.h".
	(source_section_scripts): Handle Guile scripts.
	(_initialize_auto_load): Add name of Guile objfile script to
	scripts-directory help text.
	* breakpoint.c (condition_command): Tweak comment to include Scheme.
	* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
	(struct breakpoint): New member scm_bp_object.
	* defs.h (enum command_control_type): New value guile_control.
	* cli/cli-cmds.c: Remove #include "python/python.h".  Add #include
	"extension.h".
	(show_user): Update comment.
	(_initialize_cli_cmds): Update help text for "show user".  Update help
	text for max-user-call-depth.
	* cli/cli-script.c: Remove #include "python/python.h".  Add #include
	"extension.h".
	(multi_line_command_p): Add guile_control.
	(print_command_lines): Handle guile_control.
	(execute_control_command, recurse_read_control_structure): Ditto.
	(process_next_line): Recognize "guile" commands.
	* disasm.c (gdb_disassemble_info): Make non-static.
	* disasm.h: #include "dis-asm.h".
	(struct gdbarch): Add forward decl.
	(gdb_disassemble_info): Declare.
	* extension.c: #include "guile/guile.h".
	(extension_languages): Add guile.
	(get_ext_lang_defn): Handle EXT_LANG_GDB.
	* extension.h (enum extension_language): New value EXT_LANG_GUILE.
	* gdbtypes.c (get_unsigned_type_max): New function.
	(get_signed_type_minmax): New function.
	* gdbtypes.h (get_unsigned_type_max): Declare.
	(get_signed_type_minmax): Declare.
	* guile/README: New file.
	* guile/guile-internal.h: New file.
	* guile/guile.c: New file.
	* guile/guile.h: New file.
	* guile/scm-arch.c: New file.
	* guile/scm-auto-load.c: New file.
	* guile/scm-block.c: New file.
	* guile/scm-breakpoint.c: New file.
	* guile/scm-disasm.c: New file.
	* guile/scm-exception.c: New file.
	* guile/scm-frame.c: New file.
	* guile/scm-gsmob.c: New file.
	* guile/scm-iterator.c: New file.
	* guile/scm-lazy-string.c: New file.
	* guile/scm-math.c: New file.
	* guile/scm-objfile.c: New file.
	* guile/scm-ports.c: New file.
	* guile/scm-pretty-print.c: New file.
	* guile/scm-safe-call.c: New file.
	* guile/scm-string.c: New file.
	* guile/scm-symbol.c: New file.
	* guile/scm-symtab.c: New file.
	* guile/scm-type.c: New file.
	* guile/scm-utils.c: New file.
	* guile/scm-value.c: New file.
	* guile/lib/gdb.scm: New file.
	* guile/lib/gdb/boot.scm: New file.
	* guile/lib/gdb/experimental.scm: New file.
	* guile/lib/gdb/init.scm: New file.
	* guile/lib/gdb/iterator.scm: New file.
	* guile/lib/gdb/printing.scm: New file.
	* guile/lib/gdb/types.scm: New file.
	* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
	(VPATH): Add $(GUILE_SRCDIR).
	(GUILE_DIR): New variable.
	(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
	(all): Add stamp-guile dependency.
	(stamp-guile): New rule.
	(clean-guile, install-guile, uninstall-guile): New rules.
	(install-only): Add install-guile dependency.
	(uninstall): Add uninstall-guile dependency.
	(clean): Add clean-guile dependency.

	doc/
	* Makefile.in (GDB_DOC_FILES): Add guile.texi.
	* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
	(Extending GDB): New menu entries Guile, Multiple Extension Languages.
	(Guile docs): Include guile.texi.
	(objfile-gdbdotext file): Add objfile-gdb.scm.
	(dotdebug_gdb_scripts section): Mention Guile scripts.
	(Multiple Extension Languages): New node.
	* guile.texi: New file.

	testsuite/
	* configure.ac (AC_OUTPUT): Add gdb.guile.
	* configure: Regenerate.
	* lib/gdb-guile.exp: New file.
	* lib/gdb.exp (get_target_charset): New function.
	* gdb.base/help.exp: Update expected output from "apropos apropos".
	* gdb.guile/Makefile.in: New file.
	* gdb.guile/guile.exp: New file.
	* gdb.guile/scm-arch.c: New file.
	* gdb.guile/scm-arch.exp: New file.
	* gdb.guile/scm-block.c: New file.
	* gdb.guile/scm-block.exp: New file.
	* gdb.guile/scm-breakpoint.c: New file.
	* gdb.guile/scm-breakpoint.exp: New file.
	* gdb.guile/scm-disasm.c: New file.
	* gdb.guile/scm-disasm.exp: New file.
	* gdb.guile/scm-equal.c: New file.
	* gdb.guile/scm-equal.exp: New file.
	* gdb.guile/scm-error.exp: New file.
	* gdb.guile/scm-error.scm: New file.
	* gdb.guile/scm-frame-args.c: New file.
	* gdb.guile/scm-frame-args.exp: New file.
	* gdb.guile/scm-frame-args.scm: New file.
	* gdb.guile/scm-frame-inline.c: New file.
	* gdb.guile/scm-frame-inline.exp: New file.
	* gdb.guile/scm-frame.c: New file.
	* gdb.guile/scm-frame.exp: New file.
	* gdb.guile/scm-generics.exp: New file.
	* gdb.guile/scm-gsmob.exp: New file.
	* gdb.guile/scm-iterator.c: New file.
	* gdb.guile/scm-iterator.exp: New file.
	* gdb.guile/scm-math.c: New file.
	* gdb.guile/scm-math.exp: New file.
	* gdb.guile/scm-objfile-script-gdb.in: New file.
	* gdb.guile/scm-objfile-script.c: New file.
	* gdb.guile/scm-objfile-script.exp: New file.
	* gdb.guile/scm-objfile.c: New file.
	* gdb.guile/scm-objfile.exp: New file.
	* gdb.guile/scm-ports.exp: New file.
	* gdb.guile/scm-pretty-print.c: New file.
	* gdb.guile/scm-pretty-print.exp: New file.
	* gdb.guile/scm-pretty-print.scm: New file.
	* gdb.guile/scm-section-script.c: New file.
	* gdb.guile/scm-section-script.exp: New file.
	* gdb.guile/scm-section-script.scm: New file.
	* gdb.guile/scm-symbol.c: New file.
	* gdb.guile/scm-symbol.exp: New file.
	* gdb.guile/scm-symtab-2.c: New file.
	* gdb.guile/scm-symtab.c: New file.
	* gdb.guile/scm-symtab.exp: New file.
	* gdb.guile/scm-type.c: New file.
	* gdb.guile/scm-type.exp: New file.
	* gdb.guile/scm-value-cc.cc: New file.
	* gdb.guile/scm-value-cc.exp: New file.
	* gdb.guile/scm-value.c: New file.
	* gdb.guile/scm-value.exp: New file.
	* gdb.guile/source2.scm: New file.
	* gdb.guile/types-module.cc: New file.
	* gdb.guile/types-module.exp: New file.
2014-02-09 19:40:01 -08:00
Doug Evans 4f8fcb74d3 fix copyright year in new files in previous checkin 2014-02-05 20:17:30 -08:00
Doug Evans 6dddc817c1 Extension Language API
* configure.ac (libpython checking): Remove all but python.o from
	CONFIG_OBS.  Remove all but python.c from CONFIG_SRCS.
	* configure: Regenerate.

	* Makefile.in (SFILES): Add extension.c.
	(HFILES_NO_SRCDIR): Add extension.h, extension-priv.h
	(COMMON_OBS): Add extension.o.
	* extension.h: New file.
	* extension-priv.h: New file.
	* extension.c: New file.

	* python/python-internal.h: #include "extension.h".
	(gdbpy_auto_load_enabled): Declare.
	(gdbpy_apply_val_pretty_printer): Declare.
	(gdbpy_apply_frame_filter): Declare.
	(gdbpy_preserve_values): Declare.
	(gdbpy_breakpoint_cond_says_stop): Declare.
	(gdbpy_breakpoint_has_cond): Declare.
	(void source_python_script_for_objfile): Delete.
	* python/python.c: #include "extension-priv.h".
	Delete inclusion of "observer.h".
	(extension_language_python): Moved here and renamed from
	script_language_python in py-auto-load.c.
	Redefined to be of type extension_language_defn.
	(python_extension_script_ops): New global.
	(python_extension_ops): New global.
	(struct python_env): New member previous_active.
	(restore_python_env): Call restore_active_ext_lang.
	(ensure_python_env): Call set_active_ext_lang.
	(gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static.
	New arg extlang.
	(gdbpy_set_quit_flag): Renamed from set_quit_flag, made static.
	New arg extlang.
	(gdbpy_check_quit_flag): Renamed from check_quit_flag, made static.
	New arg extlang.
	(gdbpy_eval_from_control_command): Renamed from
	eval_python_from_control_command, made static.  New arg extlang.
	(gdbpy_source_script) Renamed from source_python_script, made static.
	New arg extlang.
	(gdbpy_before_prompt_hook): Renamed from before_prompt_hook.  Change
	result to int.  New arg extlang.
	(gdbpy_source_objfile_script): Renamed from
	source_python_script_for_objfile, made static.  New arg extlang.
	(gdbpy_start_type_printers): Renamed from start_type_printers, made
	static.  New args extlang, extlang_printers.  Change result type to
	"void".
	(gdbpy_apply_type_printers): Renamed from apply_type_printers, made
	static.  New arg extlang.  Rename arg printers to extlang_printers
	and change type to ext_lang_type_printers *.
	(gdbpy_free_type_printers): Renamed from free_type_printers, made
	static.  Replace argument arg with extlang, extlang_printers.
	(!HAVE_PYTHON, eval_python_from_control_command): Delete.
	(!HAVE_PYTHON, source_python_script): Delete.
	(!HAVE_PYTHON, gdbpy_should_stop): Delete.
	(!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete.
	(!HAVE_PYTHON, start_type_printers): Delete.
	(!HAVE_PYTHON, apply_type_printers): Delete.
	(!HAVE_PYTHON, free_type_printers): Delete.
	(_initialize_python): Delete call to observer_attach_before_prompt.
	(finalize_python): Set/restore active extension language.
	(gdbpy_finish_initialization) Renamed from
	finish_python_initialization, made static.  New arg extlang.
	(gdbpy_initialized): New function.
	* python/python.h: #include "extension.h".  Delete #include
	"value.h", "mi/mi-cmds.h".
	(extension_language_python): Declare.
	(GDBPY_AUTO_FILE_NAME): Delete.
	(enum py_bt_status): Moved to extension.h and renamed to
	ext_lang_bt_status.
	(enum frame_filter_flags): Moved to extension.h.
	(enum py_frame_args): Moved to extension.h and renamed to
	ext_lang_frame_args.
	(finish_python_initialization): Delete.
	(eval_python_from_control_command): Delete.
	(source_python_script): Delete.
	(apply_val_pretty_printer): Delete.
	(apply_frame_filter): Delete.
	(preserve_python_values): Delete.
	(gdbpy_script_language_defn): Delete.
	(gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete.
	(start_type_printers, apply_type_printers, free_type_printers): Delete.

	* auto-load.c: #include "extension.h".
	(GDB_AUTO_FILE_NAME): Delete.
	(auto_load_gdb_scripts_enabled): Make public.  New arg extlang.
	(script_language_gdb): Delete, moved to extension.c and renamed to
	extension_language_gdb.
	(source_gdb_script_for_objfile): Delete.
	(auto_load_pspace_info): New member unsupported_script_warning_printed.
	(loaded_script): Change type of language member to
	struct extension_language_defn *.
	(init_loaded_scripts_info): Initialize
	unsupported_script_warning_printed.
	(maybe_add_script): Make static.  Change type of language arg to
	struct extension_language_defn *.
	(clear_section_scripts): Reset unsupported_script_warning_printed.
	(auto_load_objfile_script_1): Rewrite to use extension language API.
	(auto_load_objfile_script): Make public.  Remove support-compiled-in
	and auto-load-enabled checks, moved to auto_load_scripts_for_objfile.
	(source_section_scripts): Rewrite to use extension language API.
	(load_auto_scripts_for_objfile): Rewrite to use
	auto_load_scripts_for_objfile.
	(collect_matching_scripts_data): Change type of language member to
	struct extension_language_defn *.
	(auto_load_info_scripts): Change type of language arg to
	struct extension_language_defn *.
	(unsupported_script_warning_print): New function.
	(script_not_found_warning_print): Make static.
	(_initialize_auto_load): Rewrite construction of scripts-directory
	help.
	* auto-load.h (struct objfile): Add forward decl.
	(struct script_language): Delete.
	(struct auto_load_pspace_info): Add forward decl.
	(struct extension_language_defn): Add forward decl.
	(maybe_add_script): Delete.
	(auto_load_objfile_script): Declare.
	(script_not_found_warning_print): Delete.
	(auto_load_info_scripts): Update prototype.
	(auto_load_gdb_scripts_enabled): Declare.
	* python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from
	auto_load_python_scripts_enabled and made public.
	(script_language_python): Delete, moved to python.c.
	(gdbpy_script_language_defn): Delete.
	(info_auto_load_python_scripts): Update to use
	extension_language_python.

	* breakpoint.c (condition_command): Replace call to
	gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang.
	(bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop
	with call to breakpoint_ext_lang_cond_says_stop.
	* python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed
	from gdbpy_should_stop.  Change result type to enum scr_bp_stop.
	New arg slang.  Return SCR_BP_STOP_UNSET if py_bp_object is NULL.
	(gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond.
	New arg slang.
	(local_setattro): Print name of extension language with existing
	stop condition.

	* valprint.c (val_print, value_print): Update to call
	apply_ext_lang_val_pretty_printer.
	* cp-valprint.c (cp_print_value): Update call to
	apply_ext_lang_val_pretty_printer.
	* python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_apply_val_pretty_printer): Renamed from
	apply_val_pretty_printer.  New arg extlang.
	(!HAVE_PYTHON, apply_val_pretty_printer): Delete.

	* cli/cli-cmds.c (source_script_from_stream): Rewrite to use
	extension language API.
	* cli/cli-script.c (execute_control_command): Update to call
	eval_ext_lang_from_control_command.

	* mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use
	enum ext_lang_bt_status values.  Update call to
	apply_ext_lang_frame_filter.
	(mi_cmd_stack_list_locals): Ditto.
	(mi_cmd_stack_list_args): Ditto.
	(mi_cmd_stack_list_variables): Ditto.
	* mi/mi-main.c: Delete #include "python/python-internal.h".
	Add #include "extension.h".
	(mi_cmd_list_features): Replace reference to python internal variable
	gdb_python_initialized with call to ext_lang_initialized_p.

	* stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status.
	Update to use enum ext_lang_frame_args.  Update to call
	apply_ext_lang_frame_filter.
	* python/py-framefilter.c (extract_sym): Update to use enum
	ext_lang_bt_status.
	(extract_value, py_print_type, py_print_value): Ditto.
	(py_print_single_arg, enumerate_args, enumerate_locals): Ditto.
	(py_mi_print_variables, py_print_locals, py_print_args): Ditto.
	(py_print_frame): Ditto.
	(gdbpy_apply_frame_filter): Renamed from apply_frame_filter.
	New arg extlang.  Update to use enum ext_lang_bt_status.

	* top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to
	finish_python_initialization.  Replace with call to
	finish_ext_lang_initialization.

	* typeprint.c (do_free_global_table): Update to call
	free_ext_lang_type_printers.
	(create_global_typedef_table): Update to call
	start_ext_lang_type_printers.
	(find_global_typedef): Update to call apply_ext_lang_type_printers.
	* typeprint.h (struct ext_lang_type_printers): Add forward decl.
	(type_print_options): Change type of global_printers from "void *"
	to "struct ext_lang_type_printers *".

	* value.c (preserve_values): Update to call preserve_ext_lang_values.
	* python/py-value.c: Remove #ifdef HAVE_PYTHON.
	(gdbpy_preserve_values): Renamed from preserve_python_values.
	New arg extlang.
	(!HAVE_PYTHON, preserve_python_values): Delete.

	* utils.c (quit_flag): Delete, moved to extension.c.
	(clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to
	extension.c.

	* eval.c: Delete #include "python/python.h".
	* main.c: Delete #include "python/python.h".

	* defs.h: Update comment.

	testsuite/

	* gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected
	output.

	* gdb.gdb/python-interrupts.exp: New file.
2014-02-05 19:27:58 -08:00