binutils-gdb/gdb/auto-load.h

55 lines
1.9 KiB
C
Raw Normal View History

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 17:49:16 +02:00
/* GDB routines for supporting auto-loaded scripts.
Copyright (C) 2012-2016 Free Software Foundation, Inc.
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 17:49:16 +02:00
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef AUTO_LOAD_H
#define AUTO_LOAD_H 1
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-06 04:27:58 +01:00
struct objfile;
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 17:49:16 +02:00
struct program_space;
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-06 04:27:58 +01:00
struct auto_load_pspace_info;
struct extension_language_defn;
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 17:51:48 +02:00
extern int global_auto_load;
extern int auto_load_local_gdbinit;
extern char *auto_load_local_gdbinit_pathname;
extern int auto_load_local_gdbinit_loaded;
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 17:49:16 +02:00
extern struct auto_load_pspace_info *
get_auto_load_pspace_data_for_loading (struct program_space *pspace);
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-06 04:27:58 +01:00
extern void auto_load_objfile_script (struct objfile *objfile,
const struct extension_language_defn *);
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 17:51:48 +02:00
extern void load_auto_scripts_for_objfile (struct objfile *objfile);
extern char auto_load_info_scripts_pattern_nl[];
extern void auto_load_info_scripts (char *pattern, int from_tty,
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-06 04:27:58 +01:00
const struct extension_language_defn *);
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 17:51:48 +02:00
extern struct cmd_list_element **auto_load_set_cmdlist_get (void);
extern struct cmd_list_element **auto_load_show_cmdlist_get (void);
extern struct cmd_list_element **auto_load_info_cmdlist_get (void);
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 17:49:16 +02:00
extern int file_is_auto_load_safe (const char *filename,
const char *debug_fmt, ...)
ATTRIBUTE_PRINTF (2, 3);
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 17:54:35 +02:00
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-06 04:27:58 +01:00
extern int auto_load_gdb_scripts_enabled
(const struct extension_language_defn *extlang);
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 17:49:16 +02:00
#endif /* AUTO_LOAD_H */