GDB (xrefs)
Classes | Macros | Typedefs | Functions | Variables
/tmp/gdb-7.10/gdb/auto-load.c File Reference
#include "defs.h"
#include <ctype.h>
#include "auto-load.h"
#include "progspace.h"
#include "gdb_regex.h"
#include "ui-out.h"
#include "filenames.h"
#include "command.h"
#include "observer.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 "gdb_vecs.h"
#include "readline/tilde.h"
#include "completer.h"
#include "fnmatch.h"
#include "top.h"
#include "filestuff.h"
#include "extension.h"
#include "gdb/section-scripts.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"
 

Typedefs

typedef struct loaded_scriptloaded_script_ptr
 

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)
 
int 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 (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 VEC (char_ptr)
 
static void auto_load_safe_path_vec_update (void)
 
static void auto_load_gdb_datadir_changed (void)
 
static void set_auto_load_safe_path (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 (char *args, int from_tty)
 
static void add_auto_load_dir (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, char **filename_realp)
 
int file_is_auto_load_safe (const char *filename, const char *debug_fmt,...)
 
static void auto_load_pspace_data_cleanup (struct program_space *pspace, void *arg)
 
static struct auto_load_pspace_infoget_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_infoget_auto_load_pspace_data_for_loading (struct program_space *pspace)
 
static int maybe_add_script_file (struct auto_load_pspace_info *pspace_info, int loaded, const char *name, const char *full_path, const struct extension_language_defn *language)
 
static int maybe_add_script_text (struct auto_load_pspace_info *pspace_info, int loaded, const char *name, const struct extension_language_defn *language)
 
static void clear_section_scripts (void)
 
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 void auto_load_new_objfile (struct objfile *objfile)
 
 DEF_VEC_P (loaded_script_ptr)
 
static int collect_matching_scripts (void **slot, void *info)
 
static void print_script (struct loaded_script *script)
 
static int sort_scripts_by_name (const void *ap, const void *bp)
 
static void print_scripts (VEC(loaded_script_ptr)*scripts)
 
void auto_load_info_scripts (char *pattern, int from_tty, const struct extension_language_defn *language)
 
static void info_auto_load_gdb_scripts (char *pattern, int from_tty)
 
static void info_auto_load_local_gdbinit (char *args, int from_tty)
 
static void set_auto_load_cmd (char *args, int from_tty)
 
struct cmd_list_element ** auto_load_set_cmdlist_get (void)
 
static void show_auto_load_cmd (char *args, int from_tty)
 
struct cmd_list_element ** auto_load_show_cmdlist_get (void)
 
static void info_auto_load_cmd (char *args, int from_tty)
 
struct cmd_list_element ** auto_load_info_cmdlist_get (void)
 
void _initialize_auto_load (void)
 

Variables

static int debug_auto_load = 0
 
static int auto_load_gdb_scripts = 1
 
int global_auto_load = 1
 
int auto_load_local_gdbinit = 1
 
char * auto_load_local_gdbinit_pathname = NULL
 
int auto_load_local_gdbinit_loaded = 0
 
static char * auto_load_dir
 
static char * auto_load_safe_path
 
static const struct program_space_data * auto_load_pspace_data
 
char auto_load_info_scripts_pattern_nl [] = ""
 

Macro Definition Documentation

#define AUTO_SECTION_NAME   ".debug_gdb_scripts"

Definition at line 50 of file auto-load.c.

Referenced by load_auto_scripts_for_objfile().

Typedef Documentation

Definition at line 1234 of file auto-load.c.

Function Documentation

void _initialize_auto_load ( void  )
static void add_auto_load_dir ( char *  args,
int  from_tty 
)
static

Definition at line 326 of file auto-load.c.

References _, auto_load_dir, DIRNAME_SEPARATOR, error(), xfree(), and xstrprintf().

Referenced by _initialize_auto_load().

static void add_auto_load_safe_path ( char *  args,
int  from_tty 
)
static
static void auto_load_gdb_datadir_changed ( void  )
static

Definition at line 258 of file auto-load.c.

References auto_load_safe_path_vec_update().

Referenced by _initialize_auto_load().

int auto_load_gdb_scripts_enabled ( const struct extension_language_defn extlang)

Definition at line 97 of file auto-load.c.

References auto_load_gdb_scripts.

struct cmd_list_element** auto_load_info_cmdlist_get ( void  )
void auto_load_info_scripts ( char *  pattern,
int  from_tty,
const struct extension_language_defn language 
)
static void auto_load_new_objfile ( struct objfile objfile)
static

Definition at line 1220 of file auto-load.c.

References clear_section_scripts(), and load_auto_scripts_for_objfile().

Referenced by _initialize_auto_load().

void auto_load_objfile_script ( struct objfile objfile,
const struct extension_language_defn language 
)
static int auto_load_objfile_script_1 ( struct objfile objfile,
const char *  realname,
const struct extension_language_defn language 
)
static
static void auto_load_pspace_data_cleanup ( struct program_space pspace,
void *  arg 
)
static
static void auto_load_safe_path_vec_update ( void  )
static
static void auto_load_section_scripts ( struct objfile objfile,
const char *  section_name 
)
static
struct cmd_list_element** auto_load_set_cmdlist_get ( void  )
struct cmd_list_element** auto_load_show_cmdlist_get ( void  )
static void clear_section_scripts ( void  )
static
static int collect_matching_scripts ( void **  slot,
void *  info 
)
static

Definition at line 1248 of file auto-load.c.

References loaded_script::language, loaded_script::name, and VEC_safe_push.

Referenced by auto_load_info_scripts().

DEF_VEC_P ( loaded_script_ptr  )
static int eq_loaded_script_entry ( const void *  a,
const void *  b 
)
static

Definition at line 623 of file auto-load.c.

References loaded_script::language, and loaded_script::name.

Referenced by init_loaded_scripts_info().

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
int file_is_auto_load_safe ( const char *  filename,
const char *  debug_fmt,
  ... 
)
static int filename_is_in_auto_load_safe_path_vec ( const char *  filename,
char **  filename_realp 
)
static
static ATTRIBUTE_PURE int filename_is_in_pattern ( const char *  filename,
const char *  pattern 
)
static

Definition at line 407 of file auto-load.c.

References filename_is_in_pattern_1().

Referenced by filename_is_in_auto_load_safe_path_vec().

static int filename_is_in_pattern_1 ( char *  filename,
char *  pattern 
)
static

Definition at line 342 of file auto-load.c.

References _, debug_auto_load, fprintf_unfiltered(), gdb_filename_fnmatch(), and gdb_stdlog.

Referenced by filename_is_in_pattern().

static struct auto_load_pspace_info* get_auto_load_pspace_data ( struct program_space pspace)
static

Definition at line 596 of file auto-load.c.

References auto_load_pspace_data.

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)
static hashval_t hash_loaded_script_entry ( const void *  data)
static

Definition at line 613 of file auto-load.c.

References loaded_script::language, and loaded_script::name.

Referenced by init_loaded_scripts_info().

static void info_auto_load_cmd ( char *  args,
int  from_tty 
)
static
static void info_auto_load_gdb_scripts ( char *  pattern,
int  from_tty 
)
static

Definition at line 1410 of file auto-load.c.

References auto_load_info_scripts(), and extension_language_gdb.

Referenced by _initialize_auto_load().

static void info_auto_load_local_gdbinit ( char *  args,
int  from_tty 
)
static
static void init_loaded_scripts_info ( struct auto_load_pspace_info pspace_info)
static
void load_auto_scripts_for_objfile ( struct objfile objfile)
static int maybe_add_script_file ( struct auto_load_pspace_info pspace_info,
int  loaded,
const char *  name,
const char *  full_path,
const struct extension_language_defn language 
)
static
static int maybe_add_script_text ( struct auto_load_pspace_info pspace_info,
int  loaded,
const char *  name,
const struct extension_language_defn language 
)
static
static void maybe_print_script_not_found_warning ( struct auto_load_pspace_info pspace_info,
struct objfile objfile,
const struct extension_language_defn language,
const char *  section_name,
unsigned  offset 
)
static
static void maybe_print_unsupported_script_warning ( struct auto_load_pspace_info pspace_info,
struct objfile objfile,
const struct extension_language_defn language,
const char *  section_name,
unsigned  offset 
)
static
static void print_script ( struct loaded_script script)
static
static void print_scripts ( VEC(loaded_script_ptr)*  scripts)
static
static void set_auto_load_cmd ( char *  args,
int  from_tty 
)
static
static void set_auto_load_dir ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static

Definition at line 142 of file auto-load.c.

References AUTO_LOAD_DIR, auto_load_dir, and xfree().

Referenced by _initialize_auto_load().

static void set_auto_load_safe_path ( char *  args,
int  from_tty,
struct cmd_list_element c 
)
static
static void show_auto_load_cmd ( char *  args,
int  from_tty 
)
static

Definition at line 1526 of file auto-load.c.

References auto_load_show_cmdlist_get(), and cmd_show_list().

Referenced by auto_load_show_cmdlist_get().

static void show_auto_load_dir ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 155 of file auto-load.c.

References _, and fprintf_filtered().

Referenced by _initialize_auto_load().

static void show_auto_load_gdb_scripts ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 86 of file auto-load.c.

References _, and fprintf_filtered().

Referenced by _initialize_auto_load().

static void show_auto_load_local_gdbinit ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 126 of file auto-load.c.

References _, and fprintf_filtered().

Referenced by _initialize_auto_load().

static void show_auto_load_safe_path ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 281 of file auto-load.c.

References _, DIRNAME_SEPARATOR, and fprintf_filtered().

Referenced by _initialize_auto_load().

static void show_debug_auto_load ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 68 of file auto-load.c.

References _, and fprintf_filtered().

Referenced by _initialize_auto_load().

static int sort_scripts_by_name ( const void *  ap,
const void *  bp 
)
static

Definition at line 1288 of file auto-load.c.

References loaded_script::name.

Referenced by print_scripts().

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
static void source_section_scripts ( struct objfile objfile,
const char *  section_name,
const char *  start,
const char *  end 
)
static
static VEC ( char_ptr  )
static

Variable Documentation

char* auto_load_dir
static
int auto_load_gdb_scripts = 1
static

Definition at line 81 of file auto-load.c.

Referenced by _initialize_auto_load(), and auto_load_gdb_scripts_enabled().

char auto_load_info_scripts_pattern_nl[] = ""
int auto_load_local_gdbinit = 1

Definition at line 115 of file auto-load.c.

Referenced by _initialize_auto_load(), and captured_main().

int auto_load_local_gdbinit_loaded = 0

Definition at line 121 of file auto-load.c.

Referenced by captured_main(), and info_auto_load_local_gdbinit().

char* auto_load_local_gdbinit_pathname = NULL

Definition at line 118 of file auto-load.c.

Referenced by captured_main(), and info_auto_load_local_gdbinit().

const struct program_space_data* auto_load_pspace_data
static
char* auto_load_safe_path
static
int debug_auto_load = 0
static
int global_auto_load = 1

Definition at line 112 of file auto-load.c.

Referenced by captured_main(), and load_auto_scripts_for_objfile().