diff mbox

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

Message ID 1465233765-15675-1-git-send-email-tom@tromey.com
State New
Headers show

Commit Message

Tom Tromey June 6, 2016, 5:22 p.m. UTC
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  <tom@tromey.com>

	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  <tom@tromey.com>

	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(-)

Comments

Phil Muldoon June 6, 2016, 7:05 p.m. UTC | #1
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  <tom@tromey.com>
> 
> 	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  <tom@tromey.com>
> 
> 	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
Yao Qi June 29, 2016, 3 p.m. UTC | #2
On Mon, Jun 6, 2016 at 6:22 PM, Tom Tromey <tom@tromey.com> 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.
diff mbox

Patch

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  <tom@tromey.com>
+
+	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  <jon.turney@dronecode.org.uk>
 
 	* 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  <tom@tromey.com>
+
+	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  <tom@tromey.com>
 
 	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" \