Usermode/libc++ - Debug in cxa code, list emplace and iterators, general STL fixes
authorJohn Hodge <[email protected]>
Mon, 26 May 2014 09:43:28 +0000 (17:43 +0800)
committerJohn Hodge <[email protected]>
Mon, 26 May 2014 09:43:28 +0000 (17:43 +0800)
16 files changed:
Usermode/Libraries/libc++.so_src/cxxabi.cc
Usermode/Libraries/libc++.so_src/exception_handling.cc
Usermode/Libraries/libc++.so_src/exception_handling.h
Usermode/Libraries/libc++.so_src/exceptions.cc
Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h [new file with mode: 0644]
Usermode/Libraries/libc++.so_src/include_exp/allocator
Usermode/Libraries/libc++.so_src/include_exp/iterator [new file with mode: 0644]
Usermode/Libraries/libc++.so_src/include_exp/list
Usermode/Libraries/libc++.so_src/include_exp/stdexcept
Usermode/Libraries/libc++.so_src/include_exp/system_error
Usermode/Libraries/libc++.so_src/include_exp/type_traits [new file with mode: 0644]
Usermode/Libraries/libc++.so_src/include_exp/utility
Usermode/Libraries/libc++.so_src/include_exp/vector
Usermode/Libraries/libc++.so_src/misc.cc
Usermode/Libraries/libc++.so_src/new.cc
Usermode/Libraries/libc++.so_src/typeinfo.cc

index 84cedf2..ad8adbd 100644 (file)
@@ -10,6 +10,7 @@
  * http://libcxxabi.llvm.org/spec.html
  */
 #include <cxxabi.h>
+#include <acess/sys.h>
 
 namespace __cxxabiv1 {
 
@@ -34,3 +35,17 @@ __vmi_class_type_info::~__vmi_class_type_info()
 
 };     // namespace __cxxabiv1
 
+extern "C" void __cxa_bad_cast ()
+{
+       _SysDebug("__cxa_bad_cast");
+       for(;;);
+       //throw ::std::bad_cast;
+}
+
+extern "C" void __cxa_bad_typeid ()
+{
+       _SysDebug("__cxa_bad_typeid");
+       for(;;);
+       //throw ::std::bad_typeid;
+}
+
index 44d029b..1bb26da 100644 (file)
@@ -8,9 +8,12 @@
 #include <exception>
 #include "exception_handling.h"
 
+#include <acess/sys.h>
 
- int   uncaught_exception_count;
-__cxa_exception        *uncaught_exception_top;
+/*__thread*/ struct __cxa_eh_globals {
+       __cxa_exception *caughtExceptions;
+       unsigned  int   uncaughtExceptions;
+} eh_globals;
 
 /*__thread*/ struct {
        __cxa_exception info;
@@ -25,14 +28,24 @@ static bool TEST_AND_SET(bool& flag) {
 }
 
 // === CODE ===
+extern "C" __cxa_eh_globals *__cxa_get_globals(void)
+{
+       return &eh_globals;
+}
+extern "C" __cxa_eh_globals *__cxa_get_globals_fast(void)
+{
+       return &eh_globals;
+}
 extern "C" void __cxa_call_unexpected(void *)
 {
        // An unexpected exception was thrown from a function that lists its possible exceptions
+       _SysDebug("__cxa_call_unexpected - TODO");
        for(;;);
 }
 
 extern "C" void *__cxa_allocate_exception(size_t thrown_size)
 {
+       ::_SysDebug("__cxa_allocate_exception(%i)", thrown_size);
        __cxa_exception *ret = static_cast<__cxa_exception*>( malloc( sizeof(__cxa_exception) + thrown_size ) );
        if( !ret ) {
                if( thrown_size <= sizeof(emergency_exception.buf) && TEST_AND_SET(emergency_exception_used) )
@@ -41,13 +54,16 @@ extern "C" void *__cxa_allocate_exception(size_t thrown_size)
                }
        }
        if( !ret ) {
+               _SysDebug("__cxa_allocate_exception - No free space");
                ::std::terminate();
        }
-       return ret;
+       ::_SysDebug("__cxa_allocate_exception: return %p", ret+1);
+       return ret + 1;
 }
 
 extern "C" void __cxa_free_exception(void *thrown_exception)
 {
+       ::_SysDebug("__cxa_free_exception(%p)", thrown_exception);
        if(thrown_exception == &emergency_exception.buf) {
                //assert(emergency_exception_used);
                emergency_exception_used = false;
@@ -60,37 +76,49 @@ extern "C" void __cxa_free_exception(void *thrown_exception)
 
 extern "C" void __cxa_throw(void *thrown_exception, std::type_info *tinfo, void (*dest)(void*))
 {
+       ::_SysDebug("__cxa_throw(%p,%p,%p) '%s'", thrown_exception, tinfo, dest, tinfo->name());
+       {
+               const ::std::exception* e = reinterpret_cast<const ::std::exception*>(thrown_exception);
+               ::_SysDebug("- e.what() = '%s'", e->what());
+       }
+       ::_SysDebug("- typeid(*tinfo) = %p", &typeid(*tinfo));
+
        __cxa_exception *except = static_cast<__cxa_exception*>( thrown_exception ) - 1;
        
+       except->unexpectedHandler = 0;
+       except->terminateHandler = 0;
        except->exceptionType = tinfo;
        except->exceptionDestructor = dest;
        memcpy(&except->unwindHeader.exception_class, "Ac20C++\0", 8);
-       uncaught_exception_top ++;
+       __cxa_get_globals()->uncaughtExceptions ++;
        
        _Unwind_RaiseException(thrown_exception);
        
+       ::_SysDebug("__cxa_throw(%p,%s) :: UNCAUGHT", thrown_exception, tinfo->name());
        ::std::terminate();
 }
 
 extern "C" void *__cxa_begin_catch(void *exceptionObject)
 {
+       ::_SysDebug("__cxa_begin_catch(%p)", exceptionObject);
        __cxa_exception *except = static_cast<__cxa_exception*>( exceptionObject ) - 1;
        
        except->handlerCount ++;
        
-       except->nextException = uncaught_exception_top;
-       uncaught_exception_top = except;
+       except->nextException = __cxa_get_globals()->caughtExceptions;
+       __cxa_get_globals()->caughtExceptions = except;
        
-       uncaught_exception_count --;
+       __cxa_get_globals_fast()->uncaughtExceptions --;
        
        return except;
 }
 
 extern "C" void __cxa_end_catch()
 {
-       struct __cxa_exception  *except = uncaught_exception_top;
+       struct __cxa_exception  *except = __cxa_get_globals()->caughtExceptions;
+       ::_SysDebug("__cxa_end_catch - %p", except);
        except->handlerCount --;
-       uncaught_exception_top = except->nextException;
+       __cxa_get_globals()->caughtExceptions = except->nextException;
        
        if( except->handlerCount == 0 ) {
                __cxa_free_exception(except+1);
index b1feae5..eb65fd1 100644 (file)
@@ -34,8 +34,8 @@ struct __cxa_exception
 {
        std::type_info* exceptionType;
        void (*exceptionDestructor)(void *);
-       unexpected_handler      unexpectedHandler;
-       terminate_handler       terminateHandler;
+       unexpected_handler*     unexpectedHandler;
+       terminate_handler*      terminateHandler;
        __cxa_exception*        nextException;
        
        int     handlerCount;
index 593ce3a..f570f34 100644 (file)
@@ -38,6 +38,7 @@ const char* ::std::exception::what() const throw()
 
 void ::std::terminate()
 {
+       _SysDebug("::std::terminate()");
        _exit(0);
 }
 
@@ -51,3 +52,8 @@ void ::std::terminate()
        logic_error(what_str)
 {
 }
+
+::std::length_error::length_error(const ::std::string& what_str):
+       logic_error(what_str)
+{
+}
diff --git a/Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h b/Usermode/Libraries/libc++.so_src/include_exp/_libcxx_helpers.h
new file mode 100644 (file)
index 0000000..e131c42
--- /dev/null
@@ -0,0 +1,12 @@
+
+#ifndef _LIBCXX__LIBCXX_HELEPRS_H_
+#define _LIBCXX__LIBCXX_HELEPRS_H_
+
+#if __cplusplus > 199711L      // C++11 check
+# define _CXX11_AVAIL  1
+#else
+# define _CXX11_AVAIL  0
+#endif
+
+#endif
+
index 656507f..6057eb3 100644 (file)
@@ -8,8 +8,11 @@
 #ifndef _LIBCXX_ALLOCATOR_
 #define _LIBCXX_ALLOCATOR_
 
+#include "_libcxx_helpers.h"
+
 #include "new"
 #include "cstddef"
+#include "utility"
 
 namespace std {
 
@@ -61,10 +64,12 @@ public:
                new ((void*)p) value_type (val);
        }
        // C++11
-       //template<class U, class... Args>
-       //void construct( U* p, Args&&... args ) {
-       //      ::new ((void*)p) U (forward<Args>(args));
-       //}
+       #if _CXX11_AVAIL
+       template<class U, class... Args>
+       void construct( U* p, Args&&... args ) {
+               ::new ((void*)p) U (::std::forward<Args>(args)...);
+       }
+       #endif
        void destroy(pointer p) {
                p->~value_type();
        }
diff --git a/Usermode/Libraries/libc++.so_src/include_exp/iterator b/Usermode/Libraries/libc++.so_src/include_exp/iterator
new file mode 100644 (file)
index 0000000..d96082a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ */
+#ifndef _LIBCXX_ITERATOR_
+#define _LIBCXX_ITERATOR_
+
+namespace std {
+
+struct input_iterator_tag {};
+struct output_iterator_tag {};
+struct forward_iterator_tag {};
+struct bidrectional_iterator_tag {};
+struct random_access_iterator_tag {};
+
+template <class Category, class T, class Distance = ptrdiff_t, class Pointer = T*, class Reference = T&>
+class iterator
+{
+public:
+       typedef T       value_type;     
+       typedef Distance        difference_type;
+       typedef Pointer pointer_type;
+       typedef Reference       reference;
+       typedef Category        iterator_category;
+};
+
+template <class Iterator> class iterator_traits;
+template <class T> class iterator_traits<T*>;
+template <class T> class iterator_traits<const T*>;
+
+
+};     // namespace std
+
+#endif
+
+// vim: ft=cpp
+
index ff82614..f63e31d 100644 (file)
 
 #include <cstddef>
 #include "allocator"
+#include "stdexcept"
+#include "utility"
 
 namespace std {
 
 namespace _bits {
-template <class T,class Alloc> class list_iterator;
+template <class ListType, class T> class list_iterator;
 template <class T> class list_item;
 }
 
@@ -23,7 +25,7 @@ class list
 {
        typedef ::std::_bits::list_item<T>      item_type;
        typedef ::std::_bits::list_item<const T>        const_item_type;
-       friend class ::std::_bits::list_iterator<item_type,Alloc>;
+       friend class ::std::_bits::list_iterator<list, T>;
        
        typedef typename Alloc::template rebind<item_type>::other       item_allocator;
 public:
@@ -33,8 +35,8 @@ public:
        typedef typename allocator_type::const_reference        const_reference;
        typedef typename allocator_type::pointer        pointer;
        typedef typename allocator_type::const_pointer  const_pointer;
-       typedef _bits::list_iterator<T,Alloc>   iterator;
-       typedef _bits::list_iterator<const T,Alloc>     const_iterator;
+       typedef _bits::list_iterator<list,T>    iterator;
+       typedef _bits::list_iterator<list,const T>      const_iterator;
        typedef int     difference_type;
        typedef size_t  size_type;
 
@@ -43,6 +45,7 @@ private:
        allocator_type  m_allocator;
        item_type       *m_start;
        item_type       *m_end;
+       size_type       m_item_count;
 
 public:
        list(const allocator_type& alloc = allocator_type()):
@@ -64,29 +67,41 @@ public:
        list& operator =(const list& x);
        
        iterator begin() {
-               return iterator(m_start);
+               return iterator(*this, m_start);
        }
        const_iterator begin() const {
-               return const_iterator(m_start);
+               return const_iterator(*this, m_start);
        }
 
        iterator end() {
-               return iterator(0);
+               return iterator(*this, 0);
        }
        const_iterator end() const {
-               return const_iterator(0);
+               return const_iterator(*this, 0);
        }
        
        bool empty() const {
                return !m_start;
        }
-       size_t size() const;
-       size_t max_size() const;
+       size_t size() const {
+               return m_item_count;
+       }
+       size_t max_size() const {
+               return (size_type)-1 / sizeof(item_type);
+       }
        
-       T& front();
-       const T& front() const;
-       T& back();
-       const T& back() const;
+       T& front() {
+               return m_start->value;
+       }
+       const T& front() const {
+               return m_start->value;
+       }
+       T& back() {
+               return m_end->value;
+       }
+       const T& back() const {
+               return m_end->value;
+       }
        
        void assign(size_type n, const value_type& val) {
                clear();
@@ -109,28 +124,17 @@ public:
                erase(end());
        }
        
+       template <class... Args>
+       iterator emplace(iterator position, Args&&... args) {
+               item_type *newi = m_item_allocator.allocate(1);
+               m_allocator.construct(&newi->value, ::std::forward<Args>(args)...);
+               return insert_item(position, newi);
+       }
+       
        iterator insert(iterator position, const value_type& val) {
                item_type *newi = m_item_allocator.allocate(1);
                m_allocator.construct(&newi->value, val);
-               if( position == end() ) {
-                       newi->next = 0;
-                       newi->prev = m_end;
-                       m_end->next = newi;
-                       m_end = newi;
-               }
-               else if( position == begin() ) {
-                       newi->next = m_start;
-                       newi->prev = 0;
-                       m_start->prev = newi;
-                       m_start = newi;
-               }
-               else {
-                       newi->prev = position.cur->prev;
-                       newi->next = position.cur;
-                       position.cur->prev->next = newi;
-                       position.cur->prev = newi;
-               }
-               return ++position;
+               return insert_item(position, newi);
        }
        void insert(iterator position, size_type n, const value_type& val) {
                for( size_type i = 0; i < n; i ++ )
@@ -142,8 +146,8 @@ public:
                if( position == end() ) {
                }
                else {
-                       item_type *oldi = position.cur;
-                       position ++;
+                       item_type *oldi = position.m_cur;
+                       ++ position;
                        
                        if(oldi->prev)
                                oldi->prev->next = oldi->next;
@@ -153,7 +157,8 @@ public:
                                oldi->next->prev = oldi->prev;
                        else
                                m_end = oldi->prev;
-                       
+
+                       m_item_count --;
                        m_allocator.destroy(&oldi->value);
                        m_item_allocator.deallocate(oldi, 1);
                }
@@ -166,6 +171,39 @@ public:
                        m_start = m_start->next;
                        delete item;
                }
+               m_item_count = 0;
+       }
+private:
+       iterator insert_item(iterator position, item_type *newi) {
+               m_item_count ++;
+               if( m_start == 0 ) {
+                       newi->next = 0;
+                       newi->prev = m_end;
+                       m_start = newi;
+                       m_end = newi;
+                       return end();
+               }
+               if( position == end() ) {
+                       newi->next = 0;
+                       newi->prev = m_end;
+                       //assert(m_end);
+                       m_end->next = newi;
+                       m_end = newi;
+               }
+               else if( position == begin() ) {
+                       newi->next = m_start;
+                       newi->prev = 0;
+                       //assert(m_start);
+                       m_start->prev = newi;
+                       m_start = newi;
+               }
+               else {
+                       newi->prev = position.m_cur->prev;
+                       newi->next = position.m_cur;
+                       position.m_cur->prev->next = newi;
+                       position.m_cur->prev = newi;
+               }
+               return ++position;
        }
 };
 
@@ -181,38 +219,57 @@ struct list_item
        value_type      value;
 };
 
-template <class T, class Alloc>
+template <class ListType, class T>
 class list_iterator//:
        //public bidirectional_iterator_tag;
 {
-       list_item<T>    *cur;
-       friend class ::std::list<T, Alloc>;
+       const ListType* m_list;
+       list_item<T>    *m_cur;
+       friend ListType;
 public:
+       list_iterator(const list_iterator& x):
+               m_list(x.m_list),
+               m_cur (x.m_cur)
+       {
+       }
+       list_iterator& operator=(const list_iterator& x) {
+               m_list = x.m_list;
+               m_cur  = x.m_cur;
+       }
+       
        bool operator == (const list_iterator& other) const {
-               return cur == other.cur;
+               return m_cur == other.m_cur;
        }
        bool operator != (const list_iterator& other) const {
-               return cur != other.cur;
+               return !(*this == other);
        }
        
        T& operator * () {
-               return cur->value;
+               return m_cur->value;
        }
        T& operator -> () {
-               return cur->value;
+               return m_cur->value;
        }
        list_iterator& operator ++ () {
-               cur = cur->next;
+               if(!m_cur)
+                       throw ::std::logic_error("list iterator ++ on end");
+               m_cur = m_cur->next;
                return *this;
        }
        list_iterator& operator -- () {
-               cur = cur->prev;
+               if( m_cur == m_list->m_start )
+                       throw ::std::logic_error("list iterator -- on start");
+               if(!m_cur)
+                       m_cur = m_list->m_end;
+               else
+                       m_cur = m_cur->prev;
                return *this;
        }
-
+       
 private:
-       list_iterator(list_item<T> *item):
-               cur(item)
+       list_iterator(const ListType& list, list_item<T> *item):
+               m_list(&list),
+               m_cur(item)
        {
        }
 };
index aea1afd..aa7072b 100644 (file)
@@ -33,6 +33,13 @@ public:
        explicit out_of_range(const string& what_arg);
 };
 
+class length_error:
+       public logic_error
+{
+public:
+       explicit length_error(const string& what_arg);
+};
+
 };     // namespace std
 
 #endif
index ec08bee..e9a8847 100644 (file)
@@ -8,7 +8,9 @@
 #ifndef _LIBCXX_SYSTEM_ERROR_
 #define _LIBCXX_SYSTEM_ERROR_
 
-#if __cplusplus <= 199711L     // C++11 check
+#include "_libcxx_helpers.h"
+
+#if !_CXX11_AVAIL
 # error "This header requires C++11 support enabled"
 #endif
 
@@ -20,13 +22,13 @@ class error_category;
 class error_condition;
 class error_code;
 
-bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
-bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
-bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept;
-bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
-bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
-bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
-bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
+static bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
+static bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
+static bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept;
+static bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
+static bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
+static bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
+static bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
 
 extern const error_category&   generic_category() noexcept;
 extern const error_category&   system_category() noexcept;
@@ -154,25 +156,25 @@ public:
        const char* what() const noexcept;
 };
 
-bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept {
+static inline bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept {
        return lhs.category() == rhs.category() && lhs.value() == rhs.value();
 }
-bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept {
+static inline bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept {
        return !(lhs == rhs);
 }
-bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept {
+static inline bool operator< (const error_condition& lhs, const error_condition& rhs) noexcept {
        return lhs.category() < rhs.category() || lhs.value() < rhs.value();
 }
-bool operator==(const error_condition& lhs, const error_code& rhs) noexcept {
+static inline bool operator==(const error_condition& lhs, const error_code& rhs) noexcept {
        return lhs.category().equivalent(rhs, lhs.value()) || rhs.category().equivalent(rhs.value(), lhs);
 }
-bool operator==(const error_code& lhs, const error_condition& rhs) noexcept {
+static inline bool operator==(const error_code& lhs, const error_condition& rhs) noexcept {
        return lhs.category().equivalent(lhs.value(),rhs) || rhs.category().equivalent(lhs,rhs.value());
 }
-bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept {
+static inline bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept {
        return !(lhs == rhs);
 }
-bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept {
+static inline bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept {
        return !(lhs == rhs);
 }
 
diff --git a/Usermode/Libraries/libc++.so_src/include_exp/type_traits b/Usermode/Libraries/libc++.so_src/include_exp/type_traits
new file mode 100644 (file)
index 0000000..62103ac
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Acess2 C++ Library
+ * - By John Hodge (thePowersGang)
+ *
+ * type_traits (header)
+ * - C++11 type traits
+ */
+#ifndef _LIBCXX_TYPE_TRAITS_
+#define _LIBCXX_TYPE_TRAITS_
+
+#include "_libcxx_helpers.h"
+
+#if !_CXX11_AVAIL
+# error "This header requires C++11 support enabled"
+#endif
+
+template <class T> struct remove_reference     { typedef T     type; };
+template <class T> struct remove_reference<T&> { typedef T     type; };
+template <class T> struct remove_reference<T&&>        { typedef T     type; };
+
+#endif
+
+// vim: ft=cpp
+
index 6f05744..9b7957c 100644 (file)
@@ -8,6 +8,9 @@
 #ifndef _LIBCXX_UTILITY_
 #define _LIBCXX_UTILITY_
 
+#include "_libcxx_helpers.h"
+#include "type_traits"
+
 namespace std {
 
 template <class T1, class T2>
@@ -46,6 +49,17 @@ bool operator!= (const pair<T1,T2>& lhs, const pair<T1,T2>& rhs) {
        return !(lhs == rhs);
 }
 
+#if _CXX11_AVAIL
+template <class T>
+T&& forward(typename remove_reference<T>::type& arg) noexcept {
+       return static_cast<decltype(arg)&&>(arg);
+}
+template <class T>
+T&& forward(typename remove_reference<T>::type&& arg) noexcept {
+       return static_cast<decltype(arg)&&>(arg);
+}
+#endif
+
 };     // namespace std
 
 #endif
index 870c49b..30bd207 100644 (file)
@@ -9,6 +9,9 @@
 #define _LIBCXX_VECTOR_
 
 #include <allocator>
+#include <stdexcept>
+
+extern "C" void _SysDebug(const char *, ...);
 
 namespace std {
 
@@ -44,7 +47,7 @@ public:
                return *this;
        }
        bool operator==(const vector_iterator& other) const {
-               return m_array == other.m_array && m_pos == other.m_pos;
+               return m_pos == other.m_pos;
        }
        bool operator!=(const vector_iterator& other) const {
                return !(*this == other);
@@ -102,7 +105,7 @@ public:
        vector(size_type n, const value_type& val = value_type(), const allocator_type& alloc = allocator_type()):
                vector(alloc)
        {
-               
+               resize(n, val);
        }
        vector(const vector& x):
                vector(x.m_alloc)
@@ -159,8 +162,19 @@ public:
                return m_size == 0;
        }
        void reserve(size_type n) {
-               //if( n > max_size() )
-               //      throw ::std::length_error();
+               if( n > max_size() )
+                       throw ::std::length_error("::std::vector::reserve");
+               if( n > m_capacity )
+               {
+                       size_type size = (n + 0x1F) & ~0x1F;
+                       auto new_area = m_alloc.allocate(size);
+                       for( size_type i = 0; i < m_size; i ++ )
+                               new_area[i] = m_data[i];
+                       m_alloc.deallocate(m_data, m_capacity);
+                       m_data = new_area;
+                       m_capacity = size;
+                       //::_SysDebug("::std::vector::resize - m_capacity=%i for n=%i", m_capacity, n);
+               }
        }
        void shrink_to_fit() {
        }
index ed0a2eb..8daa7d4 100644 (file)
@@ -9,6 +9,8 @@
 
 extern "C" int SoMain()
 {
+       //extern void _init();
+       //_init();
        // nope
        return 0;
 }
index f2b2458..9dae853 100644 (file)
@@ -7,24 +7,29 @@
  */
 #include <stddef.h>
 #include <stdlib.h>
+#include <acess/sys.h>
 
 // === CODE ===
 void *operator new( size_t size )
 {
+       //_SysDebug("libc++ - operator new(%i)", size);
        return malloc( size );
 }
 void *operator new( size_t size, void* ptr )
 {
+       //_SysDebug("libc++ - operator new(%i, %p)", size, ptr);
        size = size;
        return ptr;
 }
 
 void *operator new[]( size_t size )
 {
+       //_SysDebug("libc++ - operator new[](%i)", size);
        return malloc( size );
 }
 void *operator new[]( size_t size, void* ptr )
 {
+       //_SysDebug("libc++ - operator new[](%i, %p)", size, ptr);
        size = size;
        return ptr;
 }
index b0a9b3e..c7cb5bc 100644 (file)
@@ -6,6 +6,7 @@
  * - typeid and dynamic_cast
  */
 #include <typeinfo>
+#include <acess/sys.h>
 
 namespace std {
 
@@ -16,16 +17,19 @@ type_info::~type_info()
 
 bool type_info::operator==(const type_info& other) const
 {
+       _SysDebug("type_info::operator== - '%s' == '%s'", this->__type_name, other.__type_name);
        return this->__type_name == other.__type_name;
 }
 
 bool type_info::operator!=(const type_info& other) const
 {
+       _SysDebug("type_info::operator!= - '%s' != '%s'", this->__type_name, other.__type_name);
        return this->__type_name != other.__type_name;
 }
 
 bool type_info::before(const type_info& other) const
 {
+       _SysDebug("type_info::before - '%s' < '%s'", this->__type_name, other.__type_name);
        return this->__type_name < other.__type_name;
 }
 
@@ -47,4 +51,3 @@ type_info& type_info::operator=(const type_info& rhs)
 
 
 };     // namespace std
-

UCC git Repository :: git.ucc.asn.au