From 803b47e5d4dc86b953aba0bc44865de287726dbe Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 6 Jun 2016 11:21:15 -0600 Subject: [PATCH] Fix PR python/20129 - use of non-existing variable 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-29 Tom Tromey 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-29 Tom Tromey 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 6b65cc486ff..d6054f9d16c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2016-06-29 Tom Tromey + + 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-29 Tom Tromey PR gdb/17210: diff --git a/gdb/python/lib/gdb/command/frame_filters.py b/gdb/python/lib/gdb/command/frame_filters.py index a5fb0a6fd85..8d26000b623 100644 --- a/gdb/python/lib/gdb/command/frame_filters.py +++ b/gdb/python/lib/gdb/command/frame_filters.py @@ -142,7 +142,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) @@ -339,7 +339,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 9f8f40cd1f0..a0aa9bff193 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-06-29 Tom Tromey + + PR python/20129: + * gdb.python/py-framefilter.exp: Add tests for setting priority + and disabling of non-existent frame filter. + 2016-06-29 Yao Qi * gdb.base/catch-syscall.c [__arm__]: Set unknown_syscall to diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp index 61afa2f7c4e..7abf3a91c7d 100644 --- a/gdb/testsuite/gdb.python/py-framefilter.exp +++ b/gdb/testsuite/gdb.python/py-framefilter.exp @@ -108,6 +108,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" \ @@ -123,6 +126,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.30.2