Help needed in debugging the program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am not able catch exception from a shared library at run time.
It throws following error while running the executable.

        terminate called after throwing an instance of 'std::string'
        ABORT instruction (core dumped)

One sample program I have written below,

------------------
testexception.h
------------------

        void function() ;

------------------
testexception.cc
------------------

        include <iostream>
        #include "testexception.h"

        void functionthrowexception()
        {
            throw  std::string("Error") ;
        }


------------------
test.cc
------------------

        # include <iostream>
        # include "testexception.h"

        extern void functionthrowexception() ;

        int main()
        {
            try
            {
                functionthrowexception() ;
            }
            catch(const string& e)
            {
            }
            catch(...)
            {
            }
        
            return 0 ;
        }



Compilation(64-Bit)
------------
g++ -fPIC -I/opt/hp-gcc64-4.1.2/include -c testexception.cc
ld  -G testexception.o  -o libtestexception.sl 
g++ -I/opt/hp-gcc64-4.1.2/include -o test test.cc libtestexception.sl

Running
-------
./test
        terminate called after throwing an instance of 'std::string'
        ABORT instruction (core dumped)


I am using following configuration

1) OS 
        HP UX 11.11 (PA-RISC)

2) g++     
        gcc 4.1.2

3) linker (ld)
        ld 2.15

4) Compilation
        64 bit compilation


Can you help me in resolving this proble

Thanks and Regards
Chandru






 This e-mail is bound by the terms and conditions described at http://www.subexazure.com/mail-disclaimer.html


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux