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.
This commit is contained in:
Siva Chandra
2014-08-04 18:07:43 -07:00
parent a0d09f12db
commit 940df40812
4 changed files with 23 additions and 11 deletions

View File

@@ -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> 2014-08-15 Doug Evans <dje@google.com>
* dwarf2read.c (dwarf_decode_lines_1): Move definition of adj_opcode * dwarf2read.c (dwarf_decode_lines_1): Move definition of adj_opcode

View File

@@ -140,7 +140,7 @@ def print_xm_info(xm_dict, name_re):
def set_xm_status1(xm_dict, name_re, status): def set_xm_status1(xm_dict, name_re, status):
"""Set the status (enabled/disabled) of a dictionary of xmethods.""" """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: for matcher in matchers:
if not name_re: if not name_re:
# If the name regex is missing, then set the status of the # If the name regex is missing, then set the status of the

View File

@@ -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> 2014-08-15 Yao Qi <yao@codesourcery.com>
* gdb.trace/tfile.exp: Return -1 if generate_tracefile returns * gdb.trace/tfile.exp: Return -1 if generate_tracefile returns

View File

@@ -40,7 +40,7 @@ def A_geta(obj):
def A_getarrayind(obj, index): def A_getarrayind(obj, index):
print 'From Python <A_getarrayind>:' print('From Python <A_getarrayind>:')
return obj['array'][index] return obj['array'][index]
@@ -61,7 +61,7 @@ class E_method_char_worker(XMethodWorker):
return gdb.lookup_type('char') return gdb.lookup_type('char')
def __call__(self, obj, arg): def __call__(self, obj, arg):
print 'From Python <E_method_char>' print('From Python <E_method_char>')
return None return None
@@ -73,7 +73,7 @@ class E_method_int_worker(XMethodWorker):
return gdb.lookup_type('int') return gdb.lookup_type('int')
def __call__(self, obj, arg): def __call__(self, obj, arg):
print 'From Python <E_method_int>' print('From Python <E_method_int>')
return None return None