In an attempt to narrow down the crash I
get when exceptions are thrown in various
C++ programs (wesnoth and others) I've
managed to come up with the following short
c++ program that crashes.
#include
class MyExcept
{
private:
std::string _msg;
public:
MyExcept(const char *msg) : _msg(msg) {};
};
void throw_test();
int main(int argc, char *argv[])
{
try
{
throw_test();
} catch(MyExcept &e)
{
return -1;
}
return 0;
}
void throw_test()
{
throw MyExcept("This is a test");
}
It's compiled with:
# Makefile for exceptcrash
SRC=main.cc
CXX=g++
CXXFLAGS=
TARGET=ecrash
all: $(TARGET)
$(TARGET): $(SRC:.cc=.o)
g++ -static $(SRC:.cc=.o) -o $(TARGET)ELF
elf2aif $(TARGET)ELF $(TARGET)
I get the following error:
Fatal signal received: Segmentation fault
Stack backtrace:
Running thread 0x43170
( 827f38) pc: 26c40 lr: 27254 sp: 827f3c __write_backtrace()
( 827fa0) pc: 26df8 lr: 27adc sp: 827fa4 __unixlib_raise_signal()
( 827fb0) pc: 279e0 lr: 18d6c sp: 826f34 __h_cback()
Register dump at 00827fb4:
a1: 1 a2: a a3: 246e7552 a4: 68746150
v1: 0 v2: 826f6c v3: 3c39c v4: ead0
v5: 3aca8 v6: 74206465 sl: 826210 fp: 826f64
ip: 6c696146 sp: 826f34 lr: 18d6c pc: 6c696144
cpsr: 20000010
00018d58 : .é : e98d0220 : STMIB R13,{R5,R9}
00018d5c : .@ ã : e3a04005 : MOV R4,#5
00018d60 : .@ . : 13a04000 : MOVNE R4,#0
00018d64 : .à á : e1a0e00f : MOV R14,PC
00018d68 : .ð á : e1a0f00c : MOV PC,R12
00018d6c : ..Pã : e3500000 : CMP R0,#0
00018d70 : .. ã : e3a0100a : MOV R1,#&0A ; =10
00018d74 : .. ã : e3a00001 : MOV R0,#1
00018d78 : Úÿÿ. : 0affffda : BEQ &00018CE8
( 826f64) pc: 18cc0 lr: 19024 sp: 826f68
^_Unwind_ForcedUnwind_Phase2()
( 826f84) pc: 18fb4 lr: 83ec sp: 826f88 _Unwind_SjLj_Resume()
( 826ff4) pc: 8368 lr: 1e214 sp: 826ff8 main()
I get the same results with a recent build of the
native GCC4 compiler and cross-compiling using
Cygwin.
The same crash occurs if I run the ELF version.
Regards,
Alan
_________________________________________________________________
Free photo editing software from Windows Live . Try it now!
http://clk.atdmt.com/UKM/go/134665240/direct/01/
_______________________________________________
GCCSDK mailing list [email protected]
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK