Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
4e548e73
Commit
4e548e73
authored
Feb 18, 2020
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libbacktrace: add preliminary Mach-O support
parent
929d6205
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
7 deletions
+159
-7
Makefile.am
Makefile.am
+65
-3
Makefile.in
Makefile.in
+0
-0
config.h.in
config.h.in
+3
-0
configure
configure
+75
-3
configure.ac
configure.ac
+10
-0
filetype.awk
filetype.awk
+6
-1
macho.c
macho.c
+0
-0
No files found.
Makefile.am
View file @
4e548e73
...
...
@@ -57,6 +57,7 @@ BACKTRACE_FILES = \
FORMAT_FILES
=
\
elf.c
\
macho.c
\
pecoff.c
\
unknown.c
\
xcoff.c
...
...
@@ -85,18 +86,28 @@ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
# Testsuite.
# Add
test to this variable, if you want it to be build
.
# Add
a test to this variable if you want it to be built
.
check_PROGRAMS
=
# Add
test to this variable,
if you want it to be run.
# Add
a test to this variable
if you want it to be run.
TESTS
=
# Add
test to this variable, if you want it to be build
and run.
# Add
a test to this variable if you want it to be built
and run.
BUILDTESTS
=
# Add a file to this variable if you want it to be built for testing.
check_DATA
=
# Flags to use when compiling test programs.
libbacktrace_TEST_CFLAGS
=
$(EXTRA_FLAGS)
$(WARN_FLAGS)
-g
if
HAVE_DSYMUTIL
%.dSYM
:
%
$(DSYMUTIL)
$<
endif
HAVE_DSYMUTIL
if
NATIVE
check_LTLIBRARIES
=
libbacktrace_alloc.la
...
...
@@ -164,6 +175,12 @@ test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo
BUILDTESTS
+=
test_elf_64
test_macho_SOURCES
=
test_format.c testlib.c
test_macho_CFLAGS
=
$(libbacktrace_TEST_CFLAGS)
test_macho_LDADD
=
libbacktrace_noformat.la macho.lo
BUILDTESTS
+=
test_macho
test_xcoff_32_SOURCES
=
test_format.c testlib.c
test_xcoff_32_CFLAGS
=
$(libbacktrace_TEST_CFLAGS)
test_xcoff_32_LDADD
=
libbacktrace_noformat.la xcoff_32.lo
...
...
@@ -221,6 +238,10 @@ allocfail.sh: allocfail
TESTS
+=
allocfail.sh
if
HAVE_DSYMUTIL
check_DATA
+=
allocfail.dSYM
endif
HAVE_DSYMUTIL
if
HAVE_ELF
if
HAVE_OBJCOPY_DEBUGLINK
...
...
@@ -253,6 +274,10 @@ btest_LDADD = libbacktrace.la
BUILDTESTS
+=
btest
if
HAVE_DSYMUTIL
check_DATA
+=
btest.dSYM
endif
HAVE_DSYMUTIL
if
HAVE_ELF
btest_lto_SOURCES
=
btest.c testlib.c
...
...
@@ -269,6 +294,10 @@ btest_alloc_LDADD = libbacktrace_alloc.la
BUILDTESTS
+=
btest_alloc
if
HAVE_DSYMUTIL
check_DATA
+=
btest_alloc.dSYM
endif
HAVE_DSYMUTIL
if
HAVE_DWZ
%_dwz
:
%
...
...
@@ -295,12 +324,20 @@ stest_LDADD = libbacktrace.la
BUILDTESTS
+=
stest
if
HAVE_DSYMUTIL
check_DATA
+=
stest.dSYM
endif
HAVE_DSYMUTIL
stest_alloc_SOURCES
=
$(stest_SOURCES)
stest_alloc_CFLAGS
=
$(libbacktrace_TEST_CFLAGS)
stest_alloc_LDADD
=
libbacktrace_alloc.la
BUILDTESTS
+=
stest_alloc
if
HAVE_DSYMUTIL
check_DATA
+=
stest_alloc.dSYM
endif
HAVE_DSYMUTIL
if
HAVE_ELF
ztest_SOURCES
=
ztest.c testlib.c
...
...
@@ -330,10 +367,18 @@ edtest_LDADD = libbacktrace.la
BUILDTESTS
+=
edtest
if
HAVE_DSYMUTIL
check_DATA
+=
edtest.dSYM
endif
HAVE_DSYMUTIL
edtest_alloc_SOURCES
=
$(edtest_SOURCES)
edtest_alloc_CFLAGS
=
$(libbacktrace_TEST_CFLAGS)
edtest_alloc_LDADD
=
libbacktrace_alloc.la
if
HAVE_DSYMUTIL
check_DATA
+=
edtest_alloc.dSYM
endif
HAVE_DSYMUTIL
BUILDTESTS
+=
edtest_alloc
edtest2_build.c
:
gen_edtest2_build; @true
...
...
@@ -350,12 +395,20 @@ ttest_SOURCES = ttest.c testlib.c
ttest_CFLAGS
=
$(libbacktrace_TEST_CFLAGS)
-pthread
ttest_LDADD
=
libbacktrace.la
if
HAVE_DSYMUTIL
check_DATA
+=
ttest.dSYM
endif
HAVE_DSYMUTIL
BUILDTESTS
+=
ttest_alloc
ttest_alloc_SOURCES
=
$(ttest_SOURCES)
ttest_alloc_CFLAGS
=
$(ttest_CFLAGS)
ttest_alloc_LDADD
=
libbacktrace_alloc.la
if
HAVE_DSYMUTIL
check_DATA
+=
ttest_alloc.dSYM
endif
HAVE_DSYMUTIL
endif
HAVE_PTHREAD
if
HAVE_OBJCOPY_DEBUGLINK
...
...
@@ -410,12 +463,20 @@ dwarf5_LDADD = libbacktrace.la
BUILDTESTS
+=
dwarf5
if
HAVE_DSYMUTIL
check_DATA
+=
dwarf5.dSYM
endif
HAVE_DSYMUTIL
dwarf5_alloc_SOURCES
=
$(dwarf5_SOURCES)
dwarf5_alloc_CFLAGS
=
$(dwarf5_CFLAGS)
dwarf5_alloc_LDADD
=
libbacktrace_alloc.la
BUILDTESTS
+=
dwarf5_alloc
if
HAVE_DSYMUTIL
check_DATA
+=
dwarf5_alloc.dSYM
endif
HAVE_DSYMUTIL
endif
endif
NATIVE
...
...
@@ -447,6 +508,7 @@ btest.lo: filenames.h backtrace.h backtrace-supported.h
dwarf.lo
:
config.h filenames.h backtrace.h internal.h
elf.lo
:
config.h backtrace.h internal.h
fileline.lo
:
config.h backtrace.h internal.h
macho.lo
:
config.h backtrace.h internal.h
mmap.lo
:
config.h backtrace.h internal.h
mmapio.lo
:
config.h backtrace.h internal.h
nounwind.lo
:
config.h internal.h
...
...
Makefile.in
View file @
4e548e73
This diff is collapsed.
Click to expand it.
config.h.in
View file @
4e548e73
...
...
@@ -51,6 +51,9 @@
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define to 1 if you have the <mach-o/dyld.h> header file. */
#undef HAVE_MACH_O_DYLD_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
...
...
configure
View file @
4e548e73
...
...
@@ -635,6 +635,8 @@ LTLIBOBJS
LIBOBJS
NATIVE_FALSE
NATIVE_TRUE
HAVE_DSYMUTIL_FALSE
HAVE_DSYMUTIL_TRUE
HAVE_OBJCOPY_DEBUGLINK_FALSE
HAVE_OBJCOPY_DEBUGLINK_TRUE
READELF
...
...
@@ -799,7 +801,8 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
OBJCOPY'
OBJCOPY
DSYMUTIL'
# Initialize some variables set by options.
...
...
@@ -1452,6 +1455,7 @@ Some influential environment variables:
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
OBJCOPY location of objcopy
DSYMUTIL location of dsymutil
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
...
...
@@ -11265,7 +11269,7 @@ else
lt_dlunknown
=
0
;
lt_dlno_uscore
=
1
;
lt_dlneed_uscore
=
2
lt_status
=
$lt_dlunknown
cat
>
conftest.
$ac_ext
<<
_LT_EOF
#line 112
68
"configure"
#line 112
72
"configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
...
...
@@ -11371,7 +11375,7 @@ else
lt_dlunknown
=
0
;
lt_dlno_uscore
=
1
;
lt_dlneed_uscore
=
2
lt_status
=
$lt_dlunknown
cat
>
conftest.
$ac_ext
<<
_LT_EOF
#line 1137
4
"configure"
#line 1137
8
"configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
...
...
@@ -12176,6 +12180,7 @@ FORMAT_FILE=
backtrace_supports_data
=
yes
case
"
$libbacktrace_cv_sys_filetype
"
in
elf
*
)
FORMAT_FILE
=
"elf.lo"
;;
macho
)
FORMAT_FILE
=
"macho.lo"
;;
pecoff
)
FORMAT_FILE
=
"pecoff.lo"
backtrace_supports_data
=
no
;;
...
...
@@ -12355,6 +12360,20 @@ $as_echo "#define HAVE_DL_ITERATE_PHDR 1" >>confdefs.h
fi
# Check for header file for Mach-O image functions.
for
ac_header
in
mach-o/dyld.h
do
:
ac_fn_c_check_header_mongrel
"
$LINENO
"
"mach-o/dyld.h"
"ac_cv_header_mach_o_dyld_h"
"
$ac_includes_default
"
if
test
"x
$ac_cv_header_mach_o_dyld_h
"
=
xyes
;
then
:
cat
>>
confdefs.h
<<
_ACEOF
#define HAVE_MACH_O_DYLD_H 1
_ACEOF
fi
done
# Check for loadquery.
for
ac_header
in
sys/ldr.h
do
:
...
...
@@ -12840,6 +12859,8 @@ if ${libbacktrace_cv_objcopy_debuglink+:} false; then :
else
if
test
-n
"
${
with_target_subdir
}
"
;
then
libbacktrace_cv_objcopy_debuglink
=
no
elif
!
test
-n
"
${
OBJCOPY
}
"
;
then
libbacktrace_cv_objcopy_debuglink
=
no
elif
${
OBJCOPY
}
--add-gnu-debuglink
=
x /bin/ls /tmp/ls
$$
;
then
rm
-f
/tmp/ls
$$
libbacktrace_cv_objcopy_debuglink
=
yes
...
...
@@ -12858,6 +12879,53 @@ else
fi
# Extract the first word of "dsymutil", so it can be a program name with args.
set
dummy dsymutil
;
ac_word
=
$2
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for
$ac_word
"
>
&5
$as_echo_n
"checking for
$ac_word
... "
>
&6
;
}
if
${
ac_cv_prog_DSYMUTIL
+
:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
if
test
-n
"
$DSYMUTIL
"
;
then
ac_cv_prog_DSYMUTIL
=
"
$DSYMUTIL
"
# Let the user override the test.
else
as_save_IFS
=
$IFS
;
IFS
=
$PATH_SEPARATOR
for
as_dir
in
$PATH
do
IFS
=
$as_save_IFS
test
-z
"
$as_dir
"
&&
as_dir
=
.
for
ac_exec_ext
in
''
$ac_executable_extensions
;
do
if
as_fn_executable_p
"
$as_dir
/
$ac_word$ac_exec_ext
"
;
then
ac_cv_prog_DSYMUTIL
=
"dsymutil"
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: found
$as_dir
/
$ac_word$ac_exec_ext
"
>
&5
break
2
fi
done
done
IFS
=
$as_save_IFS
fi
fi
DSYMUTIL
=
$ac_cv_prog_DSYMUTIL
if
test
-n
"
$DSYMUTIL
"
;
then
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$DSYMUTIL
"
>
&5
$as_echo
"
$DSYMUTIL
"
>
&6
;
}
else
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result: no"
>
&5
$as_echo
"no"
>
&6
;
}
fi
if
test
-n
"
${
DSYMUTIL
}
"
;
then
HAVE_DSYMUTIL_TRUE
=
HAVE_DSYMUTIL_FALSE
=
'#'
else
HAVE_DSYMUTIL_TRUE
=
'#'
HAVE_DSYMUTIL_FALSE
=
fi
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking whether tests can run"
>
&5
$as_echo_n
"checking whether tests can run... "
>
&6
;
}
if
${
libbacktrace_cv_sys_native
+
:
}
false
;
then
:
...
...
@@ -13070,6 +13138,10 @@ if test -z "${HAVE_OBJCOPY_DEBUGLINK_TRUE}" && test -z "${HAVE_OBJCOPY_DEBUGLINK
as_fn_error
$?
"conditional
\"
HAVE_OBJCOPY_DEBUGLINK
\"
was never defined.
Usually this means the macro was only invoked conditionally."
"
$LINENO
"
5
fi
if
test
-z
"
${
HAVE_DSYMUTIL_TRUE
}
"
&&
test
-z
"
${
HAVE_DSYMUTIL_FALSE
}
"
;
then
as_fn_error
$?
"conditional
\"
HAVE_DSYMUTIL
\"
was never defined.
Usually this means the macro was only invoked conditionally."
"
$LINENO
"
5
fi
if
test
-z
"
${
NATIVE_TRUE
}
"
&&
test
-z
"
${
NATIVE_FALSE
}
"
;
then
as_fn_error
$?
"conditional
\"
NATIVE
\"
was never defined.
Usually this means the macro was only invoked conditionally."
"
$LINENO
"
5
...
...
configure.ac
View file @
4e548e73
...
...
@@ -238,6 +238,7 @@ FORMAT_FILE=
backtrace_supports_data=yes
case "$libbacktrace_cv_sys_filetype" in
elf*) FORMAT_FILE="elf.lo" ;;
macho) FORMAT_FILE="macho.lo" ;;
pecoff) FORMAT_FILE="pecoff.lo"
backtrace_supports_data=no
;;
...
...
@@ -346,6 +347,9 @@ if test "$have_dl_iterate_phdr" = "yes"; then
AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
fi
# Check for header file for Mach-O image functions.
AC_CHECK_HEADERS(mach-o/dyld.h)
# Check for loadquery.
AC_CHECK_HEADERS(sys/ldr.h)
if test "$ac_cv_header_sys_ldr_h" = "no"; then
...
...
@@ -490,6 +494,8 @@ AC_CACHE_CHECK([whether objcopy supports debuglink],
[libbacktrace_cv_objcopy_debuglink],
[if test -n "${with_target_subdir}"; then
libbacktrace_cv_objcopy_debuglink=no
elif ! test -n "${OBJCOPY}"; then
libbacktrace_cv_objcopy_debuglink=no
elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then
rm -f /tmp/ls$$
libbacktrace_cv_objcopy_debuglink=yes
...
...
@@ -498,6 +504,10 @@ else
fi])
AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
AC_ARG_VAR(DSYMUTIL, [location of dsymutil])
AC_CHECK_PROG(DSYMUTIL, dsymutil, dsymutil)
AM_CONDITIONAL(HAVE_DSYMUTIL, test -n "${DSYMUTIL}")
AC_CACHE_CHECK([whether tests can run],
[libbacktrace_cv_sys_native],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
...
...
filetype.awk
View file @
4e548e73
...
...
@@ -5,4 +5,9 @@
/
\1
44
\2
06/
{
if
(
NR
==
1
)
{
print
"pecoff"
;
exit
}
}
/
\0
01
\3
37/
{
if
(
NR
==
1
)
{
print
"xcoff32"
;
exit
}
}
/
\0
01
\3
67/
{
if
(
NR
==
1
)
{
print
"xcoff64"
;
exit
}
}
/
\3
76
\3
55
\3
72
\3
16/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
/
\3
16
\3
72
\3
55
\3
76/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
/
\3
76
\3
55
\3
72
\3
17/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
/
\3
17
\3
72
\3
55
\3
76/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
/
\3
12
\3
76
\2
72
\2
76/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
/
\2
76
\2
72
\3
76
\3
12/
{
if
(
NR
==
1
)
{
print
"macho"
;
exit
}
}
macho.c
0 → 100644
View file @
4e548e73
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment