From de5ca8aa6ad990209b350a2ac94130d572bbd1d5 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 19 Nov 2008 22:38:32 +0100 Subject: [PATCH] Add primitive support for template types. A type name in the type table that ends with '<*>' matches all instantiated templates of that name, regardless of the actual template parameter types. With this tool, information in objects that does not depend on the actual template parameter types can be shown, which we do with size and capacity of std::vector. --- kdbg/typetable.cpp | 7 ++++++- kdbg/typetable.h | 2 +- kdbg/typetables/stdc++6.kdbgtt | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/kdbg/typetable.cpp b/kdbg/typetable.cpp index 042561f..d612261 100644 --- a/kdbg/typetable.cpp +++ b/kdbg/typetable.cpp @@ -249,8 +249,13 @@ void ProgramTypeTable::loadTypeTable(TypeTable* table) } } -TypeInfo* ProgramTypeTable::lookup(const QString& type) +TypeInfo* ProgramTypeTable::lookup(QString type) { + // compress any template types to '<*>' + int templ = type.find('<'); + if (templ > 0) { + type = type.left(templ) + "<*>"; + } TypeInfo* result = m_types[type]; if (result == 0) { result = m_aliasDict[type]; diff --git a/kdbg/typetable.h b/kdbg/typetable.h index 6edc814..d473142 100644 --- a/kdbg/typetable.h +++ b/kdbg/typetable.h @@ -143,7 +143,7 @@ public: * * If the type is unknown, 0 is returned. */ - TypeInfo* lookup(const QString& type); + TypeInfo* lookup(QString type); /** * Adds a new alias for a type name. diff --git a/kdbg/typetables/stdc++6.kdbgtt b/kdbg/typetables/stdc++6.kdbgtt index 0389f87..75ad3c2 100644 --- a/kdbg/typetables/stdc++6.kdbgtt +++ b/kdbg/typetables/stdc++6.kdbgtt @@ -1,7 +1,14 @@ [Type Table] Types1=string +Types2=std::vector<*> LibDisplayName=libstdc++6 ShlibRE=libstdc\+\+\.so\.6$ + [string] Display={ % } Expr1=(%s)._M_dataplus._M_p + +[std::vector<*>] +Display={ size=% capcity=% } +Expr1=($vec=(%s)._M_impl)._M_finish-$vec._M_start +Expr2=($vec=(%s)._M_impl)._M_end_of_storage-$vec._M_start -- 2.11.4.GIT