[PR,python/18291] Fix printing of "disabled" status of xmethod matchers.

Message ID CAGyQ6gzraQ9NP4CYr=GXi8fGuZjWMZ=_VJgTAcecBQ8s87sj4w@mail.gmail.com
State New, archived
Headers

Commit Message

Siva Chandra Reddy April 26, 2015, 2:02 p.m. UTC
  gdb/ChangeLog:

2015-04-26  Siva Chandra Reddy  <sivachandra@google.com>

        PR python/18291
        * python/lib/gdb/command/xmethods.py (print_xm_info): Fix typo.
        Print xmethod matcher status.

gdb/testsuite/ChangeLog:

2015-04-26  Siva Chandra Reddy  <sivachandra@google.com>

        PR python/18291
        * gdb.python/py-xmethods.exp: Add tests.
  

Comments

Siva Chandra Reddy May 4, 2015, 11:40 p.m. UTC | #1
Ping.

On Sun, Apr 26, 2015 at 7:02 AM, Siva Chandra <sivachandra@google.com> wrote:
> gdb/ChangeLog:
>
> 2015-04-26  Siva Chandra Reddy  <sivachandra@google.com>
>
>         PR python/18291
>         * python/lib/gdb/command/xmethods.py (print_xm_info): Fix typo.
>         Print xmethod matcher status.
>
> gdb/testsuite/ChangeLog:
>
> 2015-04-26  Siva Chandra Reddy  <sivachandra@google.com>
>
>         PR python/18291
>         * gdb.python/py-xmethods.exp: Add tests.
  

Patch

diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
index 37ed2c1..0788a81 100644
--- a/gdb/python/lib/gdb/command/xmethods.py
+++ b/gdb/python/lib/gdb/command/xmethods.py
@@ -117,7 +117,7 @@  def get_method_matchers_in_loci(loci, locus_re, matcher_re):
 
 def print_xm_info(xm_dict, name_re):
     """Print a dictionary of xmethods."""
-    def get_status_string(method):
+    def get_status_string(m):
         if not m.enabled:
             return " [disabled]"
         else:
@@ -130,7 +130,7 @@  def print_xm_info(xm_dict, name_re):
             continue
         print ("Xmethods in %s:" % locus_str)
         for matcher in xm_dict[locus_str]:
-            print ("  %s" % matcher.name)
+            print ("  %s%s" % (matcher.name, get_status_string(matcher)))
             if not matcher.methods:
                 continue
             for m in matcher.methods:
diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp
index a83b14d..f0236c0 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.exp
+++ b/gdb/testsuite/gdb.python/py-xmethods.exp
@@ -149,3 +149,6 @@  gdb_test_no_output "disable xmethod progspace E_methods;method_int" \
   "disable xmethod progspace E_methods;method_int"
 gdb_test "info xmethod progspace E_methods;method_int" ".* \\\[disabled\\\]" \
   "info xmethod xmethods E_methods;method_int"
+gdb_test_no_output "disable xmethod progspace G_methods" "Disable G_methods 2"
+gdb_test "info xmethod progspace" ".*G_methods \\\[disabled\\\].*" \
+  "info xmethod progspace"