From patchwork Wed Jun 18 11:55:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siva Chandra Reddy X-Patchwork-Id: 1550 Received: (qmail 14786 invoked by alias); 18 Jun 2014 11:55:44 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 14772 invoked by uid 89); 18 Jun 2014 11:55:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-oa0-f54.google.com Received: from mail-oa0-f54.google.com (HELO mail-oa0-f54.google.com) (209.85.219.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 18 Jun 2014 11:55:39 +0000 Received: by mail-oa0-f54.google.com with SMTP id eb12so1528253oac.27 for ; Wed, 18 Jun 2014 04:55:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=G0cHdlNZlPEBU5FP1KunYSherXbIvRYXBmbt2JdeKX0=; b=A9R629ZpBeN1UoM3SyejRkhHkBpTT/gwiKz+i2Wl5etU8sPY/e3eLFfAzw72uWbK9A GKjBlZEM3Z4T5NsE+e4SjdZzK9mWvhKZj9lEnIDHyBGusoZ9rOmAjU6FcDYZkSvDjVwl Grc7EIHgC7WU6JnuLdLlo5hz8qD6mSZkqCcVOxkuzJy3Xsimbpb3DERP6bth3SuQt50s ddmUm/AIEnscfSVKctMYMDHkBEWOfia1Gfolwp5ZGEMSp4woxstu+TFvlmuyKFT6saQR GhVtc5e366pxU5Qe7HCKGgX8uOW4GRWG9l3oTTIsViGiIKmi0EyXV9SfCUQj2XkN5a/l c0gw== X-Gm-Message-State: ALoCoQnhN7V/r4BafB2ygWxYT9vxY5g8b6J2teCD42D+Q9WBF6vNypVzap0cCBcvhiMPTdnAlQQl MIME-Version: 1.0 X-Received: by 10.60.176.225 with SMTP id cl1mr1486198oec.36.1403092538130; Wed, 18 Jun 2014 04:55:38 -0700 (PDT) Received: by 10.202.187.198 with HTTP; Wed, 18 Jun 2014 04:55:38 -0700 (PDT) Date: Wed, 18 Jun 2014 04:55:38 -0700 Message-ID: Subject: [PATCH] Align behavior of xmethod commands with that of pretty-printer commands From: Siva Chandra To: gdb-patches Cc: Joel Brobecker , Doug Evans X-IsSubscribed: yes 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. I think this should also go into the 7.8 branch. ChangeLog 2014-06-18 Siva Chandra Reddy 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. diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py index 31f9cdd..55cc81f 100644 --- a/gdb/python/lib/gdb/command/xmethods.py +++ b/gdb/python/lib/gdb/command/xmethods.py @@ -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: diff --git a/gdb/testsuite/gdb.python/py-xmethods.exp b/gdb/testsuite/gdb.python/py-xmethods.exp index a455a7a..8824127 100644 --- a/gdb/testsuite/gdb.python/py-xmethods.exp +++ b/gdb/testsuite/gdb.python/py-xmethods.exp @@ -125,19 +125,19 @@ gdb_test "p g_ptr->mul('a')" "From Python G<>::mul.*" \ "After: g_ptr->mul('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('a')" "Couldn't find method.*" \ "g.mul('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('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('a')" "Couldn't find method.*" \ "g.mul('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('a')" "From Python G<>::mul.*" \ "After enabling G_methods;mul" @@ -145,9 +145,9 @@ gdb_test "p g.mul('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}