debugger: update manual tests

Change-Id: I88b980d4bd8c6ad7af34b6cf28cdea196d1e56d2
Reviewed-on: http://codereview.qt.nokia.com/3101
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
hjk
2011-08-17 14:54:31 +02:00
committed by hjk
parent 879766d85c
commit a946538089
2 changed files with 275 additions and 303 deletions

View File

@@ -33,49 +33,51 @@
#ifndef SIMPLE_DEBUGGER_TEST_H #ifndef SIMPLE_DEBUGGER_TEST_H
#define SIMPLE_DEBUGGER_TEST_H #define SIMPLE_DEBUGGER_TEST_H
struct SomeClassWithInlineConstructor namespace breakpoints {
{
struct SomeClassWithInlineConstructor
{
SomeClassWithInlineConstructor() SomeClassWithInlineConstructor()
{ {
a = 21; a = 21;
} }
int a; int a;
}; };
struct SomeBaseClassWithInlineConstructor struct SomeBaseClassWithInlineConstructor
{ {
SomeBaseClassWithInlineConstructor() SomeBaseClassWithInlineConstructor()
{ {
a = 21; a = 21;
} }
virtual ~SomeBaseClassWithInlineConstructor(); virtual ~SomeBaseClassWithInlineConstructor();
int a; int a;
}; };
struct SomeDerivedClassWithInlineConstructor struct SomeDerivedClassWithInlineConstructor
: SomeBaseClassWithInlineConstructor : SomeBaseClassWithInlineConstructor
{ {
SomeDerivedClassWithInlineConstructor() SomeDerivedClassWithInlineConstructor()
{ {
a = 21; a = 21;
} }
virtual ~SomeDerivedClassWithInlineConstructor(); virtual ~SomeDerivedClassWithInlineConstructor();
int a; int a;
}; };
template <class T> template <class T>
struct SomeTemplatedClassWithInlineConstructor struct SomeTemplatedClassWithInlineConstructor
{ {
SomeTemplatedClassWithInlineConstructor() SomeTemplatedClassWithInlineConstructor()
{ {
a = 21; a = 21;
} }
T a; T a;
}; };
template <class T> template <class T>
struct SomeTemplatedBaseClassWithInlineConstructor struct SomeTemplatedBaseClassWithInlineConstructor
{ {
SomeTemplatedBaseClassWithInlineConstructor() SomeTemplatedBaseClassWithInlineConstructor()
{ {
a = 21; a = 21;
@@ -83,43 +85,46 @@ struct SomeTemplatedBaseClassWithInlineConstructor
virtual ~SomeTemplatedBaseClassWithInlineConstructor(); virtual ~SomeTemplatedBaseClassWithInlineConstructor();
T a; T a;
}; };
template <class T> template <class T>
struct SomeTemplatedDerivedClassWithInlineConstructor struct SomeTemplatedDerivedClassWithInlineConstructor
: SomeTemplatedBaseClassWithInlineConstructor<T> : SomeTemplatedBaseClassWithInlineConstructor<T>
{ {
SomeTemplatedDerivedClassWithInlineConstructor() SomeTemplatedDerivedClassWithInlineConstructor()
{ {
a = 21; a = 21;
} }
virtual ~SomeTemplatedDerivedClassWithInlineConstructor(); virtual ~SomeTemplatedDerivedClassWithInlineConstructor();
T a; T a;
}; };
SomeBaseClassWithInlineConstructor::~SomeBaseClassWithInlineConstructor() {} SomeBaseClassWithInlineConstructor::~SomeBaseClassWithInlineConstructor() {}
SomeDerivedClassWithInlineConstructor::~SomeDerivedClassWithInlineConstructor() {} SomeDerivedClassWithInlineConstructor::~SomeDerivedClassWithInlineConstructor() {}
template <typename T> template <typename T>
SomeTemplatedBaseClassWithInlineConstructor<T>:: SomeTemplatedBaseClassWithInlineConstructor<T>::
~SomeTemplatedBaseClassWithInlineConstructor() {} ~SomeTemplatedBaseClassWithInlineConstructor() {}
template <typename T> template <typename T>
SomeTemplatedDerivedClassWithInlineConstructor<T>:: SomeTemplatedDerivedClassWithInlineConstructor<T>::
~SomeTemplatedDerivedClassWithInlineConstructor() {} ~SomeTemplatedDerivedClassWithInlineConstructor() {}
void testInlineBreakpoints() void testBreakpoints()
{ {
SomeClassWithInlineConstructor a; SomeClassWithInlineConstructor a;
SomeBaseClassWithInlineConstructor b; SomeBaseClassWithInlineConstructor b;
SomeDerivedClassWithInlineConstructor c; SomeDerivedClassWithInlineConstructor c;
SomeTemplatedClassWithInlineConstructor<int> d; SomeTemplatedClassWithInlineConstructor<int> d;
SomeTemplatedBaseClassWithInlineConstructor<int> e; SomeTemplatedBaseClassWithInlineConstructor<int> e;
SomeTemplatedDerivedClassWithInlineConstructor<int> f; SomeTemplatedDerivedClassWithInlineConstructor<int> f;
int i = a.a + b.a + c.a + d.a + e.a + f.a; // <=== Break here.
++i; dummyStatement(&a, &b, &c);
} dummyStatement(&d, &e, &f);
}
} // namespace breakpoints
#endif // SIMPLE_DEBUGGER_TEST_H #endif // SIMPLE_DEBUGGER_TEST_H

View File

@@ -34,6 +34,8 @@
//template <typename T> class B; B foo() {} //template <typename T> class B; B foo() {}
void dummyStatement(const void * = 0, const void * = 0, const void * = 0) {}
#include "../simple/deep/deep/simple_gdbtest_app.h" #include "../simple/deep/deep/simple_gdbtest_app.h"
#include <QtCore/QDebug> #include <QtCore/QDebug>
@@ -125,13 +127,6 @@
#include <stddef.h> #include <stddef.h>
#endif #endif
void dummyStatement(const void *x = 0, const void *y = 0, const void *z = 0)
{
Q_UNUSED(x);
Q_UNUSED(y);
Q_UNUSED(z);
}
namespace multibp { namespace multibp {
template <typename T> class Vector template <typename T> class Vector
@@ -370,17 +365,6 @@ class D : public X, public Y
int diamond; int diamond;
}; };
#ifndef Q_CC_RVCT
struct TestAnonymous
{
union {
struct { int i; int b; };
struct { float f; };
double d;
};
};
#endif
void testPeekAndPoke3() void testPeekAndPoke3()
{ {
// Anonymous structs // Anonymous structs
@@ -430,11 +414,22 @@ void testPeekAndPoke3()
} }
#ifndef Q_CC_RVCT namespace anon {
namespace { // anon
struct Something #ifndef Q_CC_RVCT
{ struct TestAnonymous
{
union {
struct { int i; int b; };
struct { float f; };
double d;
};
};
namespace {
struct Something
{
Something() { a = b = 1; } Something() { a = b = 1; }
void foo() void foo()
@@ -444,31 +439,33 @@ struct Something
} }
int a, b; int a, b;
}; };
} // anon }
#endif #endif
void testAnonymous()
void testAnonymous() {
{ #ifndef Q_CC_RVCT
#ifndef Q_CC_RVCT
TestAnonymous a; TestAnonymous a;
a.i = 1; a.i = 1;
a.i = 2; a.i = 2;
a.i = 3; a.i = 3;
Q_UNUSED(a);
Something s; Something s;
// <== Break here.
// Step.
s.foo(); s.foo();
Q_UNUSED(s); dummyStatement(&a, &s);
#endif #endif
} }
} // namespace anon
typedef void (*func_t)(); typedef void (*func_t)();
func_t testFunctionPointer() func_t testFunctionPointer()
{ {
func_t f1 = testAnonymous; func_t f1 = anon::testAnonymous;
func_t f2 = testPeekAndPoke3; func_t f2 = testPeekAndPoke3;
func_t f3 = testPeekAndPoke3; func_t f3 = testPeekAndPoke3;
Q_UNUSED(f1); Q_UNUSED(f1);
@@ -478,6 +475,7 @@ func_t testFunctionPointer()
} }
namespace qbytearray { namespace qbytearray {
void testQByteArray1() void testQByteArray1()
@@ -1653,15 +1651,19 @@ namespace stdvector {
v.push_back(2); v.push_back(2);
v.push_back(3); v.push_back(3);
v.push_back(4); v.push_back(4);
// <=== Break here.
dummyStatement(&v); dummyStatement(&v);
} }
void testStdVector3() void testStdVector3()
{ {
Foo f;
std::vector<Foo *> v; std::vector<Foo *> v;
v.push_back(new Foo(1)); v.push_back(new Foo(1));
v.push_back(0); v.push_back(0);
v.push_back(new Foo(2)); v.push_back(new Foo(2));
// <=== Break here.
// Expand v.[0].x
dummyStatement(&v); dummyStatement(&v);
} }
@@ -1672,6 +1674,8 @@ namespace stdvector {
flist.push_back(2); flist.push_back(2);
flist.push_back(3); flist.push_back(3);
flist.push_back(4); flist.push_back(4);
// <=== Break here.
// Expand v.[0].x
dummyStatement(&flist); dummyStatement(&flist);
} }
@@ -1683,6 +1687,7 @@ namespace stdvector {
vec.push_back(false); vec.push_back(false);
vec.push_back(true); vec.push_back(true);
vec.push_back(false); vec.push_back(false);
// <=== Break here.
dummyStatement(&vec); dummyStatement(&vec);
} }
@@ -1695,6 +1700,7 @@ namespace stdvector {
list.push_back(45); list.push_back(45);
vector.push_back(new std::list<int>(list)); vector.push_back(new std::list<int>(list));
vector.push_back(0); vector.push_back(0);
// <=== Break here.
dummyStatement(&vector, &list); dummyStatement(&vector, &list);
} }
@@ -1764,17 +1770,6 @@ void testQUrl()
(void) url; (void) url;
} }
void testLongEvaluation()
{
QDateTime time = QDateTime::currentDateTime();
QVector<QDateTime> bigv;
for (int i = 0; i < 10000; ++i)
bigv.append(time);
int s = bigv.size();
++s;
}
#ifdef FOP #ifdef FOP
int xxxx() int xxxx()
@@ -1847,18 +1842,6 @@ namespace qstringlist {
} // namespace qstringlist } // namespace qstringlist
Foo testStruct()
{
Foo f(2);
f.doit();
f.doit();
f.doit();
Foo f1 = f;
f1.doit();
return f1;
}
namespace formats { namespace formats {
void testString() void testString()
@@ -2420,27 +2403,6 @@ void testMemoryView()
a[i] = i; a[i] = i;
} }
void testUninitialized()
{
QString s;
QStringList sl;
QMap<int, int> mii;
QMap<QString, QString> mss;
QHash<int, int> hii;
QHash<QString, QString> hss;
QList<int> li;
QVector<int> vi;
QStack<int> si;
std::string ss;
std::map<int, int> smii;
std::map<std::string, std::string> smss;
std::list<int> sli;
std::list<std::string> ssl;
std::vector<int> svi;
std::stack<int> ssi;
}
void testEndlessRecursion() void testEndlessRecursion()
{ {
testEndlessRecursion(); testEndlessRecursion();
@@ -2626,6 +2588,16 @@ namespace basic {
++t2; ++t2;
} }
void testStruct()
{
Foo f(2);
f.doit();
f.doit();
f.doit();
// <=== Break here.
dummyStatement(&f);
}
void testUninitialized() void testUninitialized()
{ {
// This tests the display of uninitialized data. // This tests the display of uninitialized data.
@@ -2766,6 +2738,17 @@ namespace basic {
dummyStatement(&c, &d); dummyStatement(&c, &d);
} }
void testLongEvaluation()
{
QDateTime time = QDateTime::currentDateTime();
QVector<QDateTime> bigv;
for (int i = 0; i < 10000; ++i)
bigv.append(time);
// <== Break here.
// Expand bigv.
dummyStatement(&bigv);
}
void testBasic() void testBasic()
{ {
testArray1(); testArray1();
@@ -2779,6 +2762,7 @@ namespace basic {
testAlphabeticSorting(); testAlphabeticSorting();
testTypedef(); testTypedef();
testPtrTypedef(); testPtrTypedef();
testStruct();
testUninitialized(); testUninitialized();
testTypeFormats(); testTypeFormats();
testStringWithNewline(); testStringWithNewline();
@@ -2786,32 +2770,12 @@ namespace basic {
testColoredMemoryView(); testColoredMemoryView();
testReference1(); testReference1();
testReference2(); testReference2();
testLongEvaluation();
} }
} // namespace basic } // namespace basic
void testStuff()
{
using namespace std;
typedef map<string, list<string> > map_t;
map_t m;
m["one"].push_back("a");
m["one"].push_back("b");
m["one"].push_back("c");
m["two"].push_back("1");
m["two"].push_back("2");
m["two"].push_back("3");
map_t::const_iterator i = m.begin();
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
pair<vector<int>, vector<int> > a(pair<vector<int>,vector<int> >(vec, vec));
i++;
}
void testStuff2() void testStuff2()
{ {
QList<QList<int> > list1; QList<QList<int> > list1;
@@ -2992,17 +2956,20 @@ void testFork()
ba.append('x'); ba.append('x');
} }
struct structdata
{ namespace mpi {
struct structdata
{
int ints[8]; int ints[8];
char chars[32]; char chars[32];
double doubles[5]; double doubles[5];
}; };
enum type_t { MPI_LB, MPI_INT, MPI_CHAR, MPI_DOUBLE, MPI_UB }; enum type_t { MPI_LB, MPI_INT, MPI_CHAR, MPI_DOUBLE, MPI_UB };
struct tree_entry struct tree_entry
{ {
tree_entry() {} tree_entry() {}
tree_entry(int l, int o, type_t t) tree_entry(int l, int o, type_t t)
: blocklength(l), offset(o), type(t) : blocklength(l), offset(o), type(t)
@@ -3011,20 +2978,20 @@ struct tree_entry
int blocklength; int blocklength;
int offset; int offset;
type_t type; type_t type;
}; };
struct tree struct tree
{ {
enum kind_t { STRUCT }; enum kind_t { STRUCT };
void *base; void *base;
kind_t kind; kind_t kind;
int count; int count;
tree_entry entries[20]; tree_entry entries[20];
}; };
void testMPI() void testMPI()
{ {
structdata buffer = { structdata buffer = {
//{MPI_LB}, //{MPI_LB},
{0, 1024, 2048, 3072, 4096, 5120, 6144 }, {0, 1024, 2048, 3072, 4096, 5120, 6144 },
@@ -3078,7 +3045,9 @@ void testMPI()
> } > }
*/ */
} }
} // namespace mpi
//namespace kr { //namespace kr {
@@ -3255,7 +3224,7 @@ namespace bug4904 {
double dvalue; double dvalue;
}; };
int test4904() void test4904()
{ {
QMap<int, CustomStruct> map; QMap<int, CustomStruct> map;
CustomStruct cs1; CustomStruct cs1;
@@ -3266,11 +3235,11 @@ namespace bug4904 {
map.insert(cs1.id, cs1); map.insert(cs1.id, cs1);
map.insert(cs2.id, cs2); map.insert(cs2.id, cs2);
QMap<int, CustomStruct>::iterator it = map.begin(); QMap<int, CustomStruct>::iterator it = map.begin();
int n = map.size(); // <=== Break here. // <=== Break here.
// - expand map/[0]/value // - expand map/[0]/value
// - verify map[0].key == -1 // - verify map[0].key == -1
// - verify map[0].value.id == -1 // - verify map[0].value.id == -1
return n; dummyStatement(&it);
} }
} // namespace bug4904 } // namespace bug4904
@@ -3282,16 +3251,17 @@ namespace bug5046 {
struct Foo { int a, b, c; }; struct Foo { int a, b, c; };
int test5046() void test5046()
{ {
Foo f; Foo f;
f.a = 1; f.a = 1;
f.b = 2; f.b = 2;
f.c = 3; f.c = 3;
f.a = 4; // <= Break here. f.a = 4;
// <= Break here.
// - pop up main editor tooltip over 'f' // - pop up main editor tooltip over 'f'
// - verify that the entry is expandable, and expansion works // - verify that the entry is expandable, and expansion works
return f.a; dummyStatement(&f);
} }
} // namespace bug5046 } // namespace bug5046
@@ -3370,14 +3340,13 @@ namespace qc42170 {
struct Point : Object struct Point : Object
{ {
Point(double x_, double y_, int id_) : Object(id_), x(x_), y(y_) {} Point(double x_, double y_) : Object(1), x(x_), y(y_) {}
double x, y; double x, y;
}; };
struct Circle : Point struct Circle : Point
{ {
Circle(double x_, double y_, double r_, int id_) Circle(double x_, double y_, double r_) : Point(x_, y_), r(r_) { id = 2; }
: Point(x_, y_, id_), r(r_) {}
double r; double r;
}; };
@@ -3391,11 +3360,10 @@ namespace qc42170 {
void test42170() void test42170()
{ {
Circle *circle = new Circle(1.5, -2.5, 3.0, 15); Circle *circle = new Circle(1.5, -2.5, 3.0);
Object *obj = circle; Object *obj = circle;
helper(circle); helper(circle);
helper(obj); helper(obj);
dummyStatement(obj);
} }
} // namespace qc42170 } // namespace qc42170
@@ -3501,6 +3469,26 @@ namespace varargs {
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
std::string s;
s = "hallo";
s += "hallo";
QVector<int> qv;
qv.push_back(2);
std::vector<int> v;
v.push_back(2);
QStringList list;
list << "aaa" << "bbb" << "cc";
QList<const char *> list2;
list2 << "foo";
list2 << "bar";
list2 << 0;
list2 << "baz";
list2 << 0;
qhostaddress::testQHostAddress(); qhostaddress::testQHostAddress();
varargs::testVaList(); varargs::testVaList();
cp42895::test42895(); cp42895::test42895();
@@ -3518,14 +3506,10 @@ int main(int argc, char *argv[])
//bug4497::test4497(); //bug4497::test4497();
eigen::testEigen(); eigen::testEigen();
kr::testKR(); kr::testKR();
std::string s;
s = "hallo";
s += "hallo";
qxml::testQXmlAttributes(); qxml::testQXmlAttributes();
qregexp::testQRegExp(); qregexp::testQRegExp();
testInlineBreakpoints(); breakpoints::testBreakpoints();
testLongEvaluation(); mpi::testMPI();
testMPI();
qobjectdata::testQObjectData(); qobjectdata::testQObjectData();
//testQSettings(); //testQSettings();
//testWCout0(); //testWCout0();
@@ -3535,10 +3519,9 @@ int main(int argc, char *argv[])
qrect::testGeometry(); qrect::testGeometry();
qregion::testQRegion(); qregion::testQRegion();
basic::testBasic(); basic::testBasic();
testStuff();
testPeekAndPoke3(); testPeekAndPoke3();
testFunctionPointer(); testFunctionPointer();
testAnonymous(); anon::testAnonymous();
//testEndlessLoop(); //testEndlessLoop();
//testEndlessRecursion(); //testEndlessRecursion();
testQStack(); testQStack();
@@ -3551,22 +3534,6 @@ int main(int argc, char *argv[])
testQHash1(); testQHash1();
testSignalSlot(argc, argv); testSignalSlot(argc, argv);
QVector<int> qv;
qv.push_back(2);
std::vector<int> v;
v.push_back(2);
QStringList list;
list << "aaa" << "bbb" << "cc";
QList<const char *> list2;
list2 << "foo";
list2 << "bar";
list2 << 0;
list2 << "baz";
list2 << 0;
testQStandardItemModel(); testQStandardItemModel();
testFunction(); testFunction();
testQImage(); testQImage();
@@ -3602,7 +3569,7 @@ int main(int argc, char *argv[])
testQSharedPointer(); testQSharedPointer();
qstringlist::testQStringList(); qstringlist::testQStringList();
testQScriptValue(argc, argv); testQScriptValue(argc, argv);
testStruct(); basic::testStruct();
//qthread::testQThread(); //qthread::testQThread();
qvariant::testQVariant(); qvariant::testQVariant();
qvector::testQVector(); qvector::testQVector();