Debugger: Add a fake void native type to the cdbbridge

Looking up 'void' is known to cause hick ups.

Change-Id: I4c4b3bae5b5ac572404156edbd457003fbbf53f3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2016-10-28 14:50:10 +02:00
parent 242f9fce58
commit 0a98e47e47
2 changed files with 84 additions and 37 deletions

View File

@@ -32,6 +32,51 @@ sys.path.insert(1, os.path.dirname(os.path.abspath(inspect.getfile(inspect.curre
from dumper import *
class FakeVoidType(cdbext.Type):
def __init__(self, name , dumper):
cdbext.Type.__init__(self)
self.typeName = name.strip()
self.dumper = dumper
def name(self):
return self.typeName
def bitsize(self):
return 0 if self.typeName == 'void' else self.dumper.ptrSize() * 8
def code(self):
if self.typeName.endswith('*'):
return TypeCodePointer
if self.typeName.endswith(']'):
return TypeCodeArray
return TypeCodeVoid
def unqualified(self):
return self
def target(self):
code = self.code()
if code == TypeCodePointer:
return FakeVoidType(self.typeName[:-1], self.dumper)
if code == TypeCodeVoid:
return self
try:
return FakeVoidType(self.typeName[:self.typeName.rindex('[')], self.dumper)
except:
return FakeVoidType('void', self.dumper)
def stripTypedef(self):
return self
def fields(self):
return []
def templateArgument(self, pos, numeric):
return None
def templateArguments(self):
return []
class Dumper(DumperBase):
def __init__(self):
DumperBase.__init__(self)
@@ -121,6 +166,8 @@ class Dumper(DumperBase):
self.output += stuff
def lookupNativeType(self, name):
if name.startswith('void'):
return FakeVoidType(name, self)
return cdbext.lookupType(name)
def reportResult(self, result, args):

View File

@@ -366,43 +366,43 @@ PyTypeObject *type_pytype()
{
static PyTypeObject cdbext_TypeType = {
PyVarObject_HEAD_INIT(NULL, 0)
"cdbext.Type", /* tp_name */
sizeof(Type), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)type_Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
"Type objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
typeMethods, /* tp_methods */
typeMembers, /* tp_members (just for debugging)*/
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
type_New, /* tp_new */
"cdbext.Type", /* tp_name */
sizeof(Type), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)type_Dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_as_async */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
0, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
"Type objects", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
typeMethods, /* tp_methods */
typeMembers, /* tp_members (just for debugging)*/
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
type_New, /* tp_new */
};
return &cdbext_TypeType;