Message ID | CAGyQ6gxz_6KcRsu8iFZ9WXfeS5zQb+gf=dfwsv89_US=uqS5tQ@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Wed, Jun 18, 2014 at 1:55 PM, Siva Chandra <sivachandra@google.com> wrote: > 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 <sivachandra@google.com> > > 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. I can't easily test the patch, I'm assuming you've done that. LGTM otherwise.
On Fri, Jun 20, 2014 at 1:30 PM, Doug Evans <dje@google.com> wrote: >> ChangeLog >> >> 2014-06-18 Siva Chandra Reddy <sivachandra@google.com> >> >> 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. > > I can't easily test the patch, I'm assuming you've done that. > > LGTM otherwise. Thank you. I have tested. Pushed now. Joel, is it OK for 7.8?
> >> 2014-06-18 Siva Chandra Reddy <sivachandra@google.com> > >> > >> 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. > > > > I can't easily test the patch, I'm assuming you've done that. > > > > LGTM otherwise. > > Thank you. I have tested. Pushed now. > > Joel, is it OK for 7.8? Sure!
On Mon, Jun 23, 2014 at 6:58 AM, Joel Brobecker <brobecker@adacore.com> wrote: >> >> 2014-06-18 Siva Chandra Reddy <sivachandra@google.com> >> >> >> >> 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. >> > >> > I can't easily test the patch, I'm assuming you've done that. >> > >> > LGTM otherwise. >> >> Thank you. I have tested. Pushed now. >> >> Joel, is it OK for 7.8? > > Sure! Thank you. Pushed to 7.8 branch as well.
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<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}