Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

druntime: remove libunwind dependency and make execinfo optional (LDC upstream) #20758

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion druntime/mak/COPY
Original file line number Diff line number Diff line change
@@ -62,7 +62,6 @@ COPY=\
\
$(IMPDIR)\core\internal\backtrace\dwarf.d \
$(IMPDIR)\core\internal\backtrace\elf.d \
$(IMPDIR)\core\internal\backtrace\handler.d \
$(IMPDIR)\core\internal\backtrace\libunwind.d \
$(IMPDIR)\core\internal\backtrace\macho.d \
$(IMPDIR)\core\internal\backtrace\unwind.d \
1 change: 0 additions & 1 deletion druntime/mak/DOCS
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ DOCS=\
\
$(DOCDIR)\core_internal_backtrace_dwarf.html \
$(DOCDIR)\core_internal_backtrace_elf.html \
$(DOCDIR)\core_internal_backtrace_handler.html \
$(DOCDIR)\core_internal_backtrace_libunwind.html \
$(DOCDIR)\core_internal_backtrace_macho.html \
$(DOCDIR)\core_internal_backtrace_unwind.html \
1 change: 0 additions & 1 deletion druntime/mak/SRCS
Original file line number Diff line number Diff line change
@@ -60,7 +60,6 @@ SRCS=\
\
src\core\internal\backtrace\dwarf.d \
src\core\internal\backtrace\elf.d \
src\core\internal\backtrace\handler.d \
src\core\internal\backtrace\libunwind.d \
src\core\internal\backtrace\macho.d \
src\core\internal\backtrace\unwind.d \
5 changes: 2 additions & 3 deletions druntime/src/core/internal/backtrace/dwarf.d
Original file line number Diff line number Diff line change
@@ -49,11 +49,10 @@

module core.internal.backtrace.dwarf;

import core.internal.execinfo;
import core.internal.string;

version (Posix):

import core.internal.string;

version (OSX)
version = Darwin;
else version (iOS)
137 changes: 0 additions & 137 deletions druntime/src/core/internal/backtrace/handler.d

This file was deleted.

9 changes: 9 additions & 0 deletions druntime/src/core/internal/backtrace/libunwind.d
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ nothrow:
* Bindings for libunwind.h
*/
alias unw_word_t = uintptr_t;
alias unw_regnum_t = int;

///
struct unw_context_t
@@ -86,6 +87,14 @@ int unw_step(unw_cursor_t*);
int unw_get_proc_info(unw_cursor_t*, unw_proc_info_t*);
/// Get the name of the current procedure (function)
int unw_get_proc_name(unw_cursor_t*, char*, size_t, unw_word_t*);
/// Reads the value of register `reg` in the stack frame identified by cursor `cp` and stores the value in the word pointed to by `valp`.
int unw_get_reg(unw_cursor_t* cp, unw_regnum_t reg, unw_word_t* valp);
/// Architecture independent register numbers
enum
{
UNW_REG_IP = -1, // instruction pointer
UNW_REG_SP = -2, // stack pointer
}

private:

22 changes: 11 additions & 11 deletions druntime/src/core/internal/backtrace/unwind.d
Original file line number Diff line number Diff line change
@@ -147,24 +147,24 @@ alias _Unwind_Trace_Fn = _Unwind_Reason_Code function(_Unwind_Context*, void*);
void _Unwind_DeleteException(_Unwind_Exception* exception_object);
void _Unwind_Resume(_Unwind_Exception* exception_object);
_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception* exception_object);
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void*);
_Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void*) nothrow;

version (ARM_EABI_UNWINDER)
{
_Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception* exception_object, _Unwind_Context* context);
void _Unwind_Complete(_Unwind_Exception* exception_object);
}

_Unwind_Word _Unwind_GetGR(_Unwind_Context* context, int index);
void _Unwind_SetGR(_Unwind_Context* context, int index, _Unwind_Word new_value);
_Unwind_Ptr _Unwind_GetIP(_Unwind_Context* context);
_Unwind_Ptr _Unwind_GetIPInfo(_Unwind_Context* context, int*);
void _Unwind_SetIP(_Unwind_Context* context, _Unwind_Ptr new_value);
_Unwind_Word _Unwind_GetCFA(_Unwind_Context*);
_Unwind_Word _Unwind_GetBSP(_Unwind_Context*);
void* _Unwind_GetLanguageSpecificData(_Unwind_Context*);
_Unwind_Ptr _Unwind_GetRegionStart(_Unwind_Context* context);
void* _Unwind_FindEnclosingFunction(void* pc);
_Unwind_Word _Unwind_GetGR(_Unwind_Context* context, int index) nothrow;
void _Unwind_SetGR(_Unwind_Context* context, int index, _Unwind_Word new_value) nothrow;
_Unwind_Ptr _Unwind_GetIP(_Unwind_Context* context) nothrow;
_Unwind_Ptr _Unwind_GetIPInfo(_Unwind_Context* context, int*) nothrow;
void _Unwind_SetIP(_Unwind_Context* context, _Unwind_Ptr new_value) nothrow;
_Unwind_Word _Unwind_GetCFA(_Unwind_Context*) nothrow;
_Unwind_Word _Unwind_GetBSP(_Unwind_Context*) nothrow;
void* _Unwind_GetLanguageSpecificData(_Unwind_Context*) nothrow;
_Unwind_Ptr _Unwind_GetRegionStart(_Unwind_Context* context) nothrow;
void* _Unwind_FindEnclosingFunction(void* pc) nothrow;

version (X86_64)
{
Loading