[RFA,04/10] Remove EXT_LANG_BT_COMPLETED

Message ID 20170425194113.17862-5-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey April 25, 2017, 7:41 p.m. UTC
  While looking at the frame filter code, I noticed that
EXT_LANG_BT_COMPLETED is not really needed.  Semantically there is no
difference between the "completed" and "ok" results.  So, this patch
removes this constant.

ChangeLog
2017-04-25  Tom Tromey  <tom@tromey.com>

	* python/py-framefilter.c (py_print_frame): Return
	EXT_LANG_BT_OK.
	(gdbpy_apply_frame_filter): Update comment.
	* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
	Remove.
	<EXT_LANG_BT_NO_FILTERS>: Change value.
---
 gdb/ChangeLog               | 9 +++++++++
 gdb/extension.h             | 6 +-----
 gdb/python/py-framefilter.c | 8 ++++----
 3 files changed, 14 insertions(+), 9 deletions(-)
  

Comments

Phil Muldoon April 28, 2017, 2:52 p.m. UTC | #1
On 25/04/17 20:41, Tom Tromey wrote:
> While looking at the frame filter code, I noticed that
> EXT_LANG_BT_COMPLETED is not really needed.  Semantically there is no
> difference between the "completed" and "ok" results.  So, this patch
> removes this constant.
> 
> ChangeLog
> 2017-04-25  Tom Tromey  <tom@tromey.com>
> 
> 	* python/py-framefilter.c (py_print_frame): Return
> 	EXT_LANG_BT_OK.
> 	(gdbpy_apply_frame_filter): Update comment.
> 	* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
> 	Remove.
> 	<EXT_LANG_BT_NO_FILTERS>: Change value.

I wish I could remember why I added this. OTOH it could have been a relic even from the initial code submission.

Anyway, patch LGTM.

Cheers,

Phil
  
Pedro Alves June 27, 2017, 4:40 p.m. UTC | #2
On 04/28/2017 03:52 PM, Phil Muldoon wrote:
> On 25/04/17 20:41, Tom Tromey wrote:
>> While looking at the frame filter code, I noticed that
>> EXT_LANG_BT_COMPLETED is not really needed.  Semantically there is no
>> difference between the "completed" and "ok" results.  So, this patch
>> removes this constant.
>>
>> ChangeLog
>> 2017-04-25  Tom Tromey  <tom@tromey.com>
>>
>> 	* python/py-framefilter.c (py_print_frame): Return
>> 	EXT_LANG_BT_OK.
>> 	(gdbpy_apply_frame_filter): Update comment.
>> 	* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
>> 	Remove.
>> 	<EXT_LANG_BT_NO_FILTERS>: Change value.
> 
> I wish I could remember why I added this. OTOH it could have been a relic even from the initial code submission.
> 
> Anyway, patch LGTM.

LGTM too.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f68e32c..176332a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@ 
 2017-04-25  Tom Tromey  <tom@tromey.com>
 
+	* python/py-framefilter.c (py_print_frame): Return
+	EXT_LANG_BT_OK.
+	(gdbpy_apply_frame_filter): Update comment.
+	* extension.h (enum ext_lang_bt_status) <EXT_LANG_BT_COMPLETED>:
+	Remove.
+	<EXT_LANG_BT_NO_FILTERS>: Change value.
+
+2017-04-25  Tom Tromey  <tom@tromey.com>
+
 	PR backtrace/15582:
 	* stack.c (backtrace_command): Parse "elide" argument.
 	* python/py-framefilter.c (py_print_frame): Handle PRINT_ELIDE.
diff --git a/gdb/extension.h b/gdb/extension.h
index 7c35502..59205e1 100644
--- a/gdb/extension.h
+++ b/gdb/extension.h
@@ -76,13 +76,9 @@  enum ext_lang_bt_status
        succeeded.  */
     EXT_LANG_BT_OK = 1,
 
-    /* Return when the frame filter process is complete, and all
-       operations have succeeded.  */
-    EXT_LANG_BT_COMPLETED = 2,
-
     /* Return when the frame filter process is complete, but there
        were no filter registered and enabled to process.  */
-    EXT_LANG_BT_NO_FILTERS = 3
+    EXT_LANG_BT_NO_FILTERS = 2
   };
 
 /* Flags to pass to apply_extlang_frame_filter.  */
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index f0474a9..2bbbfbe 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -916,7 +916,7 @@  py_print_args (PyObject *filter,
     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 EXT_LANG_BT_ERROR on error, with any
-    GDB exceptions converted to a Python exception, or EXT_LANG_BT_COMPLETED
+    GDB exceptions converted to a Python exception, or EXT_LANG_BT_OK
     on success.  It can also throw an exception RETURN_QUIT.  */
 
 static enum ext_lang_bt_status
@@ -969,7 +969,7 @@  py_print_frame (PyObject *filter, int flags,
       if (py_mi_print_variables (filter, out, &opts,
 				 args_type, frame) == EXT_LANG_BT_ERROR)
 	return EXT_LANG_BT_ERROR;
-      return EXT_LANG_BT_COMPLETED;
+      return EXT_LANG_BT_OK;
     }
 
   gdb::optional<ui_out_emit_tuple> tuple;
@@ -1270,7 +1270,7 @@  py_print_frame (PyObject *filter, int flags,
 	}
     }
 
-  return EXT_LANG_BT_COMPLETED;
+  return EXT_LANG_BT_OK;
 }
 
 /* Helper function to initiate frame filter invocation at starting
@@ -1328,7 +1328,7 @@  bootstrap_python_frame_filters (struct frame_info *frame,
     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 EXT_LANG_BT_ERROR on error,
-    or EXT_LANG_BT_COMPLETED on success.  */
+    or EXT_LANG_BT_OK on success.  */
 
 enum ext_lang_bt_status
 gdbpy_apply_frame_filter (const struct extension_language_defn *extlang,