Commit Graph

80 Commits

Author SHA1 Message Date
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
Tom Tromey 41bf6acad7 replace XZALLOC with XCNEW
This replaces XZALLOC with XCNEW and removes XZALLOC.
This change is purely mechanical.

2014-01-13  Tom Tromey  <tromey@redhat.com>

	* defs.h (XZALLOC): Remove.
	* ada-lang.c (get_ada_inferior_data): Use XCNEW, not XZALLOC.
	* ada-tasks.c (get_ada_tasks_pspace_data): Likewise.
	(get_ada_tasks_inferior_data): Likewise.
	* auto-load.c (get_auto_load_pspace_data): Likewise.
	* auxv.c (get_auxv_inferior_data): Likewise.
	* bfd-target.c (target_bfd_reopen): Likewise.
	* breakpoint.c (get_catch_syscall_inferior_data): Likewise.
	(deprecated_insert_raw_breakpoint): Likewise.
	* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
	* corelow.c (core_open): Likewise.
	* darwin-nat.c (darwin_check_new_threads): Likewise.
	(darwin_attach_pid): Likewise.
	* dummy-frame.c (dummy_frame_push): Likewise.
	* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
	* dwarf2loc.c (allocate_piece_closure): Likewise.
	* elfread.c (elf_symfile_segments): Likewise.
	* eval.c (ptrmath_type_p): Likewise.
	* exceptions.c (EXCEPTIONS_SIGJMP_BUF): Likewise.
	* gdbtypes.c (alloc_type_arch): Likewise.
	(alloc_type_instance): Likewise.
	* hppa-tdep.c (hppa_gdbarch_init): Likewise.
	* inf-child.c (inf_child_can_use_agent): Likewise.
	* inflow.c (get_inflow_inferior_data): Likewise.
	* infrun.c (save_infcall_suspend_state): Likewise.
	* jit.c (jit_reader_load): Likewise.
	(get_jit_objfile_data): Likewise.
	(get_jit_program_space_data): Likewise.
	(jit_object_open_impl): Likewise.
	(jit_symtab_open_impl): Likewise.
	(jit_block_open_impl): Likewise.
	(jit_frame_sniffer): Likewise.
	* linux-fork.c (add_fork): Likewise.
	* maint.c (make_command_stats_cleanup): Likewise.
	* objfiles.c (get_objfile_pspace_data): Likewise.
	* opencl-lang.c (struct lval_closure): Likewise.
	* osdata.c (osdata_start_osdata): Likewise.
	* progspace.c (new_address_space): Likewise.
	(add_program_space): Likewise.
	* remote-sim.c (get_sim_inferior_data): Likewise.
	* sh-tdep.c (sh_gdbarch_init): Likewise.
	* skip.c (Ignore): Likewise.
	(skip_delete_command): Likewise.
	* solib-aix.c (get_solib_aix_inferior_data): Likewise.
	(library_list_start_library): Likewise.
	(solib_aix_current_sos): Likewise.
	* solib-darwin.c (get_darwin_info): Likewise.
	(darwin_current_sos): Likewise.
	* solib-dsbt.c (get_dsbt_info): Likewise.
	* solib-ia64-hpux.c (new_so_list): Likewise.
	(ia64_hpux_get_solib_linkage_addr): Likewise.
	* solib-spu.c (append_ocl_sos): Likewise.
	(spu_current_sos): Likewise.
	* solib-svr4.c (get_svr4_info): Likewise.
	(svr4_keep_data_in_core): Likewise.
	(library_list_start_library): Likewise.
	(svr4_default_sos): Likewise.
	(svr4_read_so_list): Likewise.
	* solib-target.c (library_list_start_library): Likewise.
	(solib_target_current_sos): Likewise.
	* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
	* symfile-debug.c (install_symfile_debug_logging): Likewise.
	* symfile.c (default_symfile_segments): Likewise.
	* target-descriptions.c (tdesc_data_init): Likewise.
	(tdesc_create_reg): Likewise.
	(struct tdesc_type *): Likewise.
	(tdesc_create_vector): Likewise.
	(tdesc_set_struct_size): Likewise.
	(struct tdesc_type *): Likewise.
	(tdesc_free_feature): Likewise.
	(tdesc_create_feature): Likewise.
	* windows-nat.c (windows_add_thread): Likewise.
	(windows_make_so): Likewise.
	* xml-support.c (gdb_xml_body_text): Likewise.
	(gdb_xml_create_parser_and_cleanup): Likewise.
	(xml_process_xincludes): Likewise.
	* xml-syscall.c (allocate_syscalls_info): Likewise.
	(syscall_create_syscall_desc): Likewise.
2014-01-13 07:31:27 -07:00
Honggyu Kim e261678878 Remove duplicated #include's from GDB
This patch simply removes duplicated #include statements in the gdb/
directory.  If there are two duplicated #include statements, this patch
keeps the first #include and removes the second.

Those duplicates have been found by using the checkincludes.pl tool from
the Linux kernel and double checked manually once again if the #include
statements are affected by #ifdef macros.

2014-01-06  Honggyu Kim  <hong.gyu.kim@lge.com>

	* ada-lang.c: Remove duplicated include statements.
	* alphabsd-nat.c: Ditto.
	* amd64-darwin-tdep.c: Ditto.
	* amd64fbsd-nat.c: Ditto.
	* auto-load.c: Ditto.
	* ax-gdb.c: Ditto.
	* breakpoint.c: Ditto.
	* dbxread.c: Ditto.
	* fork-child.c: Ditto.
	* gdb_usleep.c: Ditto.
	* i386-darwin-tdep.c: Ditto.
	* i386fbsd-nat.c: Ditto.
	* infcmd.c: Ditto.
	* inferior.c: Ditto.
	* jv-lang.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-tdep.c: Ditto.
	* m68kbsd-nat.c: Ditto.
	* m68klinux-nat.c: Ditto.
	* microblaze-tdep.c: Ditto.
	* mips-linux-tdep.c: Ditto.
	* mn10300-tdep.c: Ditto.
	* nto-tdep.c: Ditto.
	* opencl-lang.c: Ditto.
	* osdata.c: Ditto.
	* printcmd.c: Ditto.
	* regcache.c: Ditto.
	* remote-m32r-sdi.c: Ditto.
	* remote.c: Ditto.
	* symfile.c: Ditto.
	* symtab.c: Ditto.
	* tilegx-linux-nat.c: Ditto.
	* tilegx-tdep.c: Ditto.
	* tracepoint.c: Ditto.
	* valops.c: Ditto.
	* vaxbsd-nat.c: Ditto.
	* windows-nat.c: Ditto.
	* xtensa-tdep.c: Ditto.
2014-01-07 14:14:30 -02:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Doug Evans c47cf54742 * auto-load.c (load_auto_scripts_for_objfile): Add some comments. 2013-12-04 22:08:38 -08:00
Doug Evans 5b2bf9471f Move .debug_gdb_script processing to auto-load.c.
Simplify handling of auto-loaded objfile scripts.

.debug_gdb_scripts was always intended to handle more than just python,
thus the rightful home for the code that processes it is not in py-foo.c.
This is just a cleanup to move the code to a better place.

This also simplifies the handling of the ${objfile}-${suffix} auto-loaded
scripts.  There's no need for each of the the handlers to do is-safe-to-load
checking, or call maybe_add_script.  Doing it in the caller removes the
duplication.

	* auto-load.h (script_language): New members name, auto_load_enabled.
	Add missing comments on struct members.
	(auto_load_objfile_script): Delete.
	* auto-load.c: #include "cli/cli-cmds.h".
	(auto_load_gdb_scripts_enabled): New function.
	(script_language_gdb): Update, add new members.
	(source_gdb_script_for_objfile): Simplify, auto-load safe-checking
	and call to maybe_add_script moved to caller.
	(auto_load_objfile_script_1): Auto-load safe-checking and
	call to maybe_add_script moved here.
	(auto_load_objfile_script): Make static.  Early exit if support for
	scripting language hasn't been compiled in, or auto-loading has been
	disabled.
	(source_section_scripts): Argument "source_name" renamed to
	"section_name".  All uses updated.  Replace uses of AUTO_SECTION_NAME
	with section_name.  Skip loading script if support for scripting
	language hasn't been compiled in, or auto-loading has been disabled.
	Call language->source_script_for_objfile instead of calling
	source_python_script_for_objfile directly.
	(load_auto_scripts_for_objfile): Update.
	* python/py-auto-load.c: Delete #include "cli/cli-cmds.h".
	(gdbpy_load_auto_script_for_objfile): Delete.
	(auto_load_python_scripts_enabled): New function.
	(script_language_python): Update, add new members.
	(gdbpy_script_language_defn): New function.
	* python/python.h (gdbpy_load_auto_scripts_for_objfile): Delete.
	(gdbpy_script_language_defn): Declare.

	* auto-load.c (AUTO_SECTION_NAME): Moved here and renamed from
	py-auto-load.c, GDBPY_AUTO_SECTION_NAME.
	(source_section_scripts): Moved here from py-auto-load.c.
	(auto_load_section_scripts): Ditto.
	* python/py-auto-load.c (GDBPY_AUTO_SECTION_NAME): Moved to
	auto-load.c, renamed AUTO_SECTION_NAME.
	(source_section_scripts, auto_load_section_scripts): Moved to
	auto-load.c.
2013-11-29 21:29:26 -08:00
Yao Qi 487ad57ccf Simplify REGISTRY cleanup usages
In registry.c:registry_clear_data, the registered data is iterated and
invoke each 'free' function with the data passed:

  for (registration = data_registry->registrations, i = 0;
       i < fields->num_data;
       registration = registration->next, i++)
    if (fields->data[i] != NULL && registration->data->free != NULL)
      adaptor (registration->data->free, container, fields->data[i]);

we can see that data is passed to function 'free' and data is not NULL.
In each usage, we don't have to get the data again through key and
do NULL pointer checking.  This patch is to simplify them.

gdb:

2013-10-29  Yao Qi  <yao@codesourcery.com>

	* auto-load.c (auto_load_pspace_data_cleanup): Get data from
	parameter 'arg' instead of from program_space_data.
	* objfiles.c (objfiles_pspace_data_cleanup): Likewise.
	* solib-darwin.c (darwin_pspace_data_cleanup): Likewise.
	* solib-dsbt.c (dsbt_pspace_data_cleanup): Likewise.
	* solib-svr4.c (svr4_pspace_data_cleanup): Likewise.
	* inflow.c (inflow_inferior_data_cleanup): Get data from
	parameter 'arg' instead of inferior_data.
	* registry.h: Add comments.
2013-10-29 14:36:29 +08:00
Jan Kratochvil 40135bb14b New flag OBJF_NOT_FILENAME
gdb/
2013-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>

	New flag OBJF_NOT_FILENAME.
	* auto-load.c (auto_load_objfile_script): Check also OBJF_NOT_FILENAME.
	* jit.c (jit_object_close_impl): Use OBJF_NOT_FILENAME for
	allocate_objfile.
	(jit_bfd_try_read_symtab): Use OBJF_NOT_FILENAME for
	symbol_file_add_from_bfd.
	* jv-lang.c (get_dynamics_objfile): Use OBJF_NOT_FILENAME for
	allocate_objfile.
	* objfiles.c (allocate_objfile): Assert OBJF_NOT_FILENAME if NAME is
	NULL.
	* objfiles.h (OBJF_NOT_FILENAME): New.
2013-10-09 13:22:36 +00:00
Jan Kratochvil 4262abfb98 Code cleanup: Add objfile_name accessor
gdb/
2013-09-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Code cleanup: Add objfile_name accessor function.
	* ada-lang.c (is_known_support_routine): Use objfile_name.
	* auto-load.c (source_gdb_script_for_objfile)
	(auto_load_objfile_script): Likewise.
	* coffread.c (coff_symtab_read, read_one_sym): Likewise.
	* dbxread.c (dbx_symfile_read): Likewise.
	* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
	* dwarf2loc.c (locexpr_describe_location_piece): Likewise.
	* dwarf2read.c (dwarf2_get_dwz_file, dwarf2_read_index)
	(dw2_symtab_iter_next, dw2_expand_symtabs_matching)
	(lookup_dwp_signatured_type, lookup_dwo_unit)
	(dwarf2_build_psymtabs_hard, scan_partial_symbols, process_queue)
	(fixup_go_packaging, process_imported_unit_die, dwarf2_physname)
	(read_import_statement, create_dwo_cu, open_and_init_dwp_file)
	(lookup_dwo_cutu, read_call_site_scope, dwarf2_ranges_read)
	(dwarf2_record_block_ranges, read_common_block, read_typedef)
	(read_subrange_type, load_partial_dies, read_partial_die)
	(read_addr_index_1, read_str_index, dwarf_decode_lines_1)
	(die_containing_type, build_error_marker_type, lookup_die_type)
	(follow_die_ref_or_sig, follow_die_ref, dwarf2_fetch_die_loc_sect_off)
	(dwarf2_fetch_constant_bytes, follow_die_sig, get_signatured_type)
	(get_DW_AT_signature_type, write_psymtabs_to_index)
	(save_gdb_index_command): Likewise.
	* elfread.c (find_separate_debug_file_by_buildid, elf_symfile_read):
	Likewise.
	* expprint.c (dump_subexp_body_standard): Likewise.
	* gdbtypes.c (type_name_no_tag_or_error): Likewise.
	* jit.c (jit_object_close_impl): Use the objfile field name renamed to
	original_name.
	* linux-thread-db.c (try_thread_db_load_from_pdir_1): New variable
	obj_name, use objfile_name for it, use the variable.
	(try_thread_db_load_from_pdir, has_libpthread, thread_db_new_objfile):
	Use objfile_name.
	* machoread.c (macho_symtab_read, macho_check_dsym)
	(macho_symfile_relocate): Likewise.
	* maint.c (maintenance_translate_address): Likewise.
	* minidebug.c (find_separate_debug_file_in_section): Likewise.
	* minsyms.c (install_minimal_symbols): Likewise.
	* objfiles.c (allocate_objfile): Use the objfile field name renamed to
	original_name.
	(filter_overlapping_sections): Use objfile_name.
	(objfile_name): New function.
	* objfiles.h (struct objfile): Rename field name to original_name.
	(objfile_name): New prototype.
	* printcmd.c (sym_info, address_info): Use objfile_name.
	* probe.c (parse_probes, collect_probes, compare_probes)
	(info_probes_for_ops): Likewise.
	* progspace.c (clone_program_space): Likewise.
	* psymtab.c (require_partial_symbols, dump_psymtab, allocate_psymtab)
	(maintenance_info_psymtabs): Likewise.
	* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile)
	(source_section_scripts): Likewise.
	* python/py-objfile.c (objfpy_get_filename): Likewise.
	* python/py-progspace.c (pspy_get_filename): Likewise.
	* solib-aix.c (solib_aix_get_toc_value): Likewise.
	* solib-som.c (match_main, som_solib_section_offsets): Likewise.
	* solib.c (solib_read_symbols): Likewise.
	* stabsread.c (scan_file_globals): Likewise.
	* stap-probe.c (handle_stap_probe): Likewise.
	* symfile.c (symbol_file_clear, separate_debug_file_exists)
	(find_separate_debug_file_by_debuglink): Likewise.
	(reread_symbols): Likewise.  Use the objfile field name renamed to
	original_name.
	(allocate_symtab): Use objfile_name.
	* symmisc.c (print_symbol_bcache_statistics, print_objfile_statistics)
	(dump_objfile, dump_msymbols, dump_symtab_1)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs): Likewise.
	* target.c (target_translate_tls_address, target_info): Likewise.
	* xcoffread.c (xcoff_initial_scan): Make variable name const.  Use
	objfile_name.
2013-09-24 13:57:38 +00:00
Tom Tromey 614c279dda PR gdb/7912:
* Makefile.in (SFILES): Add filestuff.c
	(COMMON_OBS): Add filestuff.o.
	(filestuff.o): New target.
	* auto-load.c (auto_load_objfile_script_1): Use
	gdb_fopen_cloexec.
	* auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec.
	* cli/cli-cmds.c (shell_escape): Call close_most_fds.
	* cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec.
	* common/agent.c (gdb_connect_sync_socket): Use
	gdb_socket_cloexec.
	* common/filestuff.c: New file.
	* common/filestuff.h: New file.
	* common/linux-osdata.c (linux_common_core_of_thread)
	(command_from_pid, commandline_from_pid, print_source_lines)
	(linux_xfer_osdata_shm, linux_xfer_osdata_sem)
	(linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use
	gdb_fopen_cloexec.
	* common/linux-procfs.c (linux_proc_get_int)
	(linux_proc_pid_has_state): Use gdb_fopen_cloexec.
	* config.in, configure: Rebuild.
	* configure.ac: Don't check for sys/socket.h.  Check for
	fdwalk, pipe2.
	* corelow.c (core_open): Use gdb_open_cloexec.
	* dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec.
	* fork-child.c (fork_inferior): Call close_most_fds.
	* gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec.
	* inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec.
	* linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals):
	Use gdb_fopen_cloexec.
	(linux_proc_xfer_partial, linux_proc_xfer_spu): Use
	gdb_open_cloexec.
	(linux_async_pipe): Use gdb_pipe_cloexec.
	* remote-fileio.c (remote_fileio_func_open): Use
	gdb_open_cloexec.
	* remote.c (remote_file_put, remote_file_get): Use
	gdb_fopen_cloexec.
	* ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec,
	close_most_fds.
	* ser-tcp.c (net_open): Use gdb_socket_cloexec.
	* ser-unix.c (hardwire_open): Use gdb_open_cloexec.
	* solib.c (solib_find): Use gdb_open_cloexec.
	* source.c (openp, find_and_open_source): Use gdb_open_cloexec.
	* tracepoint.c (tfile_start): Use gdb_fopen_cloexec.
	(tfile_open): Use gdb_open_cloexec.
	* tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec.
	* ui-file.c (gdb_fopen): Use gdb_fopen_cloexec.
	* xml-support.c (xml_fetch_content_from_file): Use
	gdb_fopen_cloexec.
	* main.c (captured_main): Call notice_open_fds.
gdbserver
	* Makefile.in (SFILES): Add filestuff.c.
	(OBS): Add filestuff.o.
	(filestuff.o): New target.
	* config.in, configure: Rebuild.
	* configure.ac: Check for fdwalk, pipe2.
2013-04-22 16:46:15 +00:00
Aleksandar Ristovski 0e43993ae8 2013-01-31 Aleksandar Ristovski <aristovski@qnx.com>
* auto-load.c (auto_load_expand_dir_vars): Remove unused dir_vec.
        * ax-gdb.c (gen_printf): Remove unused expr, i, bot, fr, flen, fmt.
        * ax-general.c (ax_print): Remove unused is_float.
        * blockframe.c (block_innermost_frame): Remove unused start, end.
        * break-catch-sig.c (catch_signal_command): Remove unused gdbarch.

Reference: http://sourceware.org/ml/gdb-patches/2013-01/msg00752.html
2013-01-31 16:27:50 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Jan Kratochvil 9a950c7c83 gdb/
Implement auto-load user conveniences suggested by Doug Evans.
	* auto-load.c: Include top.h.
	(file_is_auto_load_safe): New variable advice_printed.  Print advice.
	(_initialize_auto_load): New variable scripts_directory_help.  Mention
	GDBPY_AUTO_FILE_NAME and GDB_AUTO_FILE_NAME for set auto-load
	scripts-directory.  Document in online help one can use also files for
	set auto-load safe-path.
	* python/py-auto-load.c: (GDBPY_AUTO_FILE_NAME): Move it from here ...
	* python/python.h (GDBPY_AUTO_FILE_NAME): ... to here.
2012-09-17 18:26:06 +00:00
Jan Kratochvil e968779960 gdb/
* auto-load.c (auto_load_objfile_script): Rename to ...
	(auto_load_objfile_script_1): ... here, change variable realname to
	parameter realname, document it, add return value, add variable retval.
	(auto_load_objfile_script): New function.

gdb/doc/
	* gdb.texinfo (objfile-gdb.py file): New paragraph for .exe stripping.
2012-08-27 16:50:54 +00:00
Tom Tromey 8e260fc026 * auto-load.c (_initialize_auto_load): Update.
* solib-svr4.c (_initialize_svr4_solib): Update
	* solib-dsbt.c (_initialize_dsbt_solib): Update.
	* solib-darwin.c (_initialize_darwin_solib): Update.
	* registry.h: New file.
	* python/py-progspace.c (gdbpy_initialize_pspace): Update.
	* python/py-inferior.c (gdbpy_initialize_inferior): Update.
	* progspace.h: Include registry.h.  Use DECLARE_REGISTRY.
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(clear_program_space_data, set_program_space_data)
	(program_space_data): Don't declare.
	* progspace.c: Use DEFINE_REGISTRY.
	(struct program_space_data, struct
	program_space_data_registration, struct
	program_space_data_registry, program_space_data_registry)
	(register_program_space_data_with_cleanup)
	(register_program_space_data, program_space_alloc_data)
	(program_space_free_data, clear_program_space_data)
	(set_program_space_data, program_space_data): Remove.
	* objfiles.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct objfile) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_objfile_data_with_cleanup, register_objfile_data)
	(clear_objfile_data, set_objfile_data, objfile_data): Don't
	declare.
	* objfiles.c: Use DEFINE_REGISTRY.
	(struct objfile_data, struct objfile_data_registration, struct
	objfile_data_registry, objfile_data_registry)
	(register_objfile_data_with_cleanup, register_objfile_data)
	(objfile_alloc_data, objfile_free_data, clear_objfile_data)
	(set_objfile_data, objfile_data): Remove.
	(_initialize_objfiles): Update.
	* jit.c (_initialize_jit): Update.
	* inflow.c (_initialize_inflow): Update.
	* inferior.h: Include registry.h.  Use DECLARE_REGISTRY.
	(struct inferior) <data, num_data>: Replace with REGISTRY_FIELDS.
	(register_inferior_data_with_cleanup, register_inferior_data)
	(clear_inferior_data, set_inferior_data, inferior_data): Don't
	declare.
	* inferior.c: Use DEFINE_REGISTRY.
	(struct inferior_data, struct inferior_data_registration, struct
	inferior_data_registry, inferior_data_registry)
	(register_inferior_data_with_cleanup, register_inferior_data)
	(inferior_alloc_data, inferior_free_data  clear_inferior_data)
	(set_inferior_data, inferior_data): Remove.
	* auxv.c (_initialize_auxv): Update.
	* ada-lang.c (_initialize_ada_language): Update.
	* breakpoint.c (_initialize_breakpoint): Update.
	* i386-nat.c (i386_use_watchpoints): Update.
2012-08-22 15:17:21 +00:00
Yao Qi 5b9afe8a35 gdb/
* cli/cli-decode.c (set_cmd_prefix): New.
	(lookup_cmd_for_prefixlist): New.
	(add_prefix_cmd): Call set_cmd_prefix and update field 'prefix'
	of each cmd_list_element in *prefixlist.
	(add_setshow_cmd_full): set_cmd_prefix.
	(add_alias_cmd): Likewise.
	* cli/cli-decode.h (struct cmd_list_element) <prefix>: New field.
	Declare 'auto_boolean_enums'.
	* cli/cli-setshow.c: Include "observer.h".
	(notify_command_param_changed_p): New.
	(add_setshow_auto_boolean_cmd): Move auto_boolean_enums out.
	Remove 'static'.
	(do_setshow_command): Split it to ...
	(do_set_command, do_show_command): ... them.  New.
	(do_set_command): Call observer_notify_command_param_changed if
	notify_command_param_changed_p returns true.
	(cmd_show_list): Caller update.
	* auto-load.c (set_auto_load_cmd): Likewise.
	* remote.c (show_remote_cmd): Likewise.
	* cli/cli-setshow.h: Update declarations.
	* top.c (execute_command): Call do_set_command and do_show_command.

	* NEWS: Mention new MI notification.
	* mi/mi-interp.c: Declare mi_command_param_changed.
	(mi_interpreter_init): Attach mi_command_param_changed to
	observer command_param_changed.
	(mi_command_param_changed): New.
	Remove mi_suppress_breakpoint_notifications.
	Define global variable mi_suppress_notification.
	(mi_breakpoint_created): Update.
	(mi_breakpoint_deleted): Likewise.
	(mi_breakpoint_modified): Likewise.
	* mi/mi-main.c (mi_cmd_execute): Likewise.  Check command
	'gdb-set' and set mi_suppress_notification.
	* mi/mi-main.h: (mi_suppress_notification): New struct.

gdb/doc/

	* observer.texi: New observer command_param_changed.
	* gdb.texinfo (GDB/MI Async Records): Doc for '=cmd-param-changed'.

gdb/testsuite/

	* gdb.mi/mi-cmd-param-changed.exp: New.
	* gdb.mi/mi-cli.exp: Update for MI notification "=cmd-param-changed".
	* gdb.mi/mi-var-rtti.exp, gdb.mi/mi2-cli.exp: Likewise.
	* gdb.mi/mi2-prompt.exp: Likewise.
2012-08-09 12:53:46 +00:00
Jan Kratochvil 7cfe01b4b3 gdb/
* auto-load.c (auto_load_info_scripts): Remove immediate_quit increment
	and decrement.
2012-07-26 18:21:50 +00:00
Jan Kratochvil 202cbf1c52 gdb/
Support shell wildcards for 'set auto-load safe-path'.
	* auto-load.c: Include fnmatch.h.
	(filename_is_in_dir): Rename to ...
	(filename_is_in_pattern_1, filename_is_in_pattern): ... here and split
	it.  Update function comment.  Rename dir_len to pattern_len.  New
	variables filename_len, pattern and filename.  Add more DEBUG_AUTO_LOAD
	messages.  Use gdb_filename_fnmatch.
	(filename_is_in_auto_load_safe_path_vec): Rename variable dir to
	pattern.
	(_initialize_auto_load): Extend the "set auto-load safe-path" help text.
	* defs.h (gdb_filename_fnmatch): New declaration.
	* utils.c: Include fnmatch.h.
	(gdb_filename_fnmatch): New function.

gdb/doc/
	* gdb.texinfo (Auto-loading safe path): Note the shell wildcard
	possibility.
2012-07-02 10:57:34 +00:00
Jan Kratochvil 1564a2618d gdb/
* NEWS (--with-auto-load-dir): Prepend $debugdir to the default path.
	Describe it.
	* auto-load.c (auto_load_expand_dir_vars): New function.
	(auto_load_safe_path_vec_update): Use it, remove the
	substitute_path_component call thanks to it.
	(auto_load_objfile_script): Remove the debug_file_directory processing.
	Use auto_load_expand_dir_vars, remove the substitute_path_component
	call thanks to it.
	* configure: Regenerate.
	* configure.ac (--with-auto-load-dir): Prepend $debugdir to the default
	path.  Escape $ also for $debugdir.
	(--with_auto_load_safe_path): Escape $ also for $debugdir.
	* utils.c (substitute_path_component): Accept also DIRNAME_SEPARATOR.

gdb/doc/
	* gdb.texinfo (Separate Debug Files): New anchor debug-file-directory.
	Mention also --with-separate-debug-dir.
	(Auto-loading): Prepend $debugdir in the sample output.
	(Auto-loading safe path): Likewise.  Mention also $debugdir for the
	auto-load safe-path variable.
	(objfile-gdb.py file): Remove the extra debug-file-directory paragraph.
	Mention also $debugdir for 'set auto-load scripts-directory'.
2012-05-20 20:35:19 +00:00
Jan Kratochvil aff139ffa6 gdb/
Rename $ddir to $datadir.
	* NEWS (--with-auto-load-dir): Rename $ddir to $datadir.
	* auto-load.c (auto_load_safe_path_vec_update)
	(auto_load_gdb_datadir_changed, auto_load_objfile_script): Likewise.
	* configure: Regenerate.
	* configure.ac (--with-auto-load-dir, --with-auto-load-safe-path):
	Likewise.  Remove the 'use $ddir' help string.

gdb/doc/
	Rename $ddir to $datadir.
	* gdb.texinfo (Auto-loading, Auto-loading safe path)
	(objfile-gdb.py file): Rename $ddir to $datadir.
2012-05-18 17:47:31 +00:00
Jan Kratochvil f7bfa992df gdb/
* auto-load.c (show_auto_load_safe_path): Accept any combination of
	DIRNAME_SEPARATOR and IS_DIR_SEPARATOR for wild-match.
2012-05-18 17:44:37 +00:00
Jan Kratochvil 7349ff92c2 gdb/
Implement multi-component --with-auto-load-dir.
	* NEWS (set auto-load scripts-directory, --with-auto-load-dir): New
	entries.
	(--with-auto-load-safe-path): Update the default value description.
	* auto-load.c (auto_load_dir, set_auto_load_dir, show_auto_load_dir):
	New.
	(auto_load_objfile_script): Add DEBUG_AUTO_LOAD output.  Remove
	GDB_DATADIR NULL check.  Replace GDB_DATADIR/auto-load by
	AUTO_LOAD_DIR.  Support $ddir and multiple components in it.
	(_initialize_auto_load): Initialize also auto_load_dir.  Install new
	"set auto-load scripts-directory".
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (--with-auto-load-dir): New configure option.
	(--auto-load-safe-path): Change the default to --with-auto-load-dir.

gdb/doc/
	Implement multi-component --with-auto-load-dir.
	* gdb.texinfo (Auto-loading): New references
	for 'set auto-load scripts-directory'
	and 'show auto-load scripts-directory'.
	(Auto-loading safe path): Describe the new default.  Move $ddir
	substituation reference to 'objfile-gdb.py file'.
	(objfile-gdb.py file): Describe script-name alias.  Change real-name to
	script-name.  Describe new 'set auto-load scripts-directory'
	and 'show auto-load scripts-directory'.
2012-05-11 18:20:26 +00:00
Jan Kratochvil 6dea1fbd79 gdb/
Provide $ddir substitution for --with-auto-load-safe-path.
	* NEWS (--with-auto-load-safe-path, --without-auto-load-safe-path): New
	entries.
	* auto-load.c: Include observer.h.
	(auto_load_safe_path_vec_update): Call substitute_path_component for
	each component.  New variable ddir_subst.
	(auto_load_gdb_datadir_changed): New function.
	(set_auto_load_safe_path): Rename DEFAULT_AUTO_LOAD_SAFE_PATH to
	AUTO_LOAD_SAFE_PATH.  New comment.
	(_initialize_auto_load): Rename DEFAULT_AUTO_LOAD_SAFE_PATH to
	AUTO_LOAD_SAFE_PATH.  Install auto_load_gdb_datadir_changed.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (--auto-load-safe-path): Rename
	DEFAULT_AUTO_LOAD_SAFE_PATH to AUTO_LOAD_SAFE_PATH.  Default to
	GDB_DATADIR/auto-load.
	* defs.h (substitute_path_component): New declaration.
	* top.c: Include observer.h.
	(set_gdb_datadir): New function.
	(init_main): Install it for "set data-directory".
	* utils.c (substitute_path_component): New function.

gdb/doc/
	Provide $ddir substitution for --with-auto-load-safe-path.
	* gdb.texinfo (Auto-loading): Replace /usr/local by $ddir/auto-load.
	(Auto-loading safe path): Likewise.  Mention the default value,
	$ddir substitution, --with-auto-load-safe-path and
	--without-auto-load-safe-path.
	* observer.texi (gdb_datadir_changed): New.
2012-05-11 18:13:26 +00:00
Jan Kratochvil b09aca3aa7 gdb/
Make auto-load handle multiple components of DEBUG_FILE_DIRECTORY.
	* auto-load.c (auto_load_objfile_script): Remove check for NULL
	DEBUG_FILE_DIRECTORY.  Handle multiple components of
	DEBUG_FILE_DIRECTORY.
2012-05-11 18:06:28 +00:00
Jan Kratochvil af2c151515 gdb/
* auto-load.c (set_auto_load_safe_path): Reset AUTO_LOAD_SAFE_PATH
	back to DEFAULT_AUTO_LOAD_SAFE_PATH if it is being set to "".
	(show_auto_load_safe_path): Check any-directory by comparison with "/".
	(add_auto_load_safe_path): Change the error message.
	(_initialize_auto_load): Change the "safe-path" help text.
	* configure: Regenerate
	* configure.ac (--without-auto-load-safe-path): Set
	WITH_AUTO_LOAD_SAFE_PATH to /.

gdb/doc/
	* gdb.texinfo (Auto-loading safe path): Make 'directories'
	for 'set auto-load safe-path' optional.  Mention if it is omitted.
	Change disabling security protection condition to "/", twice.
2012-05-06 15:31:04 +00:00
Jan Kratochvil 1ef7171746 gdb/
Fix --without-auto-load-safe-path for MS-Windows host platform.
	* auto-load.c (filename_is_in_dir): Return 1 for DIR_LEN 0.
2012-05-02 20:00:36 +00:00
Jan Kratochvil 4dc84fd109 gdb/
New option "set debug auto-load".
	* NEWS: New commands "set debug auto-load" and "show debug auto-load".
	* auto-load.c (debug_auto_load, show_debug_auto_load: New.
	(auto_load_safe_path_vec_update)
	(filename_is_in_auto_load_safe_path_vec): Call fprintf_unfiltered
	if DEBUG_AUTO_LOAD.
	(file_is_auto_load_safe): New parameters debug_fmt and ....
	Call fprintf_unfiltered if DEBUG_AUTO_LOAD.
	(source_gdb_script_for_objfile): Extend the file_is_auto_load_safe
	caller by explanatory string.
	(_initialize_auto_load): Register "set debug auto-load".
	* auto-load.h (file_is_auto_load_safe): New parameters debug_fmt
	and ....
	* linux-thread-db.c (try_thread_db_load_from_pdir_1)
	(try_thread_db_load_from_dir): Extend the file_is_auto_load_safe caller
	by explanatory string.
	* main.c (captured_main): Likewise.
	* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile)
	(source_section_scripts): Likewise.

gdb/doc/
	New option "set debug auto-load".
	* gdb.texinfo (Auto-loading): New menu item for auto-load verbose mode.
	(auto-load verbose mode): New node.
2012-04-17 15:56:21 +00:00
Jan Kratochvil bccbefd2aa gdb/
New option "set auto-load safe-path".
	* NEWS: New commands "set auto-load safe-path"
	and "show auto-load safe-path".
	* auto-load.c: Include gdb_vecs.h, readline/tilde.h and completer.h.
	(auto_load_safe_path, auto_load_safe_path_vec)
	(auto_load_safe_path_vec_update, set_auto_load_safe_path)
	(show_auto_load_safe_path, add_auto_load_safe_path, filename_is_in_dir)
	(filename_is_in_auto_load_safe_path_vec, file_is_auto_load_safe): New.
	(source_gdb_script_for_objfile): New variable is_safe.  Call
	file_is_auto_load_safe.  Return if it is not.
	(struct loaded_script): New field loaded.
	(maybe_add_script): Add parameter loaded.  Initialize SLOT with it.
	(print_script): Use LOADED indicator instead of FULL_PATH.  Change
	output "Missing" to "No".
	(_initialize_auto_load): New variable cmd.  Initialize
	auto_load_safe_path.  Register "set auto-load safe-path",
	"show auto-load safe-path" and "add-auto-load-safe-path".
	* auto-load.h (maybe_add_script): Add parameter loaded.
	(file_is_auto_load_safe): New declaration.
	* config.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: New parameters --with-auto-load-safe-path
	and --without-auto-load-safe-path.
	* linux-thread-db.c (try_thread_db_load_from_pdir_1)
	(try_thread_db_load_from_dir): Check file_is_auto_load_safe first.
	* main.c (captured_main): Check file_is_auto_load_safe for
	LOCAL_GDBINIT.
	* python/py-auto-load.c (gdbpy_load_auto_script_for_objfile): New
	variable is_safe.  Call file_is_auto_load_safe.  Return if it is not.
	(source_section_scripts): Call file_is_auto_load_safe.  Return if it is
	not.

gdb/doc/
	New option "set auto-load safe-path".
	* gdb.texinfo (Auto-loading): Extend the "show auto-load"
	and "info auto-load" examples for safe-path.  Put there also references
	for "set auto-load safe-path" and "show auto-load safe-path".
	New menu item for Auto-loading safe path.
	(Auto-loading safe path): New node.
	(Python Auto-loading): Update the expected output from "Missing"
	to "No".

gdb/testsuite/
	New option "set auto-load safe-path".
	* gdb.python/py-objfile-script.exp (set auto-load safe-path): New.
	* gdb.python/py-section-script.exp (set auto-load safe-path): New.
2012-04-17 15:54:35 +00:00
Jan Kratochvil bf88dd6849 gdb/
auto-load: Implementation.
	* NEWS: New descriptions for "info auto-load",
	"info auto-load gdb-scripts", "info auto-load python-scripts",
	"info auto-load local-gdbinit" and "info auto-load libthread-db".
	Deprecate "info auto-load-scripts", "set auto-load-scripts on|off"
	and "show auto-load-scripts".  New description for "set auto-load",
	"show auto-load", "set auto-load gdb-scripts",
	"show auto-load gdb-scripts", "set auto-load python-scripts",
	"show auto-load python-scripts", "set auto-load local-gdbinit",
	"show auto-load local-gdbinit", "set auto-load libthread-db" and
	"show auto-load libthread-db".
	* auto-load.c: Remove include python/python-internal.h.  Add includes
	exceptions.h, cli/cli-script.h, gdbcmd.h, cli/cli-decode.h and
	cli/cli-setshow.h.
	(GDB_AUTO_FILE_NAME, source_gdb_script_for_objfile)
	(auto_load_gdb_scripts, show_auto_load_gdb_scripts): New.
	(gdbpy_global_auto_load): Rename to ...
	(global_auto_load): ... here.
	(auto_load_local_gdbinit, auto_load_local_gdbinit_pathname)
	(auto_load_local_gdbinit_loaded, show_auto_load_local_gdbinit)
	(script_language_gdb, source_gdb_script_for_objfile): New.
	(struct loaded_script): New field language.
	(hash_loaded_script_entry, eq_loaded_script_entry): Calculate also
	LANGUAGE.
	(maybe_add_script): Add parameter language.  Drop redundant
	entry.full_path initialization.  Initialize entry.language and
	(*slot)->language.
	(auto_load_objfile_script): Change parameter suffix to language.
	Remove the call of maybe_add_script.
	Call language->source_script_for_objfile.
	(load_auto_scripts_for_objfile, struct collect_matching_scripts_data):
	New.
	(collect_matching_scripts): Adjust it for
	struct collect_matching_scripts_data.
	(auto_load_info_scripts_pattern_nl): New variable.
	(info_auto_load_scripts): Rename to ...
	(auto_load_info_scripts): ... here, add parameter language.  Adjust it
	for struct collect_matching_scripts_data.
	(info_auto_load_gdb_scripts, info_auto_load_local_gdbinit)
	(set_auto_load_cmd, auto_load_set_cmdlist_get, show_auto_load_cmd)
	(auto_load_show_cmdlist_get, info_auto_load_cmd)
	(auto_load_info_cmdlist_get): New.
	(_initialize_auto_load): Move add_info of "auto-load-scripts" to
	python/py-auto-load.c.  New installment for "set auto-load gdb-scripts",
	"info auto-load gdb-scripts", "set auto-load local-gdbinit" and
	"info auto-load local-gdbinit".
	* auto-load.h (struct script_language): New.
	(gdbpy_global_auto_load): Rename to ...
	(global_auto_load): ... here.
	(auto_load_local_gdbinit, auto_load_local_gdbinit_pathname)
	(auto_load_local_gdbinit_loaded): New declarations.
	(maybe_add_script): New parameter language.
	(auto_load_objfile_script): Change parameter suffix to language.
	(load_auto_scripts_for_objfile, auto_load_info_scripts_pattern_nl)
	(auto_load_info_scripts, auto_load_set_cmdlist_get)
	(auto_load_show_cmdlist_get, auto_load_info_cmdlist_get): New
	declarations.
	* linux-thread-db.c: Include auto-load.h and ctype.h.
	(auto_load_thread_db, show_auto_load_thread_db): New.
	(struct thread_db_info): New field filename.
	(delete_thread_db_info): Call xfree for FILENAME.
	(try_thread_db_load): Initialize FILENAME.
	(try_thread_db_load_from_pdir, try_thread_db_load_from_dir): Return
	if !AUTO_LOAD_THREAD_DB.
	(info_auto_load_libthread_db_compare, info_auto_load_libthread_db): New.
	(_initialize_thread_db): Install auto_load_thread_db
	as "set auto-load libthread-db" and install info_auto_load_libthread_db
	as "info auto-load libthread-db".
	* main.c (captured_main): Rename gdbpy_global_auto_load to
	global_auto_load.  Initialize AUTO_LOAD_LOCAL_GDBINIT_PATHNAME and
	AUTO_LOAD_LOCAL_GDBINIT_LOADED.
	(print_gdb_help): Extend the help for 'local init file'.
	* python/py-auto-load.c: Remove a comment about gdb scripts extension.
	(GDBPY_AUTO_SECTION_NAME): Extend the comment it is Python specific.
	(auto_load_scripts): Rename to ...
	(auto_load_python_scripts): ... here, update the comment.
	(gdbpy_load_auto_script_for_objfile): New declaration.
	(show_auto_load_python_scripts, script_language_python)
	(gdbpy_load_auto_script_for_objfile): New.
	(source_section_scripts): Refactor the code.
	(load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here, update the
	auto_load_objfile_script caller, drop GDBPY_GLOBAL_AUTO_LOAD checking.
	(info_auto_load_python_scripts): New.
	(gdbpy_initialize_auto_load): New variables cmd and cmd_name.
	Rename "set auto-load-scripts" to "set auto-load python-scripts".
	Register "set auto-load-scripts" as its deprecated alias.  Register
	"info auto-load python-scripts".  Register "info auto-load-scripts" as
	its deprecated alias.
	(load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here.
	* python/python.h (load_auto_scripts_for_objfile): Rename to ...
	(gdbpy_load_auto_scripts_for_objfile): ... here.

gdb/doc/
	auto-load: Implementation.
	* gdb.texinfo (Mode Options): New anchor for -nx.
	(Startup): New anchors for Option -init-eval-command,
	Home Directory Init File
	and Init File in the Current Directory during Startup.
	Mention set auto-load local-gdbinit with a reference.
	Change the sample code to "set auto-load python-scripts".
	(Threads): New anchor set libthread-db-search-path.
	Provide references to libthread_db.so.1 file.
	(Controlling GDB): New menu item for Auto-loading.
	(Auto-loading, Init File in the Current Directory)
	(libthread_db.so.1 file, objfile-gdb.gdb file): New nodes.
	(Python): Rename the menu item Auto-loading to Python Auto-loading.
	(Writing a Pretty-Printer, Objfiles In Python): Update the renamed
	reference.
	(Auto-loading): Rename to ...
	(Python Auto-loading): ... here.  Change "set auto-load-scripts" to
	"set auto-load python-scripts", new anchor for it.  Change
	"show auto-load-scripts" to "show auto-load python-scripts", new anchor
	for it.  Change "info auto-load-scripts"
	to "info auto-load python-scripts", new anchor for it.  Change "scripts"
	to "Python scripts".

gdb/testsuite/
	auto-load: Implementation.
	* gdb.base/help.exp (test set height): Increase the height.
	* gdb.python/py-objfile-script.exp (info auto-load-scripts): Change
	to ...
	(info auto-load python-scripts): ... here.
	* gdb.python/py-section-script.exp (info auto-load-scripts *): Change
	to ...
	(info auto-load python-scripts *): ... here.
2012-04-17 15:51:48 +00:00
Jan Kratochvil e2207b9a28 gdb/
auto-load: Move files.
	* Makefile.in (SFILES): Add auto-load.c.
	(HFILES_NO_SRCDIR): Add auto-load.h.
	(COMMON_OBS): Add auto-load.o.
	(distclean): Change .gdbinit for gdb-gdb.gdb.
	* auto-load.c: New file, with parts from python/py-auto-load.c.
	* auto-load.h: New file, with parts from python/python.h.
	* configure: Regenerate.
	* configure.ac (AC_OUTPUT): Change .gdbinit for gdb-gdb.gdb.
	* gdb-gdb.gdb.in: New file, renamed from gdbinit.in.
	* gdbinit.in: Remove file, rename it to gdb-gdb.gdb.in.
	* main.c: Include auto-load.h.
	* python/py-auto-load.c: Move include filenames.h, gdb_regex.h,
	command.h, observer.h and progspace.h to auto-load.c.  Add include
	auto-load.h.
	(gdbpy_global_auto_load, struct auto_load_pspace_info)
	(struct loaded_script, auto_load_pspace_data)
	(auto_load_pspace_data_cleanup, get_auto_load_pspace_data)
	(hash_loaded_script_entry, eq_loaded_script_entry)
	(init_loaded_scripts_info, get_auto_load_pspace_data_for_loading)
	(maybe_add_script): Move to auto-load.c.
	(source_section_scripts): Change maybe_add_script parameters passing,
	use script_not_found_warning_print.
	(clear_section_scripts, auto_load_objfile_script)
	(auto_load_new_objfile, loaded_script_ptr)
	(DEF_VEC_P (loaded_script_ptr), collect_matching_scripts, print_script)
	(sort_scripts_by_name, info_auto_load_scripts): Move to auto-load.c.
	(gdbpy_initialize_auto_load): Move auto_load_pspace_data,
	auto_load_new_objfile and info_auto_load_scripts initizations to
	auto-load.c.
	* python/python.h (gdbpy_global_auto_load): Move to auto-load.h.
2012-04-17 15:49:16 +00:00