Skip to content

BUG: Support using libunwind for backtrack #22152

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

Merged
merged 1 commit into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion numpy/core/setup_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def set_sig(sig):
"immintrin.h", # AVX
"features.h", # for glibc version linux
"xlocale.h", # see GH#8367
"dlfcn.h", # dladdr
"dlfcn.h", # dladdr
"execinfo.h", # backtrace
"libunwind.h", # backtrace for LLVM/Clang using libunwind
"sys/mman.h", #madvise
]

Expand Down
5 changes: 5 additions & 0 deletions numpy/core/src/multiarray/temp_elide.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@
#define NPY_MIN_ELIDE_BYTES (32)
#endif
#include <dlfcn.h>

#if defined HAVE_EXECINFO_H
#include <execinfo.h>
#elif defined HAVE_LIBUNWIND_H
#include <libunwind.h>
#endif
Copy link
Member

@seberg seberg Aug 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this makes sense to me now, although if neither is found, I guess the whole thing should be disabled (which is on line 61)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, HAVE_BACKTRACE should disabled those include if backtrack() not found. Unless new backtracking library showed up, which should throw an error to notice devs.


/*
* linear search pointer in table
Expand Down
4 changes: 4 additions & 0 deletions numpy/linalg/umath_linalg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ using dispatch_scalar = typename std::conditional<std::is_scalar<typ>::value, sc
} while (0)

#if 0
#if defined HAVE_EXECINFO_H
#include <execinfo.h>
#elif defined HAVE_LIBUNWIND_H
#include <libunwind.h>
#endif
void
dbg_stack_trace()
{
Expand Down