public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 09/13] script language API for GDB
@ 2013-12-05 17:21 Doug Evans
  0 siblings, 0 replies; only message in thread
From: Doug Evans @ 2013-12-05 17:21 UTC (permalink / raw)
  To: gdb-patches

This patch contains the associated changes to stack.c, py-framefilter.c.
Mostly it's just updated namings of the enum values.

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

	* stack.c (backtrace_command_1): Update to use enum script_bt_status.
	Update to use enum script_frame_args.  Update to call
	apply_script_frame_filter.
	* python/py-framefilter.c (extract_sym): Update to use enum
	script_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 slang.  Update to use enum script_bt_status.

diff --git a/gdb/stack.c b/gdb/stack.c
index 9a12eb3..ca2db99 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1688,7 +1688,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
   int i;
   struct frame_info *trailing;
   int trailing_level, py_start = 0, py_end = 0;
-  enum py_bt_status result = PY_BT_ERROR;
+  enum script_bt_status result = SCR_BT_ERROR;
 
   if (!target_has_stack)
     error (_("No stack."));
@@ -1762,7 +1762,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
   if (! no_filters)
     {
       int flags = PRINT_LEVEL | PRINT_FRAME_INFO | PRINT_ARGS;
-      enum py_frame_args arg_type;
+      enum script_frame_args arg_type;
 
       if (show_locals)
 	flags |= PRINT_LOCALS;
@@ -1774,13 +1774,14 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
       else
 	arg_type = NO_VALUES;
 
-      result = apply_frame_filter (get_current_frame (), flags, arg_type,
-				   current_uiout, py_start, py_end);
-
+      result = apply_script_frame_filter (get_current_frame (), flags,
+					  arg_type, current_uiout,
+					  py_start, py_end);
     }
+
   /* Run the inbuilt backtrace if there are no filters registered, or
      "no-filters" has been specified from the command.  */
-  if (no_filters ||  result == PY_BT_NO_FILTERS)
+  if (no_filters ||  result == SCR_BT_NO_FILTERS)
     {
       for (i = 0, fi = trailing; fi && count--; i++, fi = get_prev_frame (fi))
 	{
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 871c245..65382b2 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -48,17 +48,17 @@ enum mi_print_types
    this will be set to NULL.  LANGUAGE is also a pass-through argument
    denoting the language attributed to the Symbol.  In the case of SYM
    being  NULL, this  will be  set to  the current  language.  Returns
-   PY_BT_ERROR on error with the appropriate Python exception set, and
-   PY_BT_OK on success.  */
+   SCR_BT_ERROR on error with the appropriate Python exception set, and
+   SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 extract_sym (PyObject *obj, char **name, struct symbol **sym,
 	     const struct language_defn **language)
 {
   PyObject *result = PyObject_CallMethod (obj, "symbol", NULL);
 
   if (result == NULL)
-    return PY_BT_ERROR;
+    return SCR_BT_ERROR;
 
   /* For 'symbol' callback, the function can return a symbol or a
      string.  */
@@ -68,7 +68,7 @@ extract_sym (PyObject *obj, char **name, struct symbol **sym,
       Py_DECREF (result);
 
       if (*name == NULL)
-	return PY_BT_ERROR;
+	return SCR_BT_ERROR;
       /* If the API returns a string (and not a symbol), then there is
 	no symbol derived language available and the frame filter has
 	either overridden the symbol with a string, or supplied a
@@ -90,7 +90,7 @@ extract_sym (PyObject *obj, char **name, struct symbol **sym,
 	  PyErr_SetString (PyExc_RuntimeError,
 			   _("Unexpected value.  Expecting a "
 			     "gdb.Symbol or a Python string."));
-	  return PY_BT_ERROR;
+	  return SCR_BT_ERROR;
 	}
 
       /* Duplicate the symbol name, so the caller has consistency
@@ -106,7 +106,7 @@ extract_sym (PyObject *obj, char **name, struct symbol **sym,
 	*language = current_language;
     }
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 }
 
 /* Helper function to extract a value from an object that conforms to
@@ -114,11 +114,11 @@ extract_sym (PyObject *obj, char **name, struct symbol **sym,
    the value from.  VALUE is a pass-through argument where the value
    will be written.  If the object does not have the value attribute,
    or provides the Python None for a value, VALUE will be set to NULL
-   and this function will return as successful.  Returns PY_BT_ERROR
-   on error with the appropriate Python exception set, and PY_BT_OK on
+   and this function will return as successful.  Returns SCR_BT_ERROR
+   on error with the appropriate Python exception set, and SCR_BT_OK on
    success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 extract_value (PyObject *obj, struct value **value)
 {
   if (PyObject_HasAttrString (obj, "value"))
@@ -126,7 +126,7 @@ extract_value (PyObject *obj, struct value **value)
       PyObject *vresult = PyObject_CallMethod (obj, "value", NULL);
 
       if (vresult == NULL)
-	return PY_BT_ERROR;
+	return SCR_BT_ERROR;
 
       /* The Python code has returned 'None' for a value, so we set
 	 value to NULL.  This flags that GDB should read the
@@ -135,7 +135,7 @@ extract_value (PyObject *obj, struct value **value)
 	{
 	  Py_DECREF (vresult);
 	  *value = NULL;
-	  return PY_BT_OK;
+	  return SCR_BT_OK;
 	}
       else
 	{
@@ -143,15 +143,15 @@ extract_value (PyObject *obj, struct value **value)
 	  Py_DECREF (vresult);
 
 	  if (*value == NULL)
-	    return PY_BT_ERROR;
+	    return SCR_BT_ERROR;
 
-	  return PY_BT_OK;
+	  return SCR_BT_OK;
 	}
     }
   else
     *value = NULL;
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 }
 
 /* MI prints only certain values according to the type of symbol and
@@ -195,11 +195,11 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
 /* Helper function which outputs a type name extracted from VAL to a
    "type" field in the output stream OUT.  OUT is the ui-out structure
    the type name will be output too, and VAL is the value that the
-   type will be extracted from.  Returns PY_BT_ERROR on error, with
-   any GDB exceptions converted to a Python exception, or PY_BT_OK on
+   type will be extracted from.  Returns SCR_BT_ERROR on error, with
+   any GDB exceptions converted to a Python exception, or SCR_BT_OK on
    success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 py_print_type (struct ui_out *out, struct value *val)
 {
   volatile struct gdb_exception except;
@@ -220,10 +220,10 @@ py_print_type (struct ui_out *out, struct value *val)
   if (except.reason < 0)
     {
       gdbpy_convert_exception (except);
-      return PY_BT_ERROR;
+      return SCR_BT_ERROR;
     }
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 }
 
 /* Helper function which outputs a value to an output field in a
@@ -231,15 +231,15 @@ py_print_type (struct ui_out *out, struct value *val)
    VAL is the value that will be printed, OPTS contains the value
    printing options, ARGS_TYPE is an enumerator describing the
    argument format, and LANGUAGE is the language_defn that the value
-   will be printed with.  Returns PY_BT_ERROR on error, with any GDB
-   exceptions converted to a Python exception, or PY_BT_OK on
+   will be printed with.  Returns SCR_BT_ERROR on error, with any GDB
+   exceptions converted to a Python exception, or SCR_BT_OK on
    success. */
 
-static enum py_bt_status
+static enum script_bt_status
 py_print_value (struct ui_out *out, struct value *val,
 		const struct value_print_options *opts,
 		int indent,
-		enum py_frame_args args_type,
+		enum script_frame_args args_type,
 		const struct language_defn *language)
 {
   int should_print = 0;
@@ -265,7 +265,7 @@ py_print_value (struct ui_out *out, struct value *val,
       if (except.reason < 0)
 	{
 	  gdbpy_convert_exception (except);
-	  return PY_BT_ERROR;
+	  return SCR_BT_ERROR;
 	}
 
       if (args_type == MI_PRINT_ALL_VALUES)
@@ -295,11 +295,11 @@ py_print_value (struct ui_out *out, struct value *val,
       if (except.reason < 0)
 	{
 	  gdbpy_convert_exception (except);
-	  return PY_BT_ERROR;
+	  return SCR_BT_ERROR;
 	}
     }
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 }
 
 /* Helper function to call a Python method and extract an iterator
@@ -350,16 +350,16 @@ get_py_iter_from_func (PyObject *filter, char *func)
     ARGS_TYPE is an enumerator describing the argument format,
     PRINT_ARGS_FIELD is a flag which indicates if we output "ARGS=1"
     in MI output in commands where both arguments and locals are
-    printed.  Returns PY_BT_ERROR on error, with any GDB exceptions
-    converted to a Python exception, or PY_BT_OK on success.  */
+    printed.  Returns SCR_BT_ERROR on error, with any GDB exceptions
+    converted to a Python exception, or SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 py_print_single_arg (struct ui_out *out,
 		     const char *sym_name,
 		     struct frame_arg *fa,
 		     struct value *fv,
 		     const struct value_print_options *opts,
-		     enum py_frame_args args_type,
+		     enum script_frame_args args_type,
 		     int print_args_field,
 		     const struct language_defn *language)
 {
@@ -435,7 +435,7 @@ py_print_single_arg (struct ui_out *out,
 	 types.  */
       if (args_type == MI_PRINT_SIMPLE_VALUES)
 	{
-	  if (py_print_type (out, val) == PY_BT_ERROR)
+	  if (py_print_type (out, val) == SCR_BT_ERROR)
 	    {
 	      do_cleanups (cleanups);
 	      goto error;
@@ -455,7 +455,7 @@ py_print_single_arg (struct ui_out *out,
 	  if (args_type != NO_VALUES)
 	    {
 	      if (py_print_value (out, val, opts, 0, args_type, language)
-		  == PY_BT_ERROR)
+		  == SCR_BT_ERROR)
 		{
 		  do_cleanups (cleanups);
 		  goto error;
@@ -471,10 +471,10 @@ py_print_single_arg (struct ui_out *out,
       goto error;
     }
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 
  error:
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 /* Helper function to loop over frame arguments provided by the
@@ -484,14 +484,14 @@ py_print_single_arg (struct ui_out *out,
    enumerator describing the argument format, PRINT_ARGS_FIELD is a
    flag which indicates if we output "ARGS=1" in MI output in commands
    where both arguments and locals are printed, and FRAME is the
-   backing frame.  Returns PY_BT_ERROR on error, with any GDB
-   exceptions converted to a Python exception, or PY_BT_OK on
+   backing frame.  Returns SCR_BT_ERROR on error, with any GDB
+   exceptions converted to a Python exception, or SCR_BT_OK on
    success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 enumerate_args (PyObject *iter,
 		struct ui_out *out,
-		enum py_frame_args args_type,
+		enum script_frame_args args_type,
 		int print_args_field,
 		struct frame_info *frame)
 {
@@ -533,17 +533,17 @@ enumerate_args (PyObject *iter,
       char *sym_name;
       struct symbol *sym;
       struct value *val;
-      enum py_bt_status success = PY_BT_ERROR;
+      enum script_bt_status success = SCR_BT_ERROR;
 
       success = extract_sym (item, &sym_name, &sym, &language);
-      if (success == PY_BT_ERROR)
+      if (success == SCR_BT_ERROR)
 	{
 	  Py_DECREF (item);
 	  goto error;
 	}
 
       success = extract_value (item, &val);
-      if (success == PY_BT_ERROR)
+      if (success == SCR_BT_ERROR)
 	{
 	  xfree (sym_name);
 	  Py_DECREF (item);
@@ -597,7 +597,7 @@ enumerate_args (PyObject *iter,
 				       NULL, &opts,
 				       args_type,
 				       print_args_field,
-				       NULL) == PY_BT_ERROR)
+				       NULL) == SCR_BT_ERROR)
 		{
 		  xfree (arg.error);
 		  xfree (entryarg.error);
@@ -627,7 +627,7 @@ enumerate_args (PyObject *iter,
 
 	      if (py_print_single_arg (out, NULL, &entryarg, NULL,
 				      &opts, args_type,
-				      print_args_field, NULL) == PY_BT_ERROR)
+				      print_args_field, NULL) == SCR_BT_ERROR)
 		{
 		      xfree (arg.error);
 		      xfree (entryarg.error);
@@ -646,7 +646,7 @@ enumerate_args (PyObject *iter,
 	    {
 	      if (py_print_single_arg (out, sym_name, NULL, val, &opts,
 				       args_type, print_args_field,
-				       language) == PY_BT_ERROR)
+				       language) == SCR_BT_ERROR)
 		{
 		  xfree (sym_name);
 		  goto error;
@@ -688,10 +688,10 @@ enumerate_args (PyObject *iter,
 	}
     }
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 
  error:
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 
@@ -703,14 +703,14 @@ enumerate_args (PyObject *iter,
    the argument format, PRINT_ARGS_FIELD is flag which indicates
    whether to output the ARGS field in the case of
    -stack-list-variables and FRAME is the backing frame.  Returns
-   PY_BT_ERROR on error, with any GDB exceptions converted to a Python
-   exception, or PY_BT_OK on success.  */
+   SCR_BT_ERROR on error, with any GDB exceptions converted to a Python
+   exception, or SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 enumerate_locals (PyObject *iter,
 		  struct ui_out *out,
 		  int indent,
-		  enum py_frame_args args_type,
+		  enum script_frame_args args_type,
 		  int print_args_field,
 		  struct frame_info *frame)
 {
@@ -725,7 +725,7 @@ enumerate_locals (PyObject *iter,
       const struct language_defn *language;
       char *sym_name;
       struct value *val;
-      enum py_bt_status  success = PY_BT_ERROR;
+      enum script_bt_status success = SCR_BT_ERROR;
       struct symbol *sym;
       volatile struct gdb_exception except;
       int local_indent = 8 + (8 * indent);
@@ -734,7 +734,7 @@ enumerate_locals (PyObject *iter,
       locals_cleanups = make_cleanup_py_decref (item);
 
       success = extract_sym (item, &sym_name, &sym, &language);
-      if (success == PY_BT_ERROR)
+      if (success == SCR_BT_ERROR)
 	{
 	  do_cleanups (locals_cleanups);
 	  goto error;
@@ -743,7 +743,7 @@ enumerate_locals (PyObject *iter,
       make_cleanup (xfree, sym_name);
 
       success = extract_value (item, &val);
-      if (success == PY_BT_ERROR)
+      if (success == SCR_BT_ERROR)
 	{
 	  do_cleanups (locals_cleanups);
 	  goto error;
@@ -801,7 +801,7 @@ enumerate_locals (PyObject *iter,
 
       if (args_type == MI_PRINT_SIMPLE_VALUES)
 	{
-	  if (py_print_type (out, val) == PY_BT_ERROR)
+	  if (py_print_type (out, val) == SCR_BT_ERROR)
 	    {
 	      do_cleanups (locals_cleanups);
 	      goto error;
@@ -815,7 +815,7 @@ enumerate_locals (PyObject *iter,
 	  int val_indent = (indent + 1) * 4;
 
 	  if (py_print_value (out, val, &opts, val_indent, args_type,
-			      language) ==  PY_BT_ERROR)
+			      language) == SCR_BT_ERROR)
 	    {
 	      do_cleanups (locals_cleanups);
 	      goto error;
@@ -826,7 +826,7 @@ enumerate_locals (PyObject *iter,
 	  if (args_type != NO_VALUES)
 	    {
 	      if (py_print_value (out, val, &opts, 0, args_type,
-				  language) ==  PY_BT_ERROR)
+				  language) == SCR_BT_ERROR)
 		{
 		  do_cleanups (locals_cleanups);
 		  goto error;
@@ -850,19 +850,19 @@ enumerate_locals (PyObject *iter,
   if (item == NULL && PyErr_Occurred ())
     goto error;
 
-  return PY_BT_OK;
+  return SCR_BT_OK;
 
  error:
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
-/*  Helper function for -stack-list-variables.  Returns PY_BT_ERROR on
-    error, or PY_BT_OK on success.  */
+/*  Helper function for -stack-list-variables.  Returns SCR_BT_ERROR on
+    error, or SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 py_mi_print_variables (PyObject *filter, struct ui_out *out,
 		       struct value_print_options *opts,
-		       enum py_frame_args args_type,
+		       enum script_frame_args args_type,
 		       struct frame_info *frame)
 {
   struct cleanup *old_chain;
@@ -882,30 +882,30 @@ py_mi_print_variables (PyObject *filter, struct ui_out *out,
   make_cleanup_ui_out_list_begin_end (out, "variables");
 
   if (args_iter != Py_None)
-    if (enumerate_args (args_iter, out, args_type, 1, frame) == PY_BT_ERROR)
+    if (enumerate_args (args_iter, out, args_type, 1, frame) == SCR_BT_ERROR)
       goto error;
 
   if (locals_iter != Py_None)
     if (enumerate_locals (locals_iter, out, 1, args_type, 1, frame)
-	== PY_BT_ERROR)
+	== SCR_BT_ERROR)
       goto error;
 
   do_cleanups (old_chain);
-  return PY_BT_OK;
+  return SCR_BT_OK;
 
  error:
   do_cleanups (old_chain);
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 /* Helper function for printing locals.  This function largely just
    creates the wrapping tuple, and calls enumerate_locals.  Returns
-   PY_BT_ERROR on error, or PY_BT_OK on success.*/
+   SCR_BT_ERROR on error, or SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 py_print_locals (PyObject *filter,
 		 struct ui_out *out,
-		 enum py_frame_args args_type,
+		 enum script_frame_args args_type,
 		 int indent,
 		 struct frame_info *frame)
 {
@@ -920,26 +920,26 @@ py_print_locals (PyObject *filter,
 
   if (locals_iter != Py_None)
     if (enumerate_locals (locals_iter, out, indent, args_type,
-			  0, frame) == PY_BT_ERROR)
+			  0, frame) == SCR_BT_ERROR)
       goto locals_error;
 
   do_cleanups (old_chain);
-  return PY_BT_OK;;
+  return SCR_BT_OK;;
 
  locals_error:
   do_cleanups (old_chain);
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 /* Helper function for printing frame arguments.  This function
    largely just creates the wrapping tuple, and calls enumerate_args.
-   Returns PY_BT_ERROR on error, with any GDB exceptions converted to
-   a Python exception, or PY_BT_OK on success.  */
+   Returns SCR_BT_ERROR on error, with any GDB exceptions converted to
+   a Python exception, or SCR_BT_OK on success.  */
 
-static enum py_bt_status
+static enum script_bt_status
 py_print_args (PyObject *filter,
 	       struct ui_out *out,
-	       enum py_frame_args args_type,
+	       enum script_frame_args args_type,
 	       struct frame_info *frame)
 {
   PyObject *args_iter  = get_py_iter_from_func (filter, "frame_args");
@@ -964,7 +964,7 @@ py_print_args (PyObject *filter,
     }
 
   if (args_iter != Py_None)
-    if (enumerate_args (args_iter, out, args_type, 0, frame) == PY_BT_ERROR)
+    if (enumerate_args (args_iter, out, args_type, 0, frame) == SCR_BT_ERROR)
       goto args_error;
 
   TRY_CATCH (except, RETURN_MASK_ALL)
@@ -979,11 +979,11 @@ py_print_args (PyObject *filter,
     }
 
   do_cleanups (old_chain);
-  return PY_BT_OK;
+  return SCR_BT_OK;
 
  args_error:
   do_cleanups (old_chain);
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 /*  Print a single frame to the designated output stream, detecting
@@ -997,12 +997,12 @@ py_print_args (PyObject *filter,
     (in the case of elided frames), and LEVELS_PRINTED is a hash-table
     containing all the frames level that have already been printed.
     If a frame level has been printed, do not print it again (in the
-    case of elided frames).  Returns PY_BT_ERROR on error, with any
-    GDB exceptions converted to a Python exception, or PY_BT_COMPLETED
+    case of elided frames).  Returns SCR_BT_ERROR on error, with any
+    GDB exceptions converted to a Python exception, or SCR_BT_COMPLETED
     on success.  */
 
-static enum py_bt_status
-py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
+static enum script_bt_status
+py_print_frame (PyObject *filter, int flags, enum script_frame_args args_type,
 		struct ui_out *out, int indent, htab_t levels_printed)
 {
   int has_addr = 0;
@@ -1052,12 +1052,12 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
   if (print_locals && print_args && ! print_frame_info)
     {
       if (py_mi_print_variables (filter, out, &opts,
-				 args_type, frame) == PY_BT_ERROR)
+				 args_type, frame) == SCR_BT_ERROR)
 	goto error;
       else
 	{
 	  do_cleanups (cleanup_stack);
-	  return PY_BT_COMPLETED;
+	  return SCR_BT_COMPLETED;
 	}
     }
 
@@ -1230,7 +1230,7 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
      wrong.  */
   if (print_args)
     {
-      if (py_print_args (filter, out, args_type, frame) == PY_BT_ERROR)
+      if (py_print_args (filter, out, args_type, frame) == SCR_BT_ERROR)
 	goto error;
     }
 
@@ -1334,7 +1334,7 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
   if (print_locals)
     {
       if (py_print_locals (filter, out, args_type, indent,
-			   frame) == PY_BT_ERROR)
+			   frame) == SCR_BT_ERROR)
 	goto error;
     }
 
@@ -1355,12 +1355,12 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
 
       while ((item = PyIter_Next (elided)))
 	{
-	  enum py_bt_status success = py_print_frame (item, flags,
-						      args_type, out,
-						      indent,
-						      levels_printed);
+	  enum script_bt_status success = py_print_frame (item, flags,
+							  args_type, out,
+							  indent,
+							  levels_printed);
 
-	  if (success == PY_BT_ERROR)
+	  if (success == SCR_BT_ERROR)
 	    {
 	      Py_DECREF (item);
 	      goto error;
@@ -1374,11 +1374,11 @@ py_print_frame (PyObject *filter, int flags, enum py_frame_args args_type,
 
 
   do_cleanups (cleanup_stack);
-  return PY_BT_COMPLETED;
+  return SCR_BT_COMPLETED;
 
  error:
   do_cleanups (cleanup_stack);
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }
 
 /* Helper function to initiate frame filter invocation at starting
@@ -1456,26 +1456,25 @@ bootstrap_python_frame_filters (struct frame_info *frame,
     variables.  ARGS_TYPE is an enumerator describing the argument
     format, OUT is the output stream to print.  FRAME_LOW is the
     beginning of the slice of frames to print, and FRAME_HIGH is the
-    upper limit of the frames to count.  Returns PY_BT_ERROR on error,
-    or PY_BT_COMPLETED on success.*/
-
-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)
-
+    upper limit of the frames to count.  Returns SCR_BT_ERROR on error,
+    or SCR_BT_COMPLETED on success.  */
+
+enum script_bt_status
+gdbpy_apply_frame_filter (const struct script_language_defn *slang,
+			  struct frame_info *frame, int flags,
+			  enum script_frame_args args_type,
+			  struct ui_out *out, int frame_low, int frame_high)
 {
   struct gdbarch *gdbarch = NULL;
   struct cleanup *cleanups;
-  enum py_bt_status success = PY_BT_ERROR;
+  enum script_bt_status success = SCR_BT_ERROR;
   PyObject *iterable;
   volatile struct gdb_exception except;
   PyObject *item;
   htab_t levels_printed;
 
   if (!gdb_python_initialized)
-    return PY_BT_NO_FILTERS;
+    return SCR_BT_NO_FILTERS;
 
   cleanups = ensure_python_env (gdbarch, current_language);
 
@@ -1501,14 +1500,14 @@ apply_frame_filter (struct frame_info *frame, int flags,
 	 where GDB cannot initialize the frame filters (most likely
 	 due to incorrect auto-load paths), GDB has printed nothing.
 	 In this case it is OK to print the default backtrace after
-	 printing the error message.  GDB returns PY_BT_NO_FILTERS
+	 printing the error message.  GDB returns SCR_BT_NO_FILTERS
 	 here to signify there are no filters after printing the
 	 initialization error.  This return code will trigger a
 	 default backtrace.  */
 
       gdbpy_print_stack ();
       do_cleanups (cleanups);
-      return PY_BT_NO_FILTERS;
+      return SCR_BT_NO_FILTERS;
     }
 
   /* If iterable is None, then there are no frame filters registered.
@@ -1517,7 +1516,7 @@ apply_frame_filter (struct frame_info *frame, int flags,
   make_cleanup_py_decref (iterable);
   if (iterable == Py_None)
     {
-      success = PY_BT_NO_FILTERS;
+      success = SCR_BT_NO_FILTERS;
       goto done;
     }
 
@@ -1534,7 +1533,7 @@ apply_frame_filter (struct frame_info *frame, int flags,
 
       /* Do not exit on error printing a single frame.  Print the
 	 error and continue with other frames.  */
-      if (success == PY_BT_ERROR)
+      if (success == SCR_BT_ERROR)
 	gdbpy_print_stack ();
 
       Py_DECREF (item);
@@ -1552,5 +1551,5 @@ apply_frame_filter (struct frame_info *frame, int flags,
  error:
   gdbpy_print_stack ();
   do_cleanups (cleanups);
-  return PY_BT_ERROR;
+  return SCR_BT_ERROR;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-05 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-05 17:21 [PATCH 09/13] script language API for GDB Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).