D
dust
Hi,
I'm a testng a function func(), a member function of class A, defined
in A.cpp. But while creating object of A, an exception is thrown in
constructor.
Here is gdb output:
(gdb) bt
#0 0x00504eff in raise () from /lib/tls/libc.so.6
#1 0x00506705 in abort () from /lib/tls/libc.so.6
#2 0x0019c4f7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.
5
#3 0x0019c544 in std::terminate () from /usr/lib/libstdc++.so.5
#4 0x0019c6b6 in __cxa_throw () from /usr/lib/libstdc++.so.5
#5 0x0804b530 in A (this=0x9be8390) at path/to/A.cpp:381
As this obect is being created in my test case, I put the object
creation in try catch block as
try
{
A obj;
}
catch (int res) { }
When I compiled and run the test, this time an exception is thrown in
Test body itself. Here is the gdb output:
(gdb) bt
#0 0x00cd2eff in raise () from /lib/tls/libc.so.6
#1 0x00cd4705 in abort () from /lib/tls/libc.so.6
#2 0x00eca4f7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.
5
#3 0x00eca544 in std::terminate () from /usr/lib/libstdc++.so.5
#4 0x00eca71c in __cxa_rethrow () from /usr/lib/libstdc++.so.5
#5 0x08054103 in myTest_Test::TestBody (this=0x868b230) at A.cpp:13
The difference between 2 output is at frame #2, in 1st case it is
__cxa_throw (), and in 2nd case it is __cxa_rethrow ().
Please help me how to catch the exception generated from my test case.
I'm a testng a function func(), a member function of class A, defined
in A.cpp. But while creating object of A, an exception is thrown in
constructor.
Here is gdb output:
(gdb) bt
#0 0x00504eff in raise () from /lib/tls/libc.so.6
#1 0x00506705 in abort () from /lib/tls/libc.so.6
#2 0x0019c4f7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.
5
#3 0x0019c544 in std::terminate () from /usr/lib/libstdc++.so.5
#4 0x0019c6b6 in __cxa_throw () from /usr/lib/libstdc++.so.5
#5 0x0804b530 in A (this=0x9be8390) at path/to/A.cpp:381
As this obect is being created in my test case, I put the object
creation in try catch block as
try
{
A obj;
}
catch (int res) { }
When I compiled and run the test, this time an exception is thrown in
Test body itself. Here is the gdb output:
(gdb) bt
#0 0x00cd2eff in raise () from /lib/tls/libc.so.6
#1 0x00cd4705 in abort () from /lib/tls/libc.so.6
#2 0x00eca4f7 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.
5
#3 0x00eca544 in std::terminate () from /usr/lib/libstdc++.so.5
#4 0x00eca71c in __cxa_rethrow () from /usr/lib/libstdc++.so.5
#5 0x08054103 in myTest_Test::TestBody (this=0x868b230) at A.cpp:13
The difference between 2 output is at frame #2, in 1st case it is
__cxa_throw (), and in 2nd case it is __cxa_rethrow ().
Please help me how to catch the exception generated from my test case.