From 7245589dcbc08c377f783a637deeaa09604c6213 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 28 Aug 2014 14:28:43 -0700 Subject: Compatibility with gdb 7.4 --- src/generic/dumb_ptr.py | 2 +- src/map/magic-expr.py | 6 ++++-- src/map/magic-stmt.py | 6 ++++-- src/mmo/ids.py | 6 +++++- src/mmo/strs.py | 6 +++++- 5 files changed, 19 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/generic/dumb_ptr.py b/src/generic/dumb_ptr.py index 7d30d6c..b7973a7 100644 --- a/src/generic/dumb_ptr.py +++ b/src/generic/dumb_ptr.py @@ -7,7 +7,7 @@ class dumb_ptr(object): self._value = value def to_string(self): - return '0x%x' % self._value['impl'].cast(gdb.parse_and_eval('(long *)0').type) + return '0x%x' % long(self._value['impl'].cast(gdb.parse_and_eval('(long *)0').type)) def children(self): try: diff --git a/src/map/magic-expr.py b/src/map/magic-expr.py index 865a175..0d9db55 100644 --- a/src/map/magic-expr.py +++ b/src/map/magic-expr.py @@ -31,6 +31,8 @@ class fun_t(object): ''' tests = [ - ('static_cast(nullptr)', '(fun_t *) nullptr'), - ('new tmwa::magic::fun_t{"name"_s, "sig"_s, \'\\0\', nullptr}', '(fun_t *) = {->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\000\', ->fun = 0x0}'), + ('static_cast(nullptr)', + '(fun_t *) nullptr'), + ('new tmwa::magic::fun_t{"name"_s, "sig"_s, \'\\0\', nullptr}', + 'regex:\(fun_t \*\) = \{->name = "name", ->signature = "sig", ->ret_ty = 0 \'\\\\000\', ->fun = (0x)?0}'), ] diff --git a/src/map/magic-stmt.py b/src/map/magic-stmt.py index 70ce3ca..14289ef 100644 --- a/src/map/magic-stmt.py +++ b/src/map/magic-stmt.py @@ -30,6 +30,8 @@ class op_t(object): ''' tests = [ - ('static_cast(nullptr)', '(op_t *) nullptr'), - ('new tmwa::magic::op_t{"name"_s, "sig"_s, nullptr}', '(op_t *) = {->name = "name", ->signature = "sig", ->op = 0x0}'), + ('static_cast(nullptr)', + '(op_t *) nullptr'), + ('new tmwa::magic::op_t{"name"_s, "sig"_s, nullptr}', + 'regex:\(op_t \*\) = \{->name = "name", ->signature = "sig", ->op = (0x)?0}'), ] diff --git a/src/mmo/ids.py b/src/mmo/ids.py index 2d26215..89392b1 100644 --- a/src/mmo/ids.py +++ b/src/mmo/ids.py @@ -18,7 +18,11 @@ for s in [ value = self._value fields = value.type.fields() field0 = fields[-1] - return '%s' % (value[field0]) + if field0.is_base_class: + w = value.cast(field0.type) + else: + w = value[field0.name] + return '%s' % w tests = [ ('tmwa::wrap(123)' % s, '123'), diff --git a/src/mmo/strs.py b/src/mmo/strs.py index 3e39ef4..313ecb5 100644 --- a/src/mmo/strs.py +++ b/src/mmo/strs.py @@ -21,7 +21,11 @@ for s in [ value = self._value fields = value.type.fields() field0 = fields[-1] - return '%s' % value[field0] + if field0.is_base_class: + w = value.cast(field0.type) + else: + w = value[field0.name] + return '%s' % w test_extra = ''' #include "../strings/fwd.hpp" -- cgit v1.2.3-70-g09d2