Changeset e2b55ac9 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:17Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
134fd03
Parents:
e6c9fa6
git-author:
Jaroslav Jindrak <dzejrou@…> (2017-10-17 16:17:34)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:17)
Message:

cpp: added stubs for level 2 unwinding, now we can throw and catch exceptions, but the program freezes once it encounters a throw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/src/internal/unwind.cpp

    re6c9fa6 re2b55ac9  
    2828
    2929#include <cstdint>
     30#include <cstdlib>
    3031
    3132namespace __cxxabiv1
     
    8283    {
    8384        // TODO: implement
     85        return _URC_NO_REASON;
    8486    }
    8587
     
    9799    {
    98100        // TODO: implement
     101        return 0;
    99102    }
    100103
     
    107110    {
    108111        // TODO: implement
     112        return 0;
    109113    }
    110114
     
    117121    {
    118122        // TODO: implement
     123        return 0;
    119124    }
    120125
     
    122127    {
    123128        // TODO: implement
     129        return 0;
    124130    }
    125131
     
    135141     * Stack unwinding functionality - Level 2.
    136142     */
    137     // TODO:
     143    struct __cxa_exception
     144    {
     145        std::type_info* exceptionType;
     146        void (*exceptionDestructor)(void*);
     147        // TODO: Add handler types to <exception>.
     148        /* std::unexpected_handler unexpectedHandler; */
     149        void (*unexpectedHandler)();
     150        /* std::terminate_handler terminateHandler; */
     151        void (*terminateHandler)();
     152        __cxa_exception* nextException;
     153
     154        int handlerCount;
     155        int handlerSwitchValue;
     156        const char* actionRecord;
     157        const char* languageSpecificData;
     158        void* catchTemp;
     159        void* adjujstedPtr;
     160
     161        _Unwind_Exception unwindHeader;
     162    };
     163
     164    struct __cxa_eh_globals
     165    {
     166        __cxa_exception* caughtExceptions;
     167        unsigned int uncaughtExceptions;
     168    };
     169
     170    extern "C" __cxa_eh_globals* __cxa_get_globals();
     171
     172    extern "C" __cxa_eh_globals* __cxa_get_globals_fast();
     173
     174    extern "C" void* __cxa_allocate_exception(std::size_t thrown_size)
     175    {
     176        // TODO: implement
     177        return nullptr;
     178    }
     179
     180    extern "C" void __cxa_free_exception(void* thrown_exception)
     181    {
     182        // TODO: implement
     183    }
     184
     185    extern "C" void __cxa_throw(void* thrown_exception, std::type_info* tinfo, void (*dest)(void*))
     186    {
     187        // TODO: implement
     188    }
     189
     190    extern "C" void* __cxa_get_exception_ptr(void*  exception_object)
     191    {
     192        // TODO: implement
     193        return nullptr;
     194    }
     195
     196    extern "C" void* __cxa_begin_catch(void* exception_object)
     197    {
     198        // TODO: implement
     199        return nullptr;
     200    }
     201
     202    extern "C" void __cxa_end_catch()
     203    {
     204        // TODO: implement
     205    }
     206
     207    extern "C" void __cxa_rethrow()
     208    {
     209        // TODO: implement
     210    }
     211
     212    extern "C" void __cxa_bad_cast()
     213    {
     214        // TODO: implement
     215    }
     216
     217    extern "C" void __cxa_bad_typeid()
     218    {
     219        // TODO: implement
     220    }
    138221}
Note: See TracChangeset for help on using the changeset viewer.