summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-10-31 12:31:11 -0700
committerBen Longbons <b.r.longbons@gmail.com>2013-10-31 12:31:11 -0700
commit6c389b7f9eb0f40a017951e55834223ac9d7f707 (patch)
tree22f566d0580657aaa8c0ca1dead8605cda6393e4
parent59664c19a3f2bd9e9343cec07f1ca6ca48b61a55 (diff)
downloadtmwa-13.10.31.tar.gz
tmwa-13.10.31.tar.bz2
tmwa-13.10.31.tar.xz
tmwa-13.10.31.zip
make printers compatible with older gdbv13.10.31
-rw-r--r--src/main-gdb-head.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/main-gdb-head.py b/src/main-gdb-head.py
index 394b6d7..44c1c2e 100644
--- a/src/main-gdb-head.py
+++ b/src/main-gdb-head.py
@@ -9,6 +9,26 @@ initial_globals = set(globals())
import re
+# copied from gdb/types.py for compatibility with old gdb
+def get_basic_type(type_):
+ """Return the "basic" type of a type.
+
+ Arguments:
+ type_: The type to reduce to its basic type.
+
+ Returns:
+ type_ with const/volatile is stripped away,
+ and typedefs/references converted to the underlying type.
+ """
+
+ while (type_.code == gdb.TYPE_CODE_REF or
+ type_.code == gdb.TYPE_CODE_TYPEDEF):
+ if type_.code == gdb.TYPE_CODE_REF:
+ type_ = type_.target()
+ else:
+ type_ = type_.strip_typedefs()
+ return type_.unqualified()
+
def finish():
global finish, initial_globals, FastPrinters
@@ -54,8 +74,8 @@ class FastPrinters(object):
return name
def __call__(self, value):
- stype = gdb.types.get_basic_type(value.type).tag
- #dtype = gdb.types.get_basic_type(value.dynamic_type).tag
+ stype = get_basic_type(value.type).tag
+ #dtype = get_basic_type(value.dynamic_type).tag
if stype is None:
return