From 4c50b2212d92f84945a39df321f0eb10dedf98c7 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 2 Jun 2015 07:37:22 +0000 Subject: [PATCH] re PR other/65366 (gdbhooks.py is incompatible with Python3) PR other/65366 * gdbhooks.py: Use int(...) instead of long(...). Use print(...) instead of print ... . From-SVN: r224012 --- gcc/ChangeLog | 6 +++++ gcc/gdbhooks.py | 64 ++++++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ab5c004e19e..b88973708a0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-06-02 Jan Kratochvil + + PR other/65366 + * gdbhooks.py: Use int(...) instead of long(...). Use print(...) + instead of print ... . + 2015-06-02 Alan Modra * config/rs6000/vsx.md (vsx_extract_v4sf): Revert accidental diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py index 7797ce1d9aa..20842bbc940 100644 --- a/gcc/gdbhooks.py +++ b/gcc/gdbhooks.py @@ -158,7 +158,7 @@ class Tree: self.gdbval = gdbval def is_nonnull(self): - return long(self.gdbval) + return int(self.gdbval) def TREE_CODE(self): """ @@ -197,7 +197,7 @@ class TreePrinter: # like gcc/print-tree.c:print_node_brief # #define TREE_CODE(NODE) ((enum tree_code) (NODE)->base.code) # tree_code_name[(int) TREE_CODE (node)]) - if long(self.gdbval) == 0: + if int(self.gdbval) == 0: return '' val_TREE_CODE = self.node.TREE_CODE() @@ -209,17 +209,17 @@ class TreePrinter: val_tclass = val_tree_code_type[val_TREE_CODE] val_tree_code_name = gdb.parse_and_eval('tree_code_name') - val_code_name = val_tree_code_name[long(val_TREE_CODE)] - #print val_code_name.string() + val_code_name = val_tree_code_name[int(val_TREE_CODE)] + #print(val_code_name.string()) - result = '<%s 0x%x' % (val_code_name.string(), long(self.gdbval)) - if long(val_tclass) == tcc_declaration: + result = '<%s 0x%x' % (val_code_name.string(), int(self.gdbval)) + if int(val_tclass) == tcc_declaration: tree_DECL_NAME = self.node.DECL_NAME() if tree_DECL_NAME.is_nonnull(): result += ' %s' % tree_DECL_NAME.IDENTIFIER_POINTER() else: pass # TODO: labels etc - elif long(val_tclass) == tcc_type: + elif int(val_tclass) == tcc_type: tree_TYPE_NAME = Tree(self.gdbval['type_common']['name']) if tree_TYPE_NAME.is_nonnull(): if tree_TYPE_NAME.TREE_CODE() == IDENTIFIER_NODE: @@ -242,8 +242,8 @@ class CGraphNodePrinter: self.gdbval = gdbval def to_string (self): - result = '' - result = '' val_gimple_code = self.gdbval['code'] val_gimple_code_name = gdb.parse_and_eval('gimple_code_name') - val_code_name = val_gimple_code_name[long(val_gimple_code)] + val_code_name = val_gimple_code_name[int(val_gimple_code)] result = '<%s 0x%x' % (val_code_name.string(), - long(self.gdbval)) + int(self.gdbval)) result += '>' return result @@ -306,9 +306,9 @@ class BasicBlockPrinter: self.gdbval = gdbval def to_string (self): - result = '