Re: CxxFrameHandler problem

2002-07-17 Thread Steven Edwards

> That's a start, yes, thanks. I'll need a more
> complete example with
> nested try blocks, destructors all over the place,
> typed exceptions,
> etc. to make sure I understand all the compiler
> internal structures;
> but I can at least try to make that simple case not
> crash...

Taken from MSDN (see fair use) here is the msdn
example page.

--

The following example demonstrates C++ exception
handling using classes with destructor semantics. It
declares two C++ classes; one (class CTest) for
defining the exception object itself, and the second
(class CDtorDemo) for demonstrating the destruction of
a separate frame object during stack unwinding:
Example

// exceptions_Exception_Examples.cpp
// compile with: /EHsc
#include 

using namespace std;
void MyFunc( void );

class CTest
{
public:
CTest(){};
~CTest(){};
const char *ShowReason() const { return "Exception
in CTest class."; }

};

class CDtorDemo
{
public:
CDtorDemo();
~CDtorDemo();
};

CDtorDemo::CDtorDemo()
{
cout << "Constructing CDtorDemo." << endl;
}

CDtorDemo::~CDtorDemo()
{
cout << "Destructing CDtorDemo." << endl;
}

void MyFunc()
{

CDtorDemo D;
cout<< "In MyFunc(). Throwing CTest exception." <<
endl;
throw CTest();
}

int main()
{
cout << "In main." << endl;
try
{
cout << "In try block, calling MyFunc()." <<
endl;
MyFunc();
}
catch( CTest E )
{
cout << "In catch handler." << endl;
cout << "Caught CTest exception type: ";
cout << E.ShowReason() << endl;
}
catch( char *str )
{
cout << "Caught some other exception: " << str
<< endl;
}
cout << "Back in main. Execution resumes here." <<
endl;
return 0;
}

If a matching catch handler is found, and it catches
by value, its formal parameter is initialized by
copying the exception object. If it catches by
reference, the parameter is initialized to refer to
the exception object. After the formal parameter is
initialized, the process of "unwinding the stack"
begins. This involves the destruction of all automatic
objects that were constructed (but not yet destructed)
between the beginning of the try block associated with
the catch handler and the exception's throw site.
Destruction occurs in reverse order of construction.
The catch handler is executed and the program resumes
execution following the last handler (that is, the
first statement or construct that is not a catch
handler).
Output

In main.
In try block, calling MyFunc().
Constructing CDtorDemo.
In MyFunc(). Throwing CTest exception.
Destructing CDtorDemo.
In catch handler.
Caught CTest exception type: Exception in CTest class.
Back in main. Execution resumes here.

Note the declaration of the exception parameter in
both catch handlers:

catch( CTest E )
{ // ... }
catch( char *str )
{ // ... }

You do not need to declare this parameter; in many
cases it may be sufficient to notify the handler that
a particular type of exception has occurred. However,
if you do not declare an exception object in the
exception declaration, you will not have access to the
object in the catch handler clause. For example:

catch( CTest )
{ 
// No access to a CTest exception object in this
handler.
}

A throw expression with no operand re-throws the
exception currently being handled. Such an expression
should appear only in a catch handler or in a function
called from within a catch handler. The re-thrown
exception object is the original exception object (not
a copy). For example:

try
{
throw CSomeOtherException();
}
catch(...)  // Handle all exceptions
{
// Respond (perhaps only partially) to exception
//...

throw;  // Pass exception to some other
handler
}

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




Re: CxxFrameHandler problem

2002-07-17 Thread John K. Hohm

Alexandre Julliard <[EMAIL PROTECTED]> wrote:
> Uwe Bonnes <[EMAIL PROTECTED]> writes:
> 
> > Appended program uses CxxFrameHandler and crashes in wine with builtin
> > msvcrt, but not with native. Compile as Release version and include the
> MFC
> > dll. Can somebody compile for Alexandre? Alexandre, is this a start or do
> > you need something complete?
> 
> That's a start, yes, thanks. I'll need a more complete example with
> nested try blocks, destructors all over the place, typed exceptions,
> etc. to make sure I understand all the compiler internal structures;
> but I can at least try to make that simple case not crash...

Although this may duplicate effort, I am familiar with several strange 
combinations of exception handling that I know work with Visual C++ 6.0; I 
will put them a test program for you.  You can never have too many test 
programs, right?




Re: CxxFrameHandler problem

2002-07-17 Thread Alexandre Julliard

Uwe Bonnes <[EMAIL PROTECTED]> writes:

> Appended program uses CxxFrameHandler and crashes in wine with builtin
> msvcrt, but not with native. Compile as Release version and include the MFC
> dll. Can somebody compile for Alexandre? Alexandre, is this a start or do
> you need something complete?

That's a start, yes, thanks. I'll need a more complete example with
nested try blocks, destructors all over the place, typed exceptions,
etc. to make sure I understand all the compiler internal structures;
but I can at least try to make that simple case not crash...

-- 
Alexandre Julliard
[EMAIL PROTECTED]




Re: CxxFrameHandler problem

2002-07-17 Thread Francois Gouget

On Wed, 17 Jul 2002, Uwe Bonnes wrote:
[...]
> Here at home, I only have the author's edition of VC++, not allowing my to
> distributed compiled executables, but only the source.
>
> Appended program uses CxxFrameHandler and crashes in wine with builtin
> msvcrt, but not with native. Compile as Release version and include the MFC
> dll. Can somebody compile for Alexandre? Alexandre, is this a start or do
> you need something complete?


I compiled the program and sent it to Alexandre. I modified the program
to not use iostreamsn so that I would not have to link with msvcirt.dll.
I compiled with Visual C++ 6.0 in Release mode and checked that it
crashes (badly) when using the builtin msvcrt.

#include 
#include 

int main()
{
try {
printf("Hello World!\n");
throw "fault";
return 1;
} catch (...) {
printf("Caught the exception\n");
}
return 0;
}


trace:seh:EXC_CallHandler calling handler at 0x400c53f0 code=c096
flags=10
trace:seh:EXC_CallHandler handler returned 2
trace:seh:EXC_CallHandler calling handler at 0x400c53f0 code=c096
flags=10
trace:seh:EXC_CallHandler handler returned 2
trace:seh:EXC_CallHandler calling handler at 0x400c53f0 code=c096
flags=10
trace:seh:EXC_CallHandler handler returned 2
[... ad infinitum ...]


--
Francois Gouget [EMAIL PROTECTED]http://fgouget.free.fr/
 Linux: the choice of a GNU generation






Re: CxxFrameHandler problem

2002-07-17 Thread Uwe Bonnes

> "Alexandre" == Alexandre Julliard <[EMAIL PROTECTED]> writes:

Alexandre> Steven Edwards <[EMAIL PROTECTED]> writes:
>> I dont think I can help to much with reimplementing the
>> CxxFrameHandler but if anyone decides to work on it I will set aside
>> plenty of time to help them debug.  (Hint, Hint) =)

Alexandre> The real problem is having something to seriously test it. So
Alexandre> if someone (hint, hint ;-) could write a test program
Alexandre> exercising the various features of C++ exceptions and send me
Alexandre> a binary of it built with VC++, I'll fix CxxFrameHandler.

Here at home, I only have the author's edition of VC++, not allowing my to
distributed compiled executables, but only the source.

Appended program uses CxxFrameHandler and crashes in wine with builtin
msvcrt, but not with native. Compile as Release version and include the MFC
dll. Can somebody compile for Alexandre? Alexandre, is this a start or do
you need something complete?

Perhaps I manage to compile tomorrow at work, but I have to leave early for
a travel...

Bye
-- 
Uwe Bonnes[EMAIL PROTECTED]

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
- Tel. 06151 162516  Fax. 06151 164321 --
#include 
#include 

 
int main()
{
  try
{
  cout << "Hello World!\n";
  throw "fault";
  return 0;
}
  catch(...)
{
  cerr << "Error" << endl;
}
}




Re: CxxFrameHandler problem

2002-07-17 Thread Juergen Schmied

I might be a bit faster ;-). I'll try to write a small test tomorrow.

> I'm trying to learn a little c++ with my work on
> geoshell so I will see what I can do. You may get a
> .exe in a few weeks.
>
> Thanks
> Steven
>
> > The real problem is having something to seriously
> > test it. So if
> > someone (hint, hint ;-) could write a test program
> > exercising the
> > various features of C++ exceptions and send me a
> > binary of it built
> > with VC++, I'll fix CxxFrameHandler.





Re: CxxFrameHandler problem

2002-07-17 Thread Steven Edwards

I'm trying to learn a little c++ with my work on
geoshell so I will see what I can do. You may get a
.exe in a few weeks.

Thanks
Steven

> The real problem is having something to seriously
> test it. So if
> someone (hint, hint ;-) could write a test program
> exercising the
> various features of C++ exceptions and send me a
> binary of it built
> with VC++, I'll fix CxxFrameHandler.


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




Re: CxxFrameHandler problem

2002-07-17 Thread Alexandre Julliard

Steven Edwards <[EMAIL PROTECTED]> writes:

> I dont think I can help to much with reimplementing
> the CxxFrameHandler but if anyone decides to work on
> it I will set aside plenty of time to help them debug.
> (Hint, Hint) =)

The real problem is having something to seriously test it. So if
someone (hint, hint ;-) could write a test program exercising the
various features of C++ exceptions and send me a binary of it built
with VC++, I'll fix CxxFrameHandler.

-- 
Alexandre Julliard
[EMAIL PROTECTED]




Re: CxxFrameHandler problem

2002-07-16 Thread Steven Edwards

I dont think I can help to much with reimplementing
the CxxFrameHandler but if anyone decides to work on
it I will set aside plenty of time to help them debug.
(Hint, Hint) =)

Thanks
Steven

--- Jürgen_Schmied <[EMAIL PROTECTED]> wrote:
> Hmm, I think these FIXME messages should be
> considered 
> as a real FIXME. The application might throw a
> exception 
> and catch it later as a normal behaviour. As long as
> our
> implementation of CxxFrameHandler does not behave
> right
> is has to be fixed. Then we can blame the
> application.

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




Re: CxxFrameHandler problem

2002-07-15 Thread Jürgen Schmied

Hmm, I think these FIXME messages should be considered 
as a real FIXME. The application might throw a exception 
and catch it later as a normal behaviour. As long as our
implementation of CxxFrameHandler does not behave right
is has to be fixed. Then we can blame the application.

juergen


> --- Steven Edwards <[EMAIL PROTECTED]> wrote:
> > If anyone is working on the CxxFrameHandler I have
> > two
> > applications I have been working on that may help in
> > testing/tracking down the problems. Currently both
> > WinCVS and geoshell suffer from this problem. Both
> > applications are GPL so if you need to look at the
> > source to find out what is going on you can. 
> 
> Steven, these FIXME messages are only traces of an
> exception thrown by application and are not related to
> real problem in any way. We should find out why an
> exception is thrown in the first place.
> 
> I recommend you to to file a separate bug report for
> each case.
> 
> Andriy
> 
> __
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
> 
> 


---
[EMAIL PROTECTED]






Re: CxxFrameHandler problem

2002-07-15 Thread Uwe Bonnes

> "Andriy" == Andriy Palamarchuk <[EMAIL PROTECTED]> writes:

Andriy> --- Steven Edwards <[EMAIL PROTECTED]> wrote:
>> If anyone is working on the CxxFrameHandler I have two applications I
>> have been working on that may help in testing/tracking down the
>> problems. Currently both WinCVS and geoshell suffer from this
>> problem. Both applications are GPL so if you need to look at the
>> source to find out what is going on you can.

Andriy> Steven, these FIXME messages are only traces of an exception
Andriy> thrown by application and are not related to real problem in any
Andriy> way. We should find out why an exception is thrown in the first
Andriy> place.

Andriy> I recommend you to to file a separate bug report for each case.

However out CxxFrameHandler implementation normally makes the real culprit
very hard to find. Nearly never a good backtrace is produced when
CxxFrameHandler is involved, sometimes the backtrace goes in a loo or
something else happens.

To make builtin msvcrt usable or even debugable, we need a working
CxxFrameHandler implementation. I looked at
http://www.thecodeproject.com/cpp/Exceptionhandler.asp, but I didn't feel
like implementing it...

Bye 
-- 
Uwe Bonnes[EMAIL PROTECTED]

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
- Tel. 06151 162516  Fax. 06151 164321 --




Re: CxxFrameHandler problem

2002-07-15 Thread Andriy Palamarchuk


--- Steven Edwards <[EMAIL PROTECTED]> wrote:
> If anyone is working on the CxxFrameHandler I have
> two
> applications I have been working on that may help in
> testing/tracking down the problems. Currently both
> WinCVS and geoshell suffer from this problem. Both
> applications are GPL so if you need to look at the
> source to find out what is going on you can. 

Steven, these FIXME messages are only traces of an
exception thrown by application and are not related to
real problem in any way. We should find out why an
exception is thrown in the first place.

I recommend you to to file a separate bug report for
each case.

Andriy

__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




CxxFrameHandler problem

2002-07-14 Thread Steven Edwards

If anyone is working on the CxxFrameHandler I have two
applications I have been working on that may help in
testing/tracking down the problems. Currently both
WinCVS and geoshell suffer from this problem. Both
applications are GPL so if you need to look at the
source to find out what is going on you can. 

fixme:msvcrt:__CxxFrameHandler
(0x40473df4,0x40585e54,0x40473a80,0x40473a1c):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40473a20,0x40585e54,0x404736ac,0x40473648):stub?
fixme:msvcrt:__CxxFrameHandler
(0x4047364c,0x40585e54,0x404732d8,0x40473274):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40473278,0x40585e54,0x40472f04,0x40472ea0):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40472ea4,0x40585e54,0x40472b30,0x40472acc):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40472ad0,0x40585e54,0x4047275c,0x404726f8):stub?
fixme:msvcrt:__CxxFrameHandler
(0x404726fc,0x40585e54,0x40472388,0x40472324):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40472328,0x40585e54,0x40471fb4,0x40471f50):stub?
fixme:msvcrt:__CxxFrameHandler
(0x40471f54,0x40585e54,0x40471be0,0x40471b7c):stub?


__
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com