Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1007aab

Browse files
authored
gh-127604: Allow faulthandler to dumpC stack on MacOS (#132841)
1 parentc9bc458 commit1007aab

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

‎Python/traceback.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,24 @@
1818
#ifdefHAVE_UNISTD_H
1919
# include<unistd.h>// lseek()
2020
#endif
21-
#if defined(HAVE_EXECINFO_H)&& defined(HAVE_DLFCN_H)&& defined(HAVE_LINK_H)
21+
22+
#if (defined(HAVE_EXECINFO_H)&& defined(HAVE_DLFCN_H)&& defined(HAVE_LINK_H))
23+
# define_PY_HAS_BACKTRACE_HEADERS 1
24+
#endif
25+
26+
#if (defined(__APPLE__)&& defined(HAVE_EXECINFO_H)&& defined(HAVE_DLFCN_H))
27+
# define_PY_HAS_BACKTRACE_HEADERS 1
28+
#endif
29+
30+
#ifdef_PY_HAS_BACKTRACE_HEADERS
2231
# include<execinfo.h>// backtrace(), backtrace_symbols()
2332
# include<dlfcn.h>// dladdr1()
24-
# include<link.h>// struct DL_info
25-
# if defined(HAVE_BACKTRACE)&& defined(HAVE_BACKTRACE_SYMBOLS)&& defined(HAVE_DLADDR1)
33+
#ifdefHAVE_LINK_H
34+
# include<link.h>// struct DL_info
35+
#endif
36+
# if defined(__APPLE__)&& defined(HAVE_BACKTRACE)&& defined(HAVE_BACKTRACE_SYMBOLS)&& defined(HAVE_DLADDR)
37+
# defineCAN_C_BACKTRACE
38+
# elif defined(HAVE_BACKTRACE)&& defined(HAVE_BACKTRACE_SYMBOLS)&& defined(HAVE_DLADDR1)
2639
# defineCAN_C_BACKTRACE
2740
# endif
2841
#endif
@@ -1193,6 +1206,9 @@ _Py_backtrace_symbols_fd(int fd, void *const *array, Py_ssize_t size)
11931206
VLA(int,status,size);
11941207
/* Fill in the information we can get from dladdr() */
11951208
for (Py_ssize_ti=0;i<size;++i) {
1209+
#ifdef__APPLE__
1210+
status[i]=dladdr(array[i],&info[i]);
1211+
#else
11961212
structlink_map*map;
11971213
status[i]=dladdr1(array[i],&info[i], (void**)&map,RTLD_DL_LINKMAP);
11981214
if (status[i]!=0
@@ -1204,6 +1220,7 @@ _Py_backtrace_symbols_fd(int fd, void *const *array, Py_ssize_t size)
12041220
something we want to subtract out */
12051221
info[i].dli_fbase= (void*)map->l_addr;
12061222
}
1223+
#endif
12071224
}
12081225
for (Py_ssize_ti=0;i<size;++i) {
12091226
if (status[i]==0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp