This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Tasks (exception round-up)
Tom Tromey wrote:
Take a look at the appended program, which is a modification to the
one you posted.
Yeah thank, for the pointers. I took the modified simple program and
made it simpler. Attached:
simplest_next_fail.cxx - really simple throw catch in main
simple_next_fail.cxx - same as simplest_next_fail but with a few extra
frames to show next/finish driving through all of them and not returning
control.
Basically then, this can be rendered down to: if you enact a finish or a
next at the location of a throw statement, control of the inferior is
lost until another breakpoint or signal is delivered. I did some
preliminary testing with:
LD_POINTER_GUARD=0
that was mentioned in Pedro's email, but nothing good to report there so
far. I'll spend the rest of the day stepping through next_command() and
step_1() -> set_longjmp_breakpoint() -> create_longjmp_breakpoint
("longjmp") code, and examine the precise sequence of events.
Regards
Phil
#include <iostream>
using namespace std;
int func1()
{
// break somewhere and step here.
// Run next or finish from here.
// Control of the inferior should be regained
// in the catch (...) in main.
throw 20;
}
int main () {
try
{
func1();
}
catch (...)
{
// Catch the throw in func1. next or finish should return
// control here.
cout << "Should regain control of inferior here." << endl;
}
// But it doesn't, it keeps on going ....
cout << "Exiting the program." << endl;
return 0;
}
#include <iostream>
using namespace std;
int func1()
{
// break somewhere and step here.
// Run next or finish from here.
// Control of the inferior should be regained
// in the catch (...) in main.
throw 20;
}
int func2()
{
func1();
}
int print_exit_message()
{
cout << "Exiting the program." << endl;
}
int main () {
try
{
func2();
}
catch (...)
{
// Catch the throw in func1. next or finish should return
// control here.
cout << "Should regain control of inferior here." << endl;
}
// But it doesn't, it keeps on going ....
print_exit_message();
return 0;
}