]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix xmethod Python so that it works with Python3.
authorSiva Chandra <sivachandra@chromium.org>
Tue, 5 Aug 2014 01:07:43 +0000 (18:07 -0700)
committerSiva Chandra <sivachandra@chromium.org>
Mon, 1 Sep 2014 13:37:42 +0000 (06:37 -0700)
gdb/

* python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
'items' methods instead of 'iteritems' method on dictionaries.

gdb/testsuite/

* gdb.python/py-xmethods.py (A_getarrayind)
(E_method_char_worker.__call__, E_method_int_worker.__call__):
Use 'print' with function call syntax.
(E_method_matcher.match): Fix tab vs space indentation mixup.

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

index 250cd5be76e237a26d4d6b5690749f05f0f03ca6..d98df1c35b300555fdf66f41d85db3ee4c0b9fdf 100644 (file)
@@ -1,3 +1,8 @@
+2014-08-30  Siva Chandra Reddy  <sivachandra@google.com>
+
+       * python/lib/gdb/command/xmethods.py (set_xm_status1): Use the
+       'items' methods instead of 'iteritems' method on dictionaries.
+
 2014-08-27  Yao Qi  <yao@codesourcery.com>
 
        * ctf.c (CTF_FILE_MIN_SIZE): Remove.
index 55cc81f896870921b5c761d32d120165a458a051..206313e8f2cf5dee3804129e039730d040181684 100644 (file)
@@ -140,7 +140,7 @@ def print_xm_info(xm_dict, name_re):
 
 def set_xm_status1(xm_dict, name_re, status):
     """Set the status (enabled/disabled) of a dictionary of xmethods."""
-    for locus_str, matchers in xm_dict.iteritems():
+    for locus_str, matchers in xm_dict.items():
         for matcher in matchers:
             if not name_re:
                 # If the name regex is missing, then set the status of the
index e48ed8c5a9762dba082ee01688ad267131c032f2..0040ec3553fc399a37139aec3444d1b6598c4a73 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-30  Siva Chandra Reddy  <sivachandra@google.com>
+
+       * gdb.python/py-xmethods.py (A_getarrayind)
+       (E_method_char_worker.__call__, E_method_int_worker.__call__):
+       Use 'print' with function call syntax.
+       (E_method_matcher.match): Fix tab vs space indentation mixup.
+
 2014-08-21  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        * gdb.threads/gcore-stale-thread.c: New file.
index 6fecf2b9e1395f5aed0577e9b83c3b4804fbcb1d..47fb00beec5b1cb108b23c3d01d3b844dcf63b8c 100644 (file)
@@ -25,22 +25,22 @@ from gdb.xmethod import SimpleXMethodMatcher
 
 
 def A_plus_A(obj, opr):
-  print ('From Python <A_plus_A>:')
+  print('From Python <A_plus_A>:')
   return obj['a'] + opr['a']
 
 
 def plus_plus_A(obj):
-  print ('From Python <plus_plus_A>:')
+  print('From Python <plus_plus_A>:')
   return obj['a'] + 1
 
 
 def A_geta(obj):
-  print ('From Python <A_geta>:')
+  print('From Python <A_geta>:')
   return obj['a']
 
 
 def A_getarrayind(obj, index):
-  print 'From Python <A_getarrayind>:'
+  print('From Python <A_getarrayind>:')
   return obj['array'][index]
 
 
@@ -61,7 +61,7 @@ class E_method_char_worker(XMethodWorker):
         return gdb.lookup_type('char')
 
     def __call__(self, obj, arg):
-        print 'From Python <E_method_char>'
+        print('From Python <E_method_char>')
         return None
 
 
@@ -73,7 +73,7 @@ class E_method_int_worker(XMethodWorker):
         return gdb.lookup_type('int')
 
     def __call__(self, obj, arg):
-        print 'From Python <E_method_int>'
+        print('From Python <E_method_int>')
         return None
 
 
@@ -86,7 +86,7 @@ class E_method_matcher(XMethodMatcher):
         class_tag = class_type.unqualified().tag
         if not re.match('^dop::E$', class_tag):
             return None
-       if not re.match('^method$', method_name):
+        if not re.match('^method$', method_name):
             return None
         workers = []
         if self.methods[0].enabled:
@@ -109,7 +109,7 @@ class G_size_diff_worker(XMethodWorker):
         pass
 
     def __call__(self, obj):
-        print ('From Python G<>::size_diff()')
+        print('From Python G<>::size_diff()')
         return (self._method_template_type.sizeof -
                 self._class_template_type.sizeof)
 
@@ -123,7 +123,7 @@ class G_size_mul_worker(XMethodWorker):
         pass
 
     def __call__(self, obj):
-        print ('From Python G<>::size_mul()')
+        print('From Python G<>::size_mul()')
         return self._class_template_type.sizeof * self._method_template_val
 
 
@@ -136,7 +136,7 @@ class G_mul_worker(XMethodWorker):
         return self._method_template_type
 
     def __call__(self, obj, arg):
-        print ('From Python G<>::mul()')
+        print('From Python G<>::mul()')
         return obj['t'] * arg