Issue with C++ exception handling with 4.6.2 release on PSIM BSP

Karel Gardas kgardas at objectsecurity.com
Mon Jan 10 13:15:12 UTC 2005


Hello,

after non-success with ARM/RTEMS, I'm trying to get C++ working for
PowerPC/RTEMS. Unfortunatelly it seems something is broken with exception
handling. I've slightly modified hello_world_c to:

/*
 *  Simple test program -- simplified version of sample test hello.
 */

#include <bsp.h>

#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>

rtems_task Init(
  rtems_task_argument ignored
)
{
  printf( "\n\n*** HELLO WORLD TEST ***\n" );
  try {
    throw 1;
  }
  catch (...) {
    printf("1 caught!\n");
  }
  printf( "Hello World\n" );
  printf( "*** END OF HELLO WORLD TEST ***\n" );
  exit( 0 );
}

/* configuration information */

#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_MAXIMUM_TASKS 1

#define CONFIGURE_INIT

#include <confdefs.h>

/* end of file */


also I've added make-cxx-exe rule into the PSIM's custom makefile.
Building this example looks:

/mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
make
test -d o-optimize || mkdir o-optimize
powerpc-rtems-g++ -B/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/ -specs
bsp_specs -qrtems   -g -Wall  -g     -mcpu=603e -D_OLD_EXCEPTIONS
-Dppc603e     -c   -o o-optimize/test.o test.cc
powerpc-rtems-g++ -B/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/ -specs
bsp_specs -qrtems   -g -Wall  -g     -mcpu=603e -D_OLD_EXCEPTIONS
-Dppc603e          -o o-optimize/hello.exe   o-optimize/test.o
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-dpmem.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-event.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-msg.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-mp.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-part.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-signal.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-timer.rel
/mnt/karel/rtems-ppc//powerpc-rtems/psim/lib/no-rtmon.rel
powerpc-rtems-nm -g -n o-optimize/hello.exe > o-optimize/hello.num
powerpc-rtems-size o-optimize/hello.exe
   text    data     bss     dec     hex filename
 145144   22692   21421  189257   2e349 o-optimize/hello.exe
/mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$


and running looks:

/mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$
psim o-optimize/hello.exe


*** HELLO WORLD TEST ***
/mnt/karel/downloads/RTEMS/build/tools/examples-4.6.2/hello_world_cxx_without_libstdcxx$


as you can see, exception is thrown, but never caught in catch block. FYI:
Yes, I built rtems with `--enable-cxx'.

Is there anybody here who is using C++ on RTEMS?

Thanks,
Karel
--
Karel Gardas                  kgardas at objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com




More information about the users mailing list