Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Oct 2002 14:56:42 -0400
From:      "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>
To:        Martin Blapp <mb@imp.ch>
Cc:        <dev@porting.openoffice.org>, <openoffice@freebsd.org>, <kan@freebsd.org>
Subject:   Re: [porting-dev] FreeBSD: Uncatched exception problem
Message-ID:  <200210101456.42050.kevin.hendricks@sympatico.ca>
In-Reply-To: <20021010204043.B15308-100000@levais.imp.ch>
References:  <20021010204043.B15308-100000@levais.imp.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Here is a short (quickly thown together) test case to tr).

---snip---testlib.hxx---follows
#ifndef _TESTLIB_HXX_
#define _TESTLIB_HXX_

struct Exc
{
         int n;
};


class TestLib
{
  struct Exc      myExcep;

public:
  TestLib(int mytype);
  ~TestLib();
  void do_it() throw ( struct Exc );
};
#endif


---snip--testlib.cxx---follows
#include <stdio.h>
#include "testlib.hxx"

TestLib::TestLib(int n)
{
  myExcep.n = n;
}

TestLib::~TestLib()
{
}

void TestLib::do_it() throw ( struct Exc)
{
  fprintf(stderr, "in do_it throwing %d\n",myExcep.n); fflush(stderr);
  throw myExcep;

  while (1) {
    // do nothing
  }
}

---snip---throw_test.cxx---follows
#include <stdio.h>
#include <string.h>
#include "testlib.hxx"

void caller( int n )
{
  TestLib * pTL = new TestLib(n);
  pTL->do_it();
}


int main( int argc, char** argv )
{
         try
         {
                 caller( 15 );
         }
         catch( Exc& )
         {
                 fprintf( stderr, "caught struct Exc&\n");
         }
         catch( ... )
         {
                 fprintf( stderr, "caught something\n");
         }
         return 0;
}

---snip---end-of-files---

Here is how you build them:

 g++ -c -O2 -fPIC -I. testlib.cxx
 g++ -shared -o libtestlib.so testlib.o
 g++ -o throw_test -O2 -I. -L. -ltestlib -lstdc++ throw_test.cxx
 export LD_LIBRARY_PATH=`pwd`
 ./throw_test

The output hsould look like:

in do_it throwing 15
caught struct Exc&

Now all this does is throw from a shared library to a main executable.  if 
this works correctly, then we should try to modify this futher to have one 
main and two shared libraries.

Hope this shows the bug.

Kevin




On October 10, 2002 02:44, Martin Blapp wrote:
> Hi,
>
> > Since our old simple excetpion handling did not show the problem,
> > perhaps the issue is throwing and catching across shared library
> > boundaries.
> >
> > The thow is done in libsfx* and the catch is done in libfwk*.
>
> I checked the other case for which I get a exception. If I get enter
> a non existent URL into the location bar, I also get a abort. This seems
> also be done over two shared libs ...
>
> http://www.nonexisting.ch does produce a abort trap too.
>
> > Perhaps if we changed the test program into two seaparate peices and
> > tried the same thing (across two shared libs) we could recreate the
> > issue outside of OOo.
> >
> > What do you think?
>
> Good idea ! Erm, since I cannot program c++, could you help me here ?
>
> Martin


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-openoffice" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210101456.42050.kevin.hendricks>