aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-08-04 18:07:43 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-08-15 18:04:47 -0700
commit940df408121be31beed22ef7a5ad133cb1592726 (patch)
tree933448a81b404fd211810e2a95beac72f75b55b7 /gdb
parenta0d09f12dbd69d68bb7db0e4c77f3288dec6f81b (diff)
downloadgdb-940df408121be31beed22ef7a5ad133cb1592726.zip
gdb-940df408121be31beed22ef7a5ad133cb1592726.tar.gz
gdb-940df408121be31beed22ef7a5ad133cb1592726.tar.bz2
Fix xmethod Python so that it works with Python3.
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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/lib/gdb/command/xmethods.py2
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.python/py-xmethods.py20
4 files changed, 23 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f74f1c4..6bcd1c0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-15 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-15 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf_decode_lines_1): Move definition of adj_opcode
diff --git a/gdb/python/lib/gdb/command/xmethods.py b/gdb/python/lib/gdb/command/xmethods.py
index 55cc81f..206313e 100644
--- a/gdb/python/lib/gdb/command/xmethods.py
+++ b/gdb/python/lib/gdb/command/xmethods.py
@@ -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
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 18930a0..38682fa 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2014-08-15 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-15 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.exp: Return -1 if generate_tracefile returns
diff --git a/gdb/testsuite/gdb.python/py-xmethods.py b/gdb/testsuite/gdb.python/py-xmethods.py
index 6fecf2b..47fb00b 100644
--- a/gdb/testsuite/gdb.python/py-xmethods.py
+++ b/gdb/testsuite/gdb.python/py-xmethods.py
@@ -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