This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v3 03/15] extension language API for GDB: python.[ch] changes


This patch contains the changes to python-internal.h, python.c, python.h.
It defines the "ops" vectors for Python, defines script_language_python
as the top level interface to Python, and then has a bunch of renamings.
The functions that implement the script_language_ops "methods" are all
named ${lang}_${method_name}.
Functions that were exported to gdb now live in the ops vectors.

This patch also removes a lot of the stubs that had to be defined
when gdb was compiled --without-python.

Changes from v2:
- "methods" gdbpy_apply_val_pretty_printer, gdbpy_before_prompt_hook updated
  to return enum ext_lang_rc

Changes from v1:
- script_lang_python_initialized deleted
- updates for scripting -> extension renaming
- before_prompt_hook made an extension_language_ops "method"

2013-12-24  Doug Evans  <xdje42@gmail.com>

	* 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.
	(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.
	(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.

diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h
index dade7c7..bafdf8a 100644
--- a/gdb/python/python-internal.h
+++ b/gdb/python/python-internal.h
@@ -20,6 +20,8 @@
 #ifndef GDB_PYTHON_INTERNAL_H
 #define GDB_PYTHON_INTERNAL_H
 
+#include "extension.h"
+
 /* These WITH_* macros are defined by the CPython API checker that
    comes with the Python plugin for GCC.  See:
    https://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html
@@ -279,7 +281,33 @@ typedef struct
 
 extern struct cmd_list_element *set_python_list;
 extern struct cmd_list_element *show_python_list;
-
+
+/* extension_language_script_ops "methods".  */
+
+extern int gdbpy_auto_load_enabled (const struct extension_language_defn *);
+
+/* extension_language_ops "methods".  */
+
+extern enum ext_lang_rc gdbpy_apply_val_pretty_printer
+  (const struct extension_language_defn *,
+   struct type *type, const gdb_byte *valaddr,
+   int embedded_offset, CORE_ADDR address,
+   struct ui_file *stream, int recurse,
+   const struct value *val,
+   const struct value_print_options *options,
+   const struct language_defn *language);
+extern enum ext_lang_bt_status gdbpy_apply_frame_filter
+  (const struct extension_language_defn *,
+   struct frame_info *frame, int flags, enum ext_lang_frame_args args_type,
+   struct ui_out *out, int frame_low, int frame_high);
+extern void gdbpy_preserve_values (const struct extension_language_defn *,
+				   struct objfile *objfile,
+				   htab_t copied_types);
+extern enum ext_lang_bp_stop gdbpy_breakpoint_cond_says_stop
+  (const struct extension_language_defn *, struct breakpoint *);
+extern int gdbpy_breakpoint_has_cond (const struct extension_language_defn *,
+				      struct breakpoint *b);
+
 PyObject *gdbpy_history (PyObject *self, PyObject *args);
 PyObject *gdbpy_breakpoints (PyObject *, PyObject *);
 PyObject *gdbpy_frame_stop_reason_string (PyObject *, PyObject *);
@@ -436,9 +464,6 @@ extern const struct language_defn *python_language;
 
 void gdbpy_print_stack (void);
 
-void source_python_script_for_objfile (struct objfile *objfile, FILE *file,
-				       const char *filename);
-
 PyObject *python_string_to_unicode (PyObject *obj);
 char *unicode_to_target_string (PyObject *unicode_str);
 char *python_string_to_target_string (PyObject *obj);
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 55bb6cf..8f38ba9 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -32,8 +32,8 @@
 #include "serial.h"
 #include "readline/tilde.h"
 #include "python.h"
+#include "extension-priv.h"
 #include "cli/cli-utils.h"
-
 #include <ctype.h>
 
 /* Declared constants and enum for python stack printing.  */
@@ -57,6 +57,34 @@ static const char *const python_excp_enums[] =
 static const char *gdbpy_should_print_stack = python_excp_message;
 
 #ifdef HAVE_PYTHON
+/* Forward decls, these are defined later.  */
+static const struct extension_language_script_ops python_extension_script_ops;
+static const struct extension_language_ops python_extension_ops;
+#endif
+
+/* The main struct describing GDB's interface to the Python
+   extension language.  */
+const struct extension_language_defn extension_language_python =
+{
+  EXT_LANG_PYTHON,
+  "python",
+  "Python",
+
+  ".py",
+  "-gdb.py",
+
+  python_control,
+
+#ifdef HAVE_PYTHON
+  &python_extension_script_ops,
+  &python_extension_ops
+#else
+  NULL,
+  NULL
+#endif
+};
+
+#ifdef HAVE_PYTHON
 
 #include "libiberty.h"
 #include "cli/cli-decode.h"
@@ -69,7 +97,6 @@ static const char *gdbpy_should_print_stack = python_excp_message;
 #include "version.h"
 #include "target.h"
 #include "gdbthread.h"
-#include "observer.h"
 #include "interps.h"
 #include "event-top.h"
 
@@ -104,6 +131,64 @@ PyObject *gdbpy_gdb_error;
 /* The `gdb.MemoryError' exception.  */
 PyObject *gdbpy_gdb_memory_error;
 
+static script_sourcer_func gdbpy_source_script;
+static objfile_script_sourcer_func gdbpy_source_objfile_script;
+static void gdbpy_finish_initialization
+  (const struct extension_language_defn *);
+static int gdbpy_initialized (const struct extension_language_defn *);
+static void gdbpy_eval_from_control_command
+  (const struct extension_language_defn *, struct command_line *cmd);
+static void gdbpy_start_type_printers (const struct extension_language_defn *,
+				       struct ext_lang_type_printers *);
+static enum ext_lang_rc gdbpy_apply_type_printers
+  (const struct extension_language_defn *,
+   const struct ext_lang_type_printers *, struct type *, char **);
+static void gdbpy_free_type_printers (const struct extension_language_defn *,
+				      struct ext_lang_type_printers *);
+static void gdbpy_clear_quit_flag (const struct extension_language_defn *);
+static void gdbpy_set_quit_flag (const struct extension_language_defn *);
+static int gdbpy_check_quit_flag (const struct extension_language_defn *);
+static enum ext_lang_rc gdbpy_before_prompt_hook
+  (const struct extension_language_defn *, const char *current_gdb_prompt);
+
+/* The interface between gdb proper and loading of python scripts.  */
+
+static const struct extension_language_script_ops python_extension_script_ops =
+{
+  gdbpy_source_script,
+  gdbpy_source_objfile_script,
+  gdbpy_auto_load_enabled
+};
+
+/* The interface between gdb proper and python extensions.  */
+
+static const struct extension_language_ops python_extension_ops =
+{
+  gdbpy_finish_initialization,
+  gdbpy_initialized,
+
+  gdbpy_eval_from_control_command,
+
+  gdbpy_start_type_printers,
+  gdbpy_apply_type_printers,
+  gdbpy_free_type_printers,
+
+  gdbpy_apply_val_pretty_printer,
+
+  gdbpy_apply_frame_filter,
+
+  gdbpy_preserve_values,
+
+  gdbpy_breakpoint_has_cond,
+  gdbpy_breakpoint_cond_says_stop,
+
+  gdbpy_clear_quit_flag,
+  gdbpy_set_quit_flag,
+  gdbpy_check_quit_flag,
+
+  gdbpy_before_prompt_hook
+};
+
 /* Architecture and language to be used in callbacks from
    the Python interpreter.  */
 struct gdbarch *python_gdbarch;
@@ -169,8 +254,8 @@ ensure_python_env (struct gdbarch *gdbarch,
 
 /* Clear the quit flag.  */
 
-void
-clear_quit_flag (void)
+static void
+gdbpy_clear_quit_flag (const struct extension_language_defn *extlang)
 {
   /* This clears the flag as a side effect.  */
   PyOS_InterruptOccurred ();
@@ -178,16 +263,16 @@ clear_quit_flag (void)
 
 /* Set the quit flag.  */
 
-void
-set_quit_flag (void)
+static void
+gdbpy_set_quit_flag (const struct extension_language_defn *extlang)
 {
   PyErr_SetInterrupt ();
 }
 
 /* Return true if the quit flag has been set, false otherwise.  */
 
-int
-check_quit_flag (void)
+static int
+gdbpy_check_quit_flag (const struct extension_language_defn *extlang)
 {
   return PyOS_InterruptOccurred ();
 }
@@ -343,8 +428,9 @@ compute_python_string (struct command_line *l)
 /* Take a command line structure representing a 'python' command, and
    evaluate its body using the Python interpreter.  */
 
-void
-eval_python_from_control_command (struct command_line *cmd)
+static void
+gdbpy_eval_from_control_command (const struct extension_language_defn *extlang,
+				 struct command_line *cmd)
 {
   int ret;
   char *script;
@@ -765,12 +851,14 @@ gdbpy_find_pc_line (PyObject *self, PyObject *args)
 }
 
 /* Read a file as Python code.
-   FILE is the file to run.  FILENAME is name of the file FILE.
+   This is the extension_language_script_ops.script_sourcer "method".
+   FILE is the file to load.  FILENAME is name of the file FILE.
    This does not throw any errors.  If an exception occurs python will print
    the traceback and clear the error indicator.  */
 
-void
-source_python_script (FILE *file, const char *filename)
+static void
+gdbpy_source_script (const struct extension_language_defn *extlang,
+		     FILE *file, const char *filename)
 {
   struct cleanup *cleanup;
 
@@ -899,14 +987,17 @@ gdbpy_initialize_events (void)
 
 
 
-static void
-before_prompt_hook (const char *current_gdb_prompt)
+/* This is the extension_language_ops.before_prompt "method".  */
+
+static enum ext_lang_rc
+gdbpy_before_prompt_hook (const struct extension_language_defn *extlang,
+			  const char *current_gdb_prompt)
 {
   struct cleanup *cleanup;
   char *prompt = NULL;
 
   if (!gdb_python_initialized)
-    return;
+    return EXT_LANG_RC_NOP;
 
   cleanup = ensure_python_env (get_current_arch (), current_language);
 
@@ -968,12 +1059,12 @@ before_prompt_hook (const char *current_gdb_prompt)
     set_prompt (prompt);
 
   do_cleanups (cleanup);
-  return;
+  return prompt != NULL ? EXT_LANG_RC_OK : EXT_LANG_RC_NOP;
 
  fail:
   gdbpy_print_stack ();
   do_cleanups (cleanup);
-  return;
+  return EXT_LANG_RC_ERROR;
 }
 
 
@@ -1158,16 +1249,19 @@ gdbpy_progspaces (PyObject *unused1, PyObject *unused2)
 
 /* The "current" objfile.  This is set when gdb detects that a new
    objfile has been loaded.  It is only set for the duration of a call to
-   source_python_script_for_objfile; it is NULL at other times.  */
+   gdbpy_source_objfile_script; it is NULL at other times.  */
 static struct objfile *gdbpy_current_objfile;
 
 /* Set the current objfile to OBJFILE and then read FILE named FILENAME
    as Python code.  This does not throw any errors.  If an exception
-   occurs python will print the traceback and clear the error indicator.  */
+   occurs python will print the traceback and clear the error indicator.
+   This is the extension_language_script_ops.objfile_script_sourcer
+   "method".  */
 
-void
-source_python_script_for_objfile (struct objfile *objfile, FILE *file,
-                                  const char *filename)
+static void
+gdbpy_source_objfile_script (const struct extension_language_defn *extlang,
+			     struct objfile *objfile, FILE *file,
+			     const char *filename)
 {
   struct cleanup *cleanups;
 
@@ -1225,18 +1319,20 @@ gdbpy_objfiles (PyObject *unused1, PyObject *unused2)
   return list;
 }
 
-/* Compute the list of active type printers and return it.  The result
-   of this function can be passed to apply_type_printers, and should
-   be freed by free_type_printers.  */
+/* Compute the list of active python type printers and store them in
+   EXT_PRINTERS->py_type_printers.  The product of this function is used by
+   gdbpy_apply_type_printers, and freed by gdbpy_free_type_printers.
+   This is the extension_language_ops.start_type_printers "method".  */
 
-void *
-start_type_printers (void)
+static void
+gdbpy_start_type_printers (const struct extension_language_defn *extlang,
+			   struct ext_lang_type_printers *ext_printers)
 {
   struct cleanup *cleanups;
-  PyObject *type_module, *func = NULL, *result_obj = NULL;
+  PyObject *type_module, *func = NULL, *printers_obj = NULL;
 
   if (!gdb_python_initialized)
-    return NULL;
+    return;
 
   cleanups = ensure_python_env (get_current_arch (), current_language);
 
@@ -1254,39 +1350,41 @@ start_type_printers (void)
       goto done;
     }
 
-  result_obj = PyObject_CallFunctionObjArgs (func, (char *) NULL);
-  if (result_obj == NULL)
+  printers_obj = PyObject_CallFunctionObjArgs (func, (char *) NULL);
+  if (printers_obj == NULL)
     gdbpy_print_stack ();
+  else
+    ext_printers->py_type_printers = printers_obj;
 
  done:
   Py_XDECREF (type_module);
   Py_XDECREF (func);
   do_cleanups (cleanups);
-  return result_obj;
 }
 
-/* If TYPE is recognized by some type printer, return a newly
-   allocated string holding the type's replacement name.  The caller
-   is responsible for freeing the string.  Otherwise, return NULL.
-
-   This function has a bit of a funny name, since it actually applies
-   recognizers, but this seemed clearer given the start_type_printers
-   and free_type_printers functions.  */
-
-char *
-apply_type_printers (void *printers, struct type *type)
+/* If TYPE is recognized by some type printer, store in *PRETTIED_TYPE
+   a newly allocated string holding the type's replacement name, and return
+   EXT_LANG_RC_OK.  The caller is responsible for freeing the string.
+   If there's a Python error return EXT_LANG_RC_ERROR.
+   Otherwise, return EXT_LANG_RC_NOP.
+   This is the extension_language_ops.apply_type_printers "method".  */
+
+static enum ext_lang_rc
+gdbpy_apply_type_printers (const struct extension_language_defn *extlang,
+			   const struct ext_lang_type_printers *ext_printers,
+			   struct type *type, char **prettied_type)
 {
   struct cleanup *cleanups;
   PyObject *type_obj, *type_module = NULL, *func = NULL;
   PyObject *result_obj = NULL;
-  PyObject *printers_obj = printers;
+  PyObject *printers_obj = ext_printers->py_type_printers;
   char *result = NULL;
 
   if (printers_obj == NULL)
-    return NULL;
+    return EXT_LANG_RC_NOP;
 
   if (!gdb_python_initialized)
-    return NULL;
+    return EXT_LANG_RC_NOP;
 
   cleanups = ensure_python_env (get_current_arch (), current_language);
 
@@ -1332,16 +1430,20 @@ apply_type_printers (void *printers, struct type *type)
   Py_XDECREF (func);
   Py_XDECREF (result_obj);
   do_cleanups (cleanups);
-  return result;
+  if (result != NULL)
+    *prettied_type = result;
+  return result != NULL ? EXT_LANG_RC_OK : EXT_LANG_RC_ERROR;
 }
 
-/* Free the result of start_type_printers.  */
+/* Free the result of start_type_printers.
+   This is the extension_language_ops.free_type_printers "method".  */
 
-void
-free_type_printers (void *arg)
+static void
+gdbpy_free_type_printers (const struct extension_language_defn *extlang,
+			  struct ext_lang_type_printers *ext_printers)
 {
   struct cleanup *cleanups;
-  PyObject *printers = arg;
+  PyObject *printers = ext_printers->py_type_printers;
 
   if (printers == NULL)
     return;
@@ -1381,62 +1483,6 @@ python_command (char *arg, int from_tty)
   python_interactive_command (arg, from_tty);
 }
 
-void
-eval_python_from_control_command (struct command_line *cmd)
-{
-  error (_("Python scripting is not supported in this copy of GDB."));
-}
-
-void
-source_python_script (FILE *file, const char *filename)
-{
-  internal_error (__FILE__, __LINE__,
-		  _("source_python_script called when Python scripting is "
-		    "not supported."));
-}
-
-int
-gdbpy_should_stop (struct gdbpy_breakpoint_object *bp_obj)
-{
-  internal_error (__FILE__, __LINE__,
-		  _("gdbpy_should_stop called when Python scripting is  " \
-		    "not supported."));
-}
-
-int
-gdbpy_breakpoint_has_py_cond (struct gdbpy_breakpoint_object *bp_obj)
-{
-  internal_error (__FILE__, __LINE__,
-		  _("gdbpy_breakpoint_has_py_cond called when Python " \
-		    "scripting is not supported."));
-}
-
-void *
-start_type_printers (void)
-{
-  return NULL;
-}
-
-char *
-apply_type_printers (void *ignore, struct type *type)
-{
-  return NULL;
-}
-
-void
-free_type_printers (void *arg)
-{
-}
-
-enum py_bt_status
-apply_frame_filter (struct frame_info *frame, int flags,
-		    enum py_frame_args args_type,
-		    struct ui_out *out, int frame_low,
-		    int frame_high)
-{
-  return PY_BT_NO_FILTERS;
-}
-
 #endif /* HAVE_PYTHON */
 
 
@@ -1691,8 +1737,6 @@ message == an error message without a stack will be printed."),
       || gdbpy_initialize_arch () < 0)
     goto fail;
 
-  observer_attach_before_prompt (before_prompt_hook);
-
   gdbpy_to_string_cst = PyString_FromString ("to_string");
   if (gdbpy_to_string_cst == NULL)
     goto fail;
@@ -1734,10 +1778,11 @@ message == an error message without a stack will be printed."),
 /* Perform the remaining python initializations.
    These must be done after GDB is at least mostly initialized.
    E.g., The "info pretty-printer" command needs the "info" prefix
-   command installed.  */
+   command installed.
+   This is the extension_language_ops.finish_initialization "method".  */
 
-void
-finish_python_initialization (void)
+static void
+gdbpy_finish_initialization (const struct extension_language_defn *extlang)
 {
   PyObject *m;
   char *gdb_pythondir;
@@ -1816,6 +1861,15 @@ finish_python_initialization (void)
   do_cleanups (cleanup);
 }
 
+/* Return non-zero if Python has successfully initialized.
+   This is the extension_languages_ops.initialized "method".  */
+
+static int
+gdbpy_initialized (const struct extension_language_defn *extlang)
+{
+  return gdb_python_initialized;
+}
+
 #endif /* HAVE_PYTHON */
 
 
diff --git a/gdb/python/python.h b/gdb/python/python.h
index abbb581..b9679d9 100644
--- a/gdb/python/python.h
+++ b/gdb/python/python.h
@@ -20,118 +20,9 @@
 #ifndef GDB_PYTHON_H
 #define GDB_PYTHON_H
 
-#include "value.h"
-#include "mi/mi-cmds.h"
+#include "extension.h"
 
-struct gdbpy_breakpoint_object;
-
-/* The suffix of per-objfile scripts to auto-load.
-   E.g. When the program loads libfoo.so, look for libfoo-gdb.py.  */
-#define GDBPY_AUTO_FILE_NAME "-gdb.py"
-
-/* Python frame-filter status return values.  */
-enum py_bt_status
-  {
-    /* Return when an error has occurred in processing frame filters,
-       or when printing the stack.  */
-    PY_BT_ERROR = -1,
-
-    /* Return from internal routines to indicate that the function
-       succeeded.  */
-    PY_BT_OK = 1,
-
-    /* Return when the frame filter process is complete, and all
-       operations have succeeded.  */
-    PY_BT_COMPLETED = 2,
-
-    /* Return when the frame filter process is complete, but there
-       were no filter registered and enabled to process. */
-    PY_BT_NO_FILTERS = 3
-  };
-
-/* Flags to pass to apply_frame_filter.  */
-
-enum frame_filter_flags
-  {
-    /* Set this flag if frame level is to be printed.  */
-    PRINT_LEVEL = 1,
-
-    /* Set this flag if frame information is to be printed.  */
-    PRINT_FRAME_INFO = 2,
-
-    /* Set this flag if frame arguments are to be printed.  */
-    PRINT_ARGS = 4,
-
-    /* Set this flag if frame locals are to be printed.  */
-    PRINT_LOCALS = 8,
-  };
-
-/* A choice of the different frame argument printing strategies that
-   can occur in different cases of frame filter instantiation.  */
-typedef enum py_frame_args
-{
-  /* Print no values for arguments when invoked from the MI. */
-  NO_VALUES = PRINT_NO_VALUES,
-
-  MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
-
-  /* Print only simple values (what MI defines as "simple") for
-     arguments when invoked from the MI. */
-  MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
-
-
-  /* Print only scalar values for arguments when invoked from the
-     CLI. */
-  CLI_SCALAR_VALUES,
-
-  /* Print all values for arguments when invoked from the
-     CLI. */
-  CLI_ALL_VALUES
-} py_frame_args;
-
-/* Returns true if Python support is built into GDB, false
-   otherwise.  */
-
-static inline int
-have_python (void)
-{
-#ifdef HAVE_PYTHON
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-extern void finish_python_initialization (void);
-
-void eval_python_from_control_command (struct command_line *);
-
-void source_python_script (FILE *file, const char *filename);
-
-int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
-			      int embedded_offset, CORE_ADDR address,
-			      struct ui_file *stream, int recurse,
-			      const struct value *val,
-			      const struct value_print_options *options,
-			      const struct language_defn *language);
-
-enum py_bt_status apply_frame_filter (struct frame_info *frame, int flags,
-				      enum py_frame_args args_type,
-				      struct ui_out *out, int frame_low,
-				      int frame_high);
-
-void preserve_python_values (struct objfile *objfile, htab_t copied_types);
-
-const struct script_language *gdbpy_script_language_defn (void);
-
-int gdbpy_should_stop (struct gdbpy_breakpoint_object *bp_obj);
-
-int gdbpy_breakpoint_has_py_cond (struct gdbpy_breakpoint_object *bp_obj);
-
-void *start_type_printers (void);
-
-char *apply_type_printers (void *, struct type *type);
-
-void free_type_printers (void *arg);
+/* This is all that python exports to gdb.  */
+extern const struct extension_language_defn extension_language_python;
 
 #endif /* GDB_PYTHON_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]