[RFA] Fix PR python/20129 - use of non-existing variable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[RFA] Fix PR python/20129 - use of non-existing variable

Tom Tromey-2
PR python/20129 concerns the error message one gets from a command
like "disable frame-filter global NoSuchFilter".  Currently this
throws a second, unexpected, exception due to the use of a
non-existing variable named "name".

This patch adds regression tests and fixes a couple of spots to use
the correct variable name.

Built and regtested on x86-64 Fedora 23.

2016-06-06  Tom Tromey  <[hidden email]>

        PR python/20129:
        * python/lib/gdb/command/frame_filters.py (_do_enable_frame_filter)
        (SetFrameFilterPriority._set_filter_priority): Use "frame_filter",
        not "name".

2016-06-06  Tom Tromey  <[hidden email]>

        PR python/20129:
        * gdb.python/py-framefilter.exp: Add tests for setting priority
        and disabling of non-existent frame filter.
---
 gdb/ChangeLog                               | 7 +++++++
 gdb/python/lib/gdb/command/frame_filters.py | 4 ++--
 gdb/testsuite/ChangeLog                     | 6 ++++++
 gdb/testsuite/gdb.python/py-framefilter.exp | 6 ++++++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index af4ddcc..525ec33 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-06  Tom Tromey  <[hidden email]>
+
+ PR python/20129:
+ * python/lib/gdb/command/frame_filters.py (_do_enable_frame_filter)
+ (SetFrameFilterPriority._set_filter_priority): Use "frame_filter",
+ not "name".
+
 2016-06-02  Jon Turney  <[hidden email]>
 
  * windows-nat.c (handle_output_debug_string): Return type of
diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py
index c9d4f3e..29c2973 100644
--- a/gdb/python/lib/gdb/command/frame_filters.py
+++ b/gdb/python/lib/gdb/command/frame_filters.py
@@ -150,7 +150,7 @@ def _do_enable_frame_filter(command_tuple, flag):
         try:
             ff = op_list[frame_filter]
         except KeyError:
-            msg = "frame-filter '" + str(name) + "' not found."
+            msg = "frame-filter '" + str(frame_filter) + "' not found."
             raise gdb.GdbError(msg)
 
         gdb.frames.set_enabled(ff, flag)
@@ -347,7 +347,7 @@ class SetFrameFilterPriority(gdb.Command):
         try:
             ff = op_list[frame_filter]
         except KeyError:
-            msg = "frame-filter '" + str(name) + "' not found."
+            msg = "frame-filter '" + str(frame_filter) + "' not found."
             raise gdb.GdbError(msg)
 
         gdb.frames.set_priority(ff, priority)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 3b305a6..6013e78 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-06  Tom Tromey  <[hidden email]>
+
+ PR python/20129:
+ * gdb.python/py-framefilter.exp: Add tests for setting priority
+ and disabling of non-existent frame filter.
+
 2016-06-02  Tom Tromey  <[hidden email]>
 
  PR python/18984:
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index aea4b45..8bbdcd3 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -104,6 +104,9 @@ gdb_test "show frame-filter priority global Elider" \
 gdb_test "info frame-filter" \
     ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
     "info frame filter after setting priority"
+gdb_test "set frame-filter priority global NoSuchFilter 900" \
+    "frame-filter 'NoSuchFilter' not found." \
+    "set priority of a non-existing filter"
 
 # Test enable/disable
 gdb_test "info frame-filter" \
@@ -119,6 +122,9 @@ gdb_test_no_output  "enable frame-filter global Elider" \
 gdb_test "info frame-filter" \
     ".*1000.*Yes.*Elider.*100.*Yes.*Reverse.*10.*.*No.*Object.*1.*" \
     "info frame filter after reenabling frame filter"
+gdb_test "disable frame-filter global NoSuchFilter" \
+    "frame-filter 'NoSuchFilter' not found." \
+    "disable a non-existing filter"
 
 # Test no-filters
 gdb_test "bt no-filters" \
--
2.5.5

Reply | Threaded
Open this post in threaded view
|

Re: [RFA] Fix PR python/20129 - use of non-existing variable

Phil Muldoon
On 06/06/16 18:22, Tom Tromey wrote:

> PR python/20129 concerns the error message one gets from a command
> like "disable frame-filter global NoSuchFilter".  Currently this
> throws a second, unexpected, exception due to the use of a
> non-existing variable named "name".
>
> This patch adds regression tests and fixes a couple of spots to use
> the correct variable name.
>
> Built and regtested on x86-64 Fedora 23.
>
> 2016-06-06  Tom Tromey  <[hidden email]>
>
> PR python/20129:
> * python/lib/gdb/command/frame_filters.py (_do_enable_frame_filter)
> (SetFrameFilterPriority._set_filter_priority): Use "frame_filter",
> not "name".
>
> 2016-06-06  Tom Tromey  <[hidden email]>
>
> PR python/20129:
> * gdb.python/py-framefilter.exp: Add tests for setting priority
> and disabling of non-existent frame filter.

Tom,

It looks fine to me (and the original a buglet anyway).

Cheers

Phil

Reply | Threaded
Open this post in threaded view
|

Re: [RFA] Fix PR python/20129 - use of non-existing variable

Yao Qi
In reply to this post by Tom Tromey-2
On Mon, Jun 6, 2016 at 6:22 PM, Tom Tromey <[hidden email]> wrote:
> PR python/20129 concerns the error message one gets from a command
> like "disable frame-filter global NoSuchFilter".  Currently this
> throws a second, unexpected, exception due to the use of a
> non-existing variable named "name".
>
> This patch adds regression tests and fixes a couple of spots to use
> the correct variable name.
>

Patch is good to me.

--
Yao (齐尧)