C++ Runtime ((better)) May 2026

main → foo() → bar() → throw MyException(); → __cxa_throw (sets unwind info, calls _Unwind_RaiseException) → _Unwind_RaiseException → _Unwind_RaiseException_Phase1 (walks .eh_frame) → _Unwind_RaiseException_Phase2 (calls personality, destructors) → __gxx_personality_v0 (calls destructors of locals in bar, foo) → land on catch in main On Linux: readelf -S a.out (look for .init_array , .eh_frame , .gcc_except_table ) On Windows: dumpbin /HEADERS myapp.exe (look for .pdata for x64 exception tables) This report is based on the Itanium C++ ABI (version 1.2), Microsoft C++ ABI (x64), and publicly available documentation for GCC 13, Clang 17, and MSVC 2022.

:

// Constructor function for global std::string _GLOBAL__sub_I_example.cpp: stp x29, x30, [sp, -32]! mov x0, :got:globalString bl _ZNSt7__cxx1112basic_string...C1E... // std::string::string(char const*) ldr x0, :got:__dso_handle adrp x1, :got:_ZNSt7__cxx1112basic_string...D1E... add x1, x1, :lo12:_ZNSt7__cxx1112...D1E... bl __cxa_atexit // register destructor for atexit ldp x29, x30, [sp], 32 ret // .init_array entry points to this function c++ runtime

static Logger& getLogger() static Logger instance; // thread‑safe initialization return instance; main → foo() → bar() → throw MyException();

(simplified for a class hierarchy A <- B ): // std::string::string(char const*) ldr x0

| Component | Responsibility | Typical Implementation | |-----------|----------------|------------------------| | | Program startup, atoi , printf , heap base (malloc/free) | libc.so / msvcrt.dll | | C++ ABI Runtime | Constructor/destructor calling conventions, RTTI structures, exception personality routines | libstdc++ (GCC), libc++abi (LLVM), msvcrt + VCRuntime (MSVC) | | C++ Standard Library Runtime | std::vector , std::string , std::cout , std::thread | libstdc++.so , libc++.so , MSVC STL | | Language Support Library | new / delete operators, __cxa_* exception APIs, __gxx_personality_v0 | Part of ABI runtime | | Compiler‑Generated Helpers | Thunk functions for virtual calls, dynamic cast helpers, guard variables for static locals | Injected by compiler (e.g., __cxa_guard_acquire ) |

vtable for B: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for B [2] A::foo() thunk (if overriding) vtable for A: [0] offset_to_top = 0 [1] typeinfo pointer -> typeinfo for A

1 a 16,99 - 2 a 25,00 €Esaurito
X