summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-08-28 14:28:43 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-08-28 14:28:43 -0700
commit7245589dcbc08c377f783a637deeaa09604c6213 (patch)
treeb553c5a3970a3268b1bc6ede089e50ba948ac119
parent9e01aa7912f782fc9049f8098a4618bba3a82fa0 (diff)
downloadtmwa-7245589dcbc08c377f783a637deeaa09604c6213.tar.gz
tmwa-7245589dcbc08c377f783a637deeaa09604c6213.tar.bz2
tmwa-7245589dcbc08c377f783a637deeaa09604c6213.tar.xz
tmwa-7245589dcbc08c377f783a637deeaa09604c6213.zip
Compatibility with gdb 7.4
-rw-r--r--src/generic/dumb_ptr.py2
-rw-r--r--src/map/magic-expr.py6
-rw-r--r--src/map/magic-stmt.py6
-rw-r--r--src/mmo/ids.py6
-rw-r--r--src/mmo/strs.py6
-rw-r--r--tools/debug-debug.gdb20
6 files changed, 36 insertions, 10 deletions
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<tmwa::magic::fun_t *>(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<tmwa::magic::fun_t *>(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<tmwa::magic::op_t *>(nullptr)', '(op_t *) nullptr'),
- ('new tmwa::magic::op_t{"name"_s, "sig"_s, nullptr}', '(op_t *) = {->name = "name", ->signature = "sig", ->op = 0x0}'),
+ ('static_cast<tmwa::magic::op_t *>(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<tmwa::%s>(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"
diff --git a/tools/debug-debug.gdb b/tools/debug-debug.gdb
index 23a934c..72a45e1 100644
--- a/tools/debug-debug.gdb
+++ b/tools/debug-debug.gdb
@@ -1,18 +1,32 @@
# vim: ft=python
-set auto-load safe-path /
+# set auto-load safe-path /
+python
+try:
+ gdb.execute('set auto-load safe-path /')
+except:
+ pass
+end
file bin/test-debug-debug
set logging file /dev/null
set logging redirect on
set logging off
python
+import re
import sys
def hit_breakpoint():
sys.stdout.write('.')
value = str(gdb.parse_and_eval('*&value'))
expected = gdb.parse_and_eval('expected').string()
- if value != expected:
+ if expected.startswith('regex:'):
+ def compare(value, expected):
+ m = re.match(expected[6:], value)
+ return m and m.end() == m.endpos
+ else:
+ def compare(value, expected):
+ return value == expected
+ if not compare(value, expected):
print 'Error: mismatch, aborting ...'
print 'actual: %r' % value
print 'expect: %r' % str(expected)
@@ -23,7 +37,7 @@ end
# register a pretty-printer for 'char *' instead
#set print address off
set print static-members off
-set print elements unlimited
+set print elements 9999
set print frame-arguments none
set logging on