GDB (xrefs)
|
#include "defs.h"
#include <ctype.h>
#include "auto-load.h"
#include "progspace.h"
#include "gdbsupport/gdb_regex.h"
#include "ui-out.h"
#include "filenames.h"
#include "command.h"
#include "observable.h"
#include "objfiles.h"
#include "cli/cli-script.h"
#include "gdbcmd.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"
#include "cli/cli-setshow.h"
#include "readline/tilde.h"
#include "completer.h"
#include "fnmatch.h"
#include "top.h"
#include "gdbsupport/filestuff.h"
#include "extension.h"
#include "gdb/section-scripts.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"
#include "cli/cli-style.h"
Go to the source code of this file.
Classes | |
struct | auto_load_pspace_info |
struct | loaded_script |
struct | collect_matching_scripts_data |
Macros | |
#define | AUTO_SECTION_NAME ".debug_gdb_scripts" |
#define | DEBUGLINK_SECTION_NAME ".gnu_debuglink" |
Functions | |
static void | maybe_print_unsupported_script_warning (struct auto_load_pspace_info *, struct objfile *objfile, const struct extension_language_defn *language, const char *section_name, unsigned offset) |
static void | maybe_print_script_not_found_warning (struct auto_load_pspace_info *, struct objfile *objfile, const struct extension_language_defn *language, const char *section_name, unsigned offset) |
static void | show_debug_auto_load (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | show_auto_load_gdb_scripts (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
bool | auto_load_gdb_scripts_enabled (const struct extension_language_defn *extlang) |
static void | show_auto_load_local_gdbinit (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | set_auto_load_dir (const char *args, int from_tty, struct cmd_list_element *c) |
static void | show_auto_load_dir (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static std::vector< gdb::unique_xmalloc_ptr< char > > | auto_load_expand_dir_vars (const char *string) |
static void | auto_load_safe_path_vec_update (void) |
static void | auto_load_gdb_datadir_changed (void) |
static void | set_auto_load_safe_path (const char *args, int from_tty, struct cmd_list_element *c) |
static void | show_auto_load_safe_path (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) |
static void | add_auto_load_safe_path (const char *args, int from_tty) |
static void | add_auto_load_dir (const char *args, int from_tty) |
static int | filename_is_in_pattern_1 (char *filename, char *pattern) |
static ATTRIBUTE_PURE int | filename_is_in_pattern (const char *filename, const char *pattern) |
static int | filename_is_in_auto_load_safe_path_vec (const char *filename, gdb::unique_xmalloc_ptr< char > *filename_realp) |
bool | file_is_auto_load_safe (const char *filename) |
static struct auto_load_pspace_info * | get_auto_load_pspace_data (struct program_space *pspace) |
static hashval_t | hash_loaded_script_entry (const void *data) |
static int | eq_loaded_script_entry (const void *a, const void *b) |
static void | init_loaded_scripts_info (struct auto_load_pspace_info *pspace_info) |
struct auto_load_pspace_info * | get_auto_load_pspace_data_for_loading (struct program_space *pspace) |
static bool | maybe_add_script_file (struct auto_load_pspace_info *pspace_info, bool loaded, const char *name, const char *full_path, const struct extension_language_defn *language) |
static bool | maybe_add_script_text (struct auto_load_pspace_info *pspace_info, bool loaded, const char *name, const struct extension_language_defn *language) |
static void | clear_section_scripts (program_space *pspace) |
static int | auto_load_objfile_script_1 (struct objfile *objfile, const char *realname, const struct extension_language_defn *language) |
void | auto_load_objfile_script (struct objfile *objfile, const struct extension_language_defn *language) |
static void | source_script_file (struct auto_load_pspace_info *pspace_info, struct objfile *objfile, const struct extension_language_defn *language, const char *section_name, unsigned int offset, const char *file) |
static void | execute_script_contents (struct auto_load_pspace_info *pspace_info, struct objfile *objfile, const struct extension_language_defn *language, const char *section_name, unsigned int offset, const char *script) |
static void | source_section_scripts (struct objfile *objfile, const char *section_name, const char *start, const char *end) |
static void | auto_load_section_scripts (struct objfile *objfile, const char *section_name) |
void | load_auto_scripts_for_objfile (struct objfile *objfile) |
static int | collect_matching_scripts (void **slot, void *info) |
static void | print_script (struct loaded_script *script) |
static bool | sort_scripts_by_name (loaded_script *a, loaded_script *b) |
static void | print_scripts (const std::vector< loaded_script * > &scripts) |
void | auto_load_info_scripts (program_space *pspace, const char *pattern, int from_tty, const extension_language_defn *language) |
static void | info_auto_load_gdb_scripts (const char *pattern, int from_tty) |
static void | info_auto_load_local_gdbinit (const char *args, int from_tty) |
static void | set_auto_load_cmd (const char *args, int from_tty) |
struct cmd_list_element ** | auto_load_set_cmdlist_get (void) |
struct cmd_list_element ** | auto_load_show_cmdlist_get (void) |
static void | info_auto_load_cmd (const char *args, int from_tty) |
struct cmd_list_element ** | auto_load_info_cmdlist_get (void) |
void | _initialize_auto_load () |
Variables | |
bool | debug_auto_load = false |
static bool | auto_load_gdb_scripts = true |
bool | global_auto_load = true |
bool | auto_load_local_gdbinit = true |
char * | auto_load_local_gdbinit_pathname = NULL |
bool | auto_load_local_gdbinit_loaded = false |
static std::string | auto_load_dir = AUTO_LOAD_DIR |
static std::string | auto_load_safe_path = AUTO_LOAD_SAFE_PATH |
static std::vector< gdb::unique_xmalloc_ptr< char > > | auto_load_safe_path_vec |
static const registry< program_space >::key< auto_load_pspace_info > | auto_load_pspace_data |
char | auto_load_info_scripts_pattern_nl [] = "" |
gdb::observers::token | auto_load_new_objfile_observer_token |
#define AUTO_SECTION_NAME ".debug_gdb_scripts" |
Definition at line 52 of file auto-load.c.
Referenced by load_auto_scripts_for_objfile().
#define DEBUGLINK_SECTION_NAME ".gnu_debuglink" |
Definition at line 55 of file auto-load.c.
void _initialize_auto_load | ( | ) |
Definition at line 1512 of file auto-load.c.
Referenced by initialize_all_files().
|
static |
Definition at line 308 of file auto-load.c.
References auto_load_dir.
|
static |
Definition at line 290 of file auto-load.c.
References auto_load_safe_path, and auto_load_safe_path_vec_update().
|
static |
Definition at line 180 of file auto-load.c.
References auto_load_debug_printf, debug_auto_load, debug_file_directory, gdb_datadir, substitute_path_component(), and xfree().
Referenced by auto_load_objfile_script_1(), and auto_load_safe_path_vec_update().
|
static |
Definition at line 245 of file auto-load.c.
References auto_load_safe_path_vec_update().
bool auto_load_gdb_scripts_enabled | ( | const struct extension_language_defn * | extlang | ) |
Definition at line 103 of file auto-load.c.
References auto_load_gdb_scripts.
struct cmd_list_element ** auto_load_info_cmdlist_get | ( | void | ) |
Definition at line 1492 of file auto-load.c.
References add_prefix_cmd(), class_info, info_auto_load_cmd(), and infolist.
Referenced by gdbpy_initialize_auto_load(), gdbscm_initialize_auto_load(), and info_auto_load_cmd().
void auto_load_info_scripts | ( | program_space * | pspace, |
const char * | pattern, | ||
int | from_tty, | ||
const extension_language_defn * | language ) |
Definition at line 1247 of file auto-load.c.
References auto_load_info_scripts_pattern_nl, collect_matching_scripts(), current_uiout, dont_repeat(), get_auto_load_pspace_data(), auto_load_pspace_info::loaded_script_files, auto_load_pspace_info::loaded_script_texts, ui_out::message(), print_scripts(), re_comp(), sort_scripts_by_name(), ui_out::table_body(), ui_out::table_header(), ui_out::text(), and ui_left.
Referenced by info_auto_load_gdb_scripts(), info_auto_load_guile_scripts(), and info_auto_load_python_scripts().
void auto_load_objfile_script | ( | struct objfile * | objfile, |
const struct extension_language_defn * | language ) |
Definition at line 821 of file auto-load.c.
References auto_load_debug_printf, auto_load_objfile_script_1(), objfile::obfd, objfile_name(), and objfile::separate_debug_objfile_backlink.
Referenced by auto_load_ext_lang_scripts_for_objfile().
|
static |
Definition at line 721 of file auto-load.c.
References auto_load_debug_printf, auto_load_dir, auto_load_expand_dir_vars(), ext_lang_auto_load_suffix(), ext_lang_name(), ext_lang_objfile_script_sourcer(), file_is_auto_load_safe(), file_name_style, get_auto_load_pspace_data_for_loading(), maybe_add_script_file(), objfile_name(), objfile::pspace, cli_style_option::style(), and styled_string().
Referenced by auto_load_objfile_script().
|
static |
Definition at line 199 of file auto-load.c.
References auto_load_debug_printf, auto_load_expand_dir_vars(), auto_load_safe_path, auto_load_safe_path_vec, and debug_auto_load.
Referenced by add_auto_load_safe_path(), auto_load_gdb_datadir_changed(), file_is_auto_load_safe(), and set_auto_load_safe_path().
|
static |
Definition at line 1115 of file auto-load.c.
References file_name_style, objfile::obfd, source_section_scripts(), cli_style_option::style(), and styled_string().
Referenced by load_auto_scripts_for_objfile().
struct cmd_list_element ** auto_load_set_cmdlist_get | ( | void | ) |
Definition at line 1433 of file auto-load.c.
References add_prefix_cmd(), class_maintenance, set_auto_load_cmd(), and setlist.
Referenced by gdbpy_initialize_auto_load(), gdbscm_initialize_auto_load(), and set_auto_load_cmd().
struct cmd_list_element ** auto_load_show_cmdlist_get | ( | void | ) |
Definition at line 1450 of file auto-load.c.
References add_show_prefix_cmd(), class_maintenance, and showlist.
Referenced by gdbpy_initialize_auto_load(), and gdbscm_initialize_auto_load().
|
static |
Definition at line 709 of file auto-load.c.
References auto_load_pspace_data, and registry< T >::get().
|
static |
Definition at line 1184 of file auto-load.c.
References loaded_script::language, and loaded_script::name.
Referenced by auto_load_info_scripts().
|
static |
Definition at line 570 of file auto-load.c.
References loaded_script::language, and loaded_script::name.
Referenced by init_loaded_scripts_info().
|
static |
Definition at line 960 of file auto-load.c.
References auto_load_debug_printf, ext_lang_auto_load_enabled(), ext_lang_name(), ext_lang_objfile_script_executor(), file_is_auto_load_safe(), file_name_style, maybe_add_script_text(), maybe_print_unsupported_script_warning(), name, objfile_name(), cli_style_option::style(), and styled_string().
Referenced by source_section_scripts().
bool file_is_auto_load_safe | ( | const char * | filename | ) |
Definition at line 439 of file auto-load.c.
References auto_load_safe_path, auto_load_safe_path_vec_update(), file_name_style, filename_is_in_auto_load_safe_path_vec(), gdb_printf(), GDBINIT, cli_style_option::style(), and styled_string().
Referenced by auto_load_objfile_script_1(), captured_main_1(), execute_script_contents(), source_script_file(), and try_thread_db_load().
|
static |
Definition at line 395 of file auto-load.c.
References auto_load_debug_printf, auto_load_safe_path_vec, debug_auto_load, and filename_is_in_pattern().
Referenced by file_is_auto_load_safe().
|
static |
Definition at line 377 of file auto-load.c.
References filename_is_in_pattern_1().
Referenced by filename_is_in_auto_load_safe_path_vec().
|
static |
Definition at line 321 of file auto-load.c.
References auto_load_debug_printf, and gdb_filename_fnmatch().
Referenced by filename_is_in_pattern().
|
static |
Definition at line 546 of file auto-load.c.
References auto_load_pspace_data, and registry< T >::get().
Referenced by auto_load_info_scripts(), and get_auto_load_pspace_data_for_loading().
struct auto_load_pspace_info * get_auto_load_pspace_data_for_loading | ( | struct program_space * | pspace | ) |
Definition at line 607 of file auto-load.c.
References get_auto_load_pspace_data(), and init_loaded_scripts_info().
Referenced by auto_load_objfile_script_1(), and source_section_scripts().
|
static |
Definition at line 560 of file auto-load.c.
References loaded_script::language, and loaded_script::name.
Referenced by init_loaded_scripts_info().
|
static |
Definition at line 1469 of file auto-load.c.
References auto_load_info_cmdlist_get(), auto_load_info_scripts_pattern_nl, cmd_func(), current_uiout, ui_out::field_string(), cmd_list_element::is_prefix(), cmd_list_element::name, cmd_list_element::next, not_set_cmd, ui_out::text(), and cmd_list_element::type.
Referenced by auto_load_info_cmdlist_get().
|
static |
Definition at line 1329 of file auto-load.c.
References auto_load_info_scripts(), current_program_space, and extension_language_gdb.
|
static |
Definition at line 1338 of file auto-load.c.
References auto_load_local_gdbinit_loaded, auto_load_local_gdbinit_pathname, file_name_style, gdb_printf(), cli_style_option::style(), and styled_string().
|
static |
Definition at line 582 of file auto-load.c.
References eq_loaded_script_entry(), hash_loaded_script_entry(), auto_load_pspace_info::loaded_script_files, auto_load_pspace_info::loaded_script_texts, auto_load_pspace_info::script_not_found_warning_printed, auto_load_pspace_info::unsupported_script_warning_printed, and xfree().
Referenced by get_auto_load_pspace_data_for_loading().
void load_auto_scripts_for_objfile | ( | struct objfile * | objfile | ) |
Definition at line 1148 of file auto-load.c.
References auto_load_ext_lang_scripts_for_objfile(), auto_load_section_scripts(), AUTO_SECTION_NAME, objfile::flags, global_auto_load, is_target_filename(), OBJF_NOT_FILENAME, and objfile::original_name.
Referenced by captured_main_1().
|
static |
Definition at line 626 of file auto-load.c.
References loaded_script::full_path, loaded_script::loaded, auto_load_pspace_info::loaded_script_files, name, and xmalloc().
Referenced by auto_load_objfile_script_1(), and source_script_file().
|
static |
Definition at line 674 of file auto-load.c.
References loaded_script::loaded, auto_load_pspace_info::loaded_script_texts, name, and xmalloc().
Referenced by execute_script_contents().
|
static |
Definition at line 1381 of file auto-load.c.
References ext_lang_name(), file_name_style, objfile_name(), auto_load_pspace_info::script_not_found_warning_printed, cli_style_option::style(), and styled_string().
Referenced by source_script_file().
|
static |
Definition at line 1357 of file auto-load.c.
References ext_lang_name(), file_name_style, objfile_name(), cli_style_option::style(), styled_string(), and auto_load_pspace_info::unsupported_script_warning_printed.
Referenced by execute_script_contents(), and source_script_file().
|
static |
Definition at line 1199 of file auto-load.c.
References current_uiout, ui_out::field_string(), loaded_script::full_path, loaded_script::loaded, loaded_script::name, and ui_out::text().
Referenced by print_scripts().
|
static |
Definition at line 1236 of file auto-load.c.
References print_script().
Referenced by auto_load_info_scripts().
|
static |
Definition at line 1403 of file auto-load.c.
References auto_load_set_cmdlist_get(), do_set_command(), cmd_list_element::next, set_cmd, cmd_list_element::type, cmd_list_element::var, and var_boolean.
Referenced by auto_load_set_cmdlist_get().
|
static |
Definition at line 148 of file auto-load.c.
References AUTO_LOAD_DIR, and auto_load_dir.
|
static |
Definition at line 253 of file auto-load.c.
References AUTO_LOAD_SAFE_PATH, auto_load_safe_path, and auto_load_safe_path_vec_update().
|
static |
Definition at line 158 of file auto-load.c.
References gdb_printf().
|
static |
Definition at line 92 of file auto-load.c.
References gdb_printf().
|
static |
Definition at line 132 of file auto-load.c.
References gdb_printf().
|
static |
Definition at line 266 of file auto-load.c.
References gdb_printf().
|
static |
Definition at line 74 of file auto-load.c.
References gdb_printf().
|
static |
Definition at line 1222 of file auto-load.c.
References loaded_script::name.
Referenced by auto_load_info_scripts().
|
static |
Definition at line 890 of file auto-load.c.
References auto_load_debug_printf, ext_lang_auto_load_enabled(), ext_lang_name(), ext_lang_objfile_script_sourcer(), file_is_auto_load_safe(), find_and_open_script(), maybe_add_script_file(), maybe_print_script_not_found_warning(), maybe_print_unsupported_script_warning(), and objfile_name().
Referenced by source_section_scripts().
|
static |
Definition at line 1049 of file auto-load.c.
References code, execute_script_contents(), EXT_LANG_GUILE, EXT_LANG_PYTHON, get_auto_load_pspace_data_for_loading(), get_ext_lang_defn(), objfile::pspace, and source_script_file().
Referenced by auto_load_section_scripts().
|
static |
Definition at line 143 of file auto-load.c.
Referenced by add_auto_load_dir(), auto_load_objfile_script_1(), and set_auto_load_dir().
|
static |
Definition at line 87 of file auto-load.c.
Referenced by auto_load_gdb_scripts_enabled().
char auto_load_info_scripts_pattern_nl[] = "" |
Definition at line 1230 of file auto-load.c.
Referenced by auto_load_info_scripts(), info_auto_load_cmd(), and info_auto_load_libthread_db().
bool auto_load_local_gdbinit = true |
Definition at line 121 of file auto-load.c.
Referenced by captured_main_1().
bool auto_load_local_gdbinit_loaded = false |
Definition at line 127 of file auto-load.c.
Referenced by captured_main_1(), and info_auto_load_local_gdbinit().
char* auto_load_local_gdbinit_pathname = NULL |
Definition at line 124 of file auto-load.c.
Referenced by captured_main_1(), and info_auto_load_local_gdbinit().
gdb::observers::token auto_load_new_objfile_observer_token |
Definition at line 1508 of file auto-load.c.
Referenced by gdbpy_initialize_inferior().
|
static |
Definition at line 540 of file auto-load.c.
Referenced by clear_section_scripts(), and get_auto_load_pspace_data().
|
static |
Definition at line 169 of file auto-load.c.
Referenced by add_auto_load_safe_path(), auto_load_safe_path_vec_update(), file_is_auto_load_safe(), and set_auto_load_safe_path().
|
static |
Definition at line 174 of file auto-load.c.
Referenced by auto_load_safe_path_vec_update(), and filename_is_in_auto_load_safe_path_vec().
bool debug_auto_load = false |
Definition at line 69 of file auto-load.c.
Referenced by auto_load_expand_dir_vars(), auto_load_safe_path_vec_update(), and filename_is_in_auto_load_safe_path_vec().
bool global_auto_load = true |
Definition at line 118 of file auto-load.c.
Referenced by captured_main_1(), and load_auto_scripts_for_objfile().