mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 19:55:32 +00:00
gstinfo: Rework stack trace detection a bit
Ensure that the code paths for HAVE_UNWIND and HAVE_DBGHELP are never taken at the same time, even if the build file code changes. Prefer DbgHelp over libunwind on Windows in case both are somehow available because DbgHelp is only available when building with the MSVC toolchain, and libunwind won't give us debug symbols from objects built with the MSVC toolchain. Also, print slightly more useful messages for the level of stack trace support enabled, and document what each if conditional does.
This commit is contained in:
parent
145f8546c4
commit
4ba6898f24
2 changed files with 21 additions and 10 deletions
|
@ -2906,9 +2906,7 @@ gst_debug_get_stack_trace (GstStackTraceFlags flags)
|
|||
#ifdef HAVE_UNWIND
|
||||
if ((flags & GST_STACK_TRACE_SHOW_FULL) || !have_backtrace)
|
||||
trace = generate_unwind_trace (flags);
|
||||
#endif /* HAVE_UNWIND */
|
||||
|
||||
#ifdef HAVE_DBGHELP
|
||||
#elif defined(HAVE_DBGHELP)
|
||||
trace = generate_dbghelp_trace ();
|
||||
#endif
|
||||
|
||||
|
|
27
meson.build
27
meson.build
|
@ -350,19 +350,32 @@ unwind_dep = dependency('libunwind', required : get_option('libunwind'))
|
|||
dw_dep = dependency('libdw', required: get_option('libdw'))
|
||||
dbghelp_dep = dependency('DbgHelp', required : get_option('dbghelp'))
|
||||
backtrace_deps = [unwind_dep, dw_dep, dbghelp_dep]
|
||||
if unwind_dep.found()
|
||||
backtrace_source_info = false
|
||||
backtrace_minimal = false
|
||||
# MSVC debug stack trace support
|
||||
if host_system == 'windows' and dbghelp_dep.found()
|
||||
cdata.set('HAVE_DBGHELP', 1)
|
||||
backtrace_source_info = true
|
||||
# DWARF stack trace support with libunwind and elf-utils
|
||||
elif unwind_dep.found()
|
||||
cdata.set('HAVE_UNWIND', 1)
|
||||
if dw_dep.found()
|
||||
cdata.set('HAVE_DW', 1)
|
||||
else
|
||||
message('Support for backtraces is partial only.')
|
||||
backtrace_source_info = true
|
||||
endif
|
||||
backtrace_minimal = true
|
||||
# Basic backtrace() stack trace support
|
||||
elif cc.has_function('backtrace')
|
||||
cdata.set('HAVE_BACKTRACE', 1)
|
||||
elif dbghelp_dep.found()
|
||||
cdata.set('HAVE_DBGHELP', 1)
|
||||
else
|
||||
message('NO backtraces support.')
|
||||
backtrace_minimal = true
|
||||
endif
|
||||
# Print messages about what was enabled
|
||||
if not backtrace_source_info
|
||||
if not backtrace_minimal
|
||||
message('NO support for stack traces.')
|
||||
else
|
||||
message('Minimal support for stack traces, no source info.')
|
||||
endif
|
||||
endif
|
||||
|
||||
if cc.has_header('execinfo.h')
|
||||
|
|
Loading…
Reference in a new issue