Align behavior of xmethod commands with that of pretty-printer commands.
authorSiva Chandra <sivachandra@chromium.org>
Wed, 18 Jun 2014 10:46:37 +0000 (03:46 -0700)
committerSiva Chandra <sivachandra@chromium.org>
Mon, 23 Jun 2014 11:57:51 +0000 (04:57 -0700)
Currently, the xmethod commands lookup xmethod matchers in the current
progspace even if the locus regular expression matches the progspace's
filename.  Pretty printer commands do not match the current progspace's
filename.

gdb/

* python/lib/gdb/command/xmethods.py
(get_method_matchers_in_loci):  Lookup xmethod matchers in the
current progspace only if the string "progspace" matches LOCUS_RE.

gdb/testsuite

* gdb.python/py-xmethods.exp: Use "progspace" instead of the
progspace's filename in 'info', 'enable' and 'disable' command
tests.

gdb/ChangeLog
gdb/python/lib/gdb/command/xmethods.py
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-xmethods.exp

index 734b91009e0204341152f0c69aff91c337d760e1..47a5fa5cd67bea4c31e11403955530d75192943b 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-23  Siva Chandra Reddy  <sivachandra@google.com>
+
+       * python/lib/gdb/command/xmethods.py
+       (get_method_matchers_in_loci):  Lookup xmethod matchers in the
+       current progspace only if the string "progspace" matches LOCUS_RE.
+
 2014-06-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix --with-system-readline with readline-6.3 patch 5.
index 31f9cdd9d9f873f87d971e5ebe56fd1e885174b8..55cc81f896870921b5c761d32d120165a458a051 100644 (file)
@@ -87,8 +87,11 @@ def get_method_matchers_in_loci(loci, locus_re, matcher_re):
 
     Arguments:
         loci: The list of loci to lookup matching xmethods in.
-        locus_re: Xmethod matchers will be looked up in a particular locus
-                  only if its filename matches the regular expression LOCUS_RE.
+        locus_re: If a locus is an objfile, then xmethod matchers will be
+                  looked up in it only if its filename matches the regular
+                  expression LOCUS_RE.  If a locus is the current progspace,
+                  then xmethod matchers will be looked up in it only if the
+                  string "progspace" matches LOCUS_RE.
         matcher_re: The regular expression to match the xmethod matcher
                     names.
 
@@ -99,8 +102,7 @@ def get_method_matchers_in_loci(loci, locus_re, matcher_re):
     xm_dict = {}
     for locus in loci:
         if isinstance(locus, gdb.Progspace):
-            if (not locus_re.match(locus.filename) and
-                not locus_re.match('progspace')):
+            if not locus_re.match('progspace'):
                 continue
             locus_type = "progspace"
         else:
index 93cd6f62944b1cfd98b647345e6166bd641f2911..57c5adcf6b82c028ef168f0fb0382c5a58bc66c5 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-23  Siva Chandra Reddy  <sivachandra@google.com>
+
+       * gdb.python/py-xmethods.exp: Use "progspace" instead of the
+       progspace's filename in 'info', 'enable' and 'disable' command
+       tests.
+
 2014-06-23  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.arch/amd64-stap-special-operands.exp: Use is_lp64_target.
index a455a7a3f82dea83de5d41f0e27eb1aab2dffb36..8824127f51923d56210a1df41a2331075b505592 100644 (file)
@@ -125,19 +125,19 @@ gdb_test "p g_ptr->mul<char>('a')" "From Python G<>::mul.*" \
   "After: g_ptr->mul<char>('a')"
 
 # Tests for 'disable/enable xmethod' command.
-gdb_test_no_output "disable xmethod .*xmethods G_methods" \
+gdb_test_no_output "disable xmethod progspace G_methods" \
   "Disable G_methods"
 gdb_test "p g.mul<char>('a')" "Couldn't find method.*" \
   "g.mul<char>('a') after disabling G_methods"
-gdb_test_no_output "enable xmethod .*xmethods G_methods" \
+gdb_test_no_output "enable xmethod progspace G_methods" \
   "Enable G_methods"
 gdb_test "p g.mul<char>('a')" "From Python G<>::mul.*" \
   "After enabling G_methods"
-gdb_test_no_output "disable xmethod .*xmethods G_methods;mul" \
+gdb_test_no_output "disable xmethod progspace G_methods;mul" \
   "Disable G_methods;mul"
 gdb_test "p g.mul<char>('a')" "Couldn't find method.*" \
   "g.mul<char>('a') after disabling G_methods;mul"
-gdb_test_no_output "enable xmethod .*xmethods G_methods;mul" \
+gdb_test_no_output "enable xmethod progspace G_methods;mul" \
   "Enable G_methods;mul"
 gdb_test "p g.mul<char>('a')" "From Python G<>::mul.*" \
   "After enabling G_methods;mul"
@@ -145,9 +145,9 @@ gdb_test "p g.mul<char>('a')" "From Python G<>::mul.*" \
 # Test for 'info xmethods' command
 gdb_test "info xmethod global plus" "global.*plus_plus_A" \
   "info xmethod global plus 1"
-gdb_test_no_output "disable xmethod .*xmethods E_methods;method_int" \
-  "disable xmethod .*xmethods E_methods;method_int"
-gdb_test "info xmethod .*xmethods E_methods;method_int" ".* \\\[disabled\\\]" \
+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"
 
 remote_file host delete ${xmethods_script}
This page took 0.035795 seconds and 4 git commands to generate.