2002-12-17 David Carlton <carlton@math.stanford.edu>

* gdb.c++/try_catch.cc: Add marker comments.
	* gdb.c++/try_catch.exp: Get line numbers from marker comments.
	* gdb.c++/m-data.cc: Delete namespace __gnu_test.
	* gdb.c++/m-static.cc: Ditto.
	* gdb.c++/m-static1.cc: Ditto.
	* gdb.c++/try_catch.cc: Ditto.
This commit is contained in:
David Carlton 2002-12-17 23:24:57 +00:00
parent 6819ae388f
commit 7656509736
6 changed files with 140 additions and 151 deletions

View File

@ -1,3 +1,12 @@
2002-12-17 David Carlton <carlton@math.stanford.edu>
* gdb.c++/try_catch.cc: Add marker comments.
* gdb.c++/try_catch.exp: Get line numbers from marker comments.
* gdb.c++/m-data.cc: Delete namespace __gnu_test.
* gdb.c++/m-static.cc: Ditto.
* gdb.c++/m-static1.cc: Ditto.
* gdb.c++/try_catch.cc: Ditto.
2002-12-16 Jeff Johnston <jjohnstn@redhat.com> 2002-12-16 Jeff Johnston <jjohnstn@redhat.com>
* lib/mi-support.exp (mi_reinitialize_dir): Check mi level * lib/mi-support.exp (mi_reinitialize_dir): Check mi level

View File

@ -1,47 +1,44 @@
// 2002-05-13 // 2002-05-13
namespace __gnu_test enum region { oriental, egyptian, greek, etruscan, roman };
// Test one.
class gnu_obj_1
{ {
enum region { oriental, egyptian, greek, etruscan, roman }; protected:
typedef region antiquities;
const bool test;
const int key1;
long key2;
// Test one. antiquities value;
class gnu_obj_1
{
protected:
typedef region antiquities;
const bool test;
const int key1;
long key2;
antiquities value; public:
gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
};
public: // Test two.
gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {} template<typename T>
}; class gnu_obj_2: public virtual gnu_obj_1
{
// Test two. protected:
template<typename T> antiquities value_derived;
class gnu_obj_2: public virtual gnu_obj_1
{
protected:
antiquities value_derived;
public: public:
gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { } gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
}; };
// Test three. // Test three.
template<typename T> template<typename T>
class gnu_obj_3 class gnu_obj_3
{ {
protected: protected:
typedef region antiquities; typedef region antiquities;
gnu_obj_2<int> data; gnu_obj_2<int> data;
public: public:
gnu_obj_3(antiquities b): data(etruscan) { } gnu_obj_3(antiquities b): data(etruscan) { }
}; };
}
int shadow = 0; int shadow = 0;
@ -56,7 +53,6 @@ private:
int main() int main()
{ {
using namespace __gnu_test;
gnu_obj_1 test1(egyptian, 4589); gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman); gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek); gnu_obj_3<long> test3(greek);

View File

@ -1,73 +1,68 @@
// 2002-05-13 // 2002-05-13
namespace __gnu_test enum region { oriental, egyptian, greek, etruscan, roman };
// Test one.
class gnu_obj_1
{ {
enum region { oriental, egyptian, greek, etruscan, roman }; protected:
typedef region antiquities;
static const bool test = true;
static const int key1 = 5;
static long key2;
// Test one. static antiquities value;
class gnu_obj_1
{
protected:
typedef region antiquities;
static const bool test = true;
static const int key1 = 5;
static long key2;
static antiquities value; public:
gnu_obj_1(antiquities a, long l) {}
};
public: const bool gnu_obj_1::test;
gnu_obj_1(antiquities a, long l) {} const int gnu_obj_1::key1;
}; long gnu_obj_1::key2 = 77;
gnu_obj_1::antiquities gnu_obj_1::value = oriental;
const bool gnu_obj_1::test;
const int gnu_obj_1::key1;
long gnu_obj_1::key2 = 77;
gnu_obj_1::antiquities gnu_obj_1::value = oriental;
// Test two. // Test two.
template<typename T> template<typename T>
class gnu_obj_2: public virtual gnu_obj_1 class gnu_obj_2: public virtual gnu_obj_1
{ {
public: public:
static antiquities value_derived; static antiquities value_derived;
public: public:
gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { } gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7) { }
}; };
template<typename T> template<typename T>
typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan; typename gnu_obj_2<T>::antiquities gnu_obj_2<T>::value_derived = etruscan;
// Test three. // Test three.
template<typename T> template<typename T>
class gnu_obj_3 class gnu_obj_3
{ {
public: public:
typedef region antiquities; typedef region antiquities;
static gnu_obj_2<int> data; static gnu_obj_2<int> data;
public: public:
gnu_obj_3(antiquities b) { } gnu_obj_3(antiquities b) { }
}; };
template<typename T> template<typename T>
gnu_obj_2<int> gnu_obj_3<T>::data(etruscan); gnu_obj_2<int> gnu_obj_3<T>::data(etruscan);
// 2002-08-16 // 2002-08-16
// Test four. // Test four.
#include "m-static.h" #include "m-static.h"
}
// instantiate templates explicitly so their static members will exist // instantiate templates explicitly so their static members will exist
template class __gnu_test::gnu_obj_2<int>; template class gnu_obj_2<int>;
template class __gnu_test::gnu_obj_2<long>; template class gnu_obj_2<long>;
template class __gnu_test::gnu_obj_3<long>; template class gnu_obj_3<long>;
int main() int main()
{ {
using namespace __gnu_test;
gnu_obj_1 test1(egyptian, 4589); gnu_obj_1 test1(egyptian, 4589);
gnu_obj_2<long> test2(roman); gnu_obj_2<long> test2(roman);
gnu_obj_3<long> test3(greek); gnu_obj_3<long> test3(greek);

View File

@ -1,9 +1,5 @@
// 2002-08-16 // 2002-08-16
namespace __gnu_test {
#include "m-static.h" #include "m-static.h"
}
using namespace __gnu_test;
const int gnu_obj_4::elsewhere = 221; const int gnu_obj_4::elsewhere = 221;

View File

@ -4,50 +4,45 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
namespace __gnu_test enum region { oriental, egyptian, greek, etruscan, roman };
// Test one.
class gnu_obj_1
{ {
enum region { oriental, egyptian, greek, etruscan, roman }; public:
typedef region antiquities;
const bool test;
const int key1;
long key2;
// Test one. antiquities value;
class gnu_obj_1
{
public:
typedef region antiquities;
const bool test;
const int key1;
long key2;
antiquities value; gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {}
};
gnu_obj_1(antiquities a, long l): test(true), key1(5), key2(l), value(a) {} // Test two.
}; template<typename T>
class gnu_obj_2: public virtual gnu_obj_1
{
public:
antiquities value_derived;
gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { }
};
// Test two. // Test three.
template<typename T> template<typename T>
class gnu_obj_2: public virtual gnu_obj_1 class gnu_obj_3
{ {
public: public:
antiquities value_derived; typedef region antiquities;
gnu_obj_2<int> data;
gnu_obj_2(antiquities b): gnu_obj_1(oriental, 7), value_derived(b) { } gnu_obj_3(antiquities b): data(etruscan) { }
}; };
// Test three.
template<typename T>
class gnu_obj_3
{
public:
typedef region antiquities;
gnu_obj_2<int> data;
gnu_obj_3(antiquities b): data(etruscan) { }
};
}
int main() int main()
{ {
using namespace __gnu_test;
bool test = true; bool test = true;
const int i = 5; const int i = 5;
int j = i; int j = i;
@ -58,12 +53,12 @@ int main()
try try
{ {
++j; ++j;
throw gnu_obj_1(egyptian, 4589); throw gnu_obj_1(egyptian, 4589); // marker 1-throw
} }
catch (gnu_obj_1& obj) catch (gnu_obj_1& obj)
{ {
++j; ++j;
if (obj.value != egyptian) if (obj.value != egyptian) // marker 1-catch
test &= false; test &= false;
if (obj.key2 != 4589) if (obj.key2 != 4589)
test &= false; test &= false;
@ -77,19 +72,19 @@ int main()
// 2 // 2
try try
{ {
++j; ++j; // marker 2-start
try try
{ {
++j; ++j; // marker 2-next
try try
{ {
++j; ++j;
throw gnu_obj_1(egyptian, 4589); throw gnu_obj_1(egyptian, 4589); // marker 2-throw
} }
catch (gnu_obj_1& obj) catch (gnu_obj_1& obj)
{ {
++j; ++j;
if (obj.value != egyptian) if (obj.value != egyptian) // marker 2-catch
test &= false; test &= false;
if (obj.key2 != 4589) if (obj.key2 != 4589)
test &= false; test &= false;
@ -115,11 +110,11 @@ int main()
try try
{ {
if (j < 100) if (j < 100)
throw invalid_argument("gdb.1"); throw invalid_argument("gdb.1"); // marker 3-throw
} }
catch (exception& obj) catch (exception& obj)
{ {
if (obj.what() != "gdb.1") if (obj.what() != "gdb.1") // marker 3-catch
test &= false; test &= false;
} }
return 0; return 0;

View File

@ -54,31 +54,29 @@ if ![runto_main] then {
continue continue
} }
# One. gdb_breakpoint [gdb_get_line_number "marker 1-throw"]
gdb_continue_to_breakpoint "marker 1-throw"
gdb_test "break 61" "Breakpoint \[0-9\]*.*line 61\\." gdb_breakpoint [gdb_get_line_number "marker 1-catch"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:61\r\n.*" "continue to 61" gdb_continue_to_breakpoint "marker 1-catch"
gdb_test "break 66" "Breakpoint \[0-9\]*.*line 66\\." gdb_breakpoint [gdb_get_line_number "marker 2-start"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:66\r\n.*" "continue to 66" gdb_continue_to_breakpoint "marker 2-start"
gdb_test "break 80" "Breakpoint \[0-9\]*.*line 80\\." gdb_breakpoint [gdb_get_line_number "marker 2-next"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:80\r\n.*" "continue to 80" gdb_continue_to_breakpoint "marker 2-next"
gdb_test "break 83" "Breakpoint \[0-9\]*.*line 83\\." gdb_breakpoint [gdb_get_line_number "marker 2-throw"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:83\r\n.*" "continue to 83" gdb_continue_to_breakpoint "marker 2-throw"
gdb_test "break 87" "Breakpoint \[0-9\]*.*line 87\\." gdb_breakpoint [gdb_get_line_number "marker 2-catch"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:87\r\n.*" "continue to 87" gdb_continue_to_breakpoint "marker 2-catch"
gdb_test "break 92" "Breakpoint \[0-9\]*.*line 92\\." gdb_breakpoint [gdb_get_line_number "marker 3-throw"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:92\r\n.*" "continue to 92" gdb_continue_to_breakpoint "marker 3-throw"
gdb_test "break 118" "Breakpoint \[0-9\]*.*line 118\\." gdb_breakpoint [gdb_get_line_number "marker 3-catch"]
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:118\r\n.*" "continue to 118" gdb_continue_to_breakpoint "marker 3-catch"
gdb_test "break 122" "Breakpoint \[0-9\]*.*line 122\\."
gdb_test "continue" "Continuing\\.\r\n\r\nBreakpoint.*at.*try_catch\\.cc:122\r\n.*" "continue to 122"
gdb_exit gdb_exit
return 0 return 0