From 8a1ea21f7e299173e51bd45e8981ea107ebf0952 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Fri, 23 Apr 2010 16:20:13 +0000 Subject: Add support for auto-loading scripts from .debug_gdb_scripts section. * NEWS: Add entry for .debug_gdb_scripts. * Makefile.in SUBDIR_PYTHON_OBS): Add py-auto-load.o. (SUBDIR_PYTHON_SRCS): Add py-auto-load.c. (py-auto-load.o): New rule. * cli/cli-cmds.c (find_and_open_script): Make externally visible. * cli/cli-cmds.h (find_and_open_script): Update prototype. * python/py-auto-load.c: New file. * python/python-internal.h: #include . (set_python_list, show_python_list): Declare. (gdbpy_initialize_auto_load): Declare. (source_python_script_for_objfile): Declare. * python/python.c: Remove #include of observer.h. (gdbpy_auto_load): Moved to py-auto-load.c. (GDBPY_AUTO_FILENAME): Ditto. (gdbpy_new_objfile): Delete. (source_python_script_for_objfile): New function. (set_python_list, show_python_list): Make externally visible. (_initialize_python): Move "auto-load" command to py-auto-load.c and observer_attach_new_objfile to py-auto-load.c. doc/ * gdb.texinfo (Python): Move Auto-loading section here ... (Python API): from here. (Auto-loading): Add docs for .debug_gdb_scripts auto-loaded scripts. (Maintenance Commands): Add docs for "maint print section-scripts". testsuite/ * gdb.python/py-section-script.c: New file. * gdb.python/py-section-script.exp: New file. * gdb.python/py-section-script.py: New file. --- gdb/cli/cli-cmds.c | 2 +- gdb/cli/cli-cmds.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'gdb/cli') diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index dcb8ece..fdeb8db 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -483,7 +483,7 @@ Script filename extension recognition is \"%s\".\n"), NOTE: This calls openp which uses xfullpath to compute the full path instead of gdb_realpath. Symbolic links are not resolved. */ -static int +int find_and_open_script (const char *script_file, int search_path, FILE **streamp, char **full_pathp) { diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h index 14f539e..9446f93 100644 --- a/gdb/cli/cli-cmds.h +++ b/gdb/cli/cli-cmds.h @@ -123,6 +123,11 @@ extern void quit_command (char *, int); extern void source_script (char *, int); +/* Exported to objfiles.c. */ + +extern int find_and_open_script (const char *file, int search_path, + FILE **streamp, char **full_path); + /* Used everywhere whenever at least one parameter is required and none is specified. */ -- cgit v1.1