diff --git a/.gitmodules b/.gitmodules index 4118661130c..78fde0e3c2a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -88,3 +88,6 @@ [submodule "ui/thirdparty/httplib"] path = ui/thirdparty/httplib url = https://github.com/yhirose/cpp-httplib +[submodule "thirdparty/backward-cpp"] + path = thirdparty/backward-cpp + url = git@github.com:bombela/backward-cpp.git diff --git a/configure b/configure index 761cd5e4313..5b351202f3c 100755 --- a/configure +++ b/configure @@ -237,7 +237,7 @@ else git_submodules_action="ignore" fi -git_submodules="ui/keycodemapdb ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig hw/xbox/nv2a/thirdparty/nv2a_vsh_cpu" +git_submodules="ui/keycodemapdb ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig hw/xbox/nv2a/thirdparty/nv2a_vsh_cpu thirdparty/backward-cpp" git="git" # Don't accept a target_list environment variable. diff --git a/meson.build b/meson.build index a6fd6fa5a3b..4a3979bf341 100644 --- a/meson.build +++ b/meson.build @@ -169,6 +169,16 @@ if 'dtrace' in get_option('trace_backends') endif endif +libunwind = dependency('libunwind', required : false, kwargs : static_kwargs) +if libunwind.found() + add_global_arguments('-DBACKWARD_HAS_LIBUNWIND=1', language : 'cpp') +endif + +libdw = dependency('libdw', required : false, kwargs: static_kwargs) +if libdw.found() + add_global_arguments('-DBACKWARD_HAS_DW=1', language : 'cpp') +endif + if get_option('iasl') == '' iasl = find_program('iasl', required: false) else @@ -192,6 +202,8 @@ endif qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now') if targetos == 'windows' + # These are required for backward-cpp to produce a stack trace + qemu_ldflags += ['-ldbghelp', '-lucrt'] qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat') # Disable ASLR for debug builds to allow debugging with gdb if get_option('optimization') == '0' @@ -3111,6 +3123,7 @@ subdir('hw') subdir('gdbstub') subdir('data') subdir('winpcap-loader') +subdir('thirdparty') if enable_modules diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh index 0496ebeb6c7..e71f4f9424c 100755 --- a/scripts/archive-source.sh +++ b/scripts/archive-source.sh @@ -30,6 +30,7 @@ submodules="dtc meson ui/keycodemapdb" submodules="$submodules tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3" submodules="$submodules ui/thirdparty/imgui ui/thirdparty/implot ui/thirdparty/httplib util/xxHash tomlplusplus genconfig" # xemu extras submodules="$submodules hw/xbox/nv2a/thirdparty/nv2a_vsh_cpu" +submodules="$submodules thirdparty/backward-cpp" sub_deinit="" function cleanup() { diff --git a/scripts/gen-license.py b/scripts/gen-license.py index b71d4ecd56a..65cad23d18e 100755 --- a/scripts/gen-license.py +++ b/scripts/gen-license.py @@ -231,6 +231,12 @@ def head(self): submodule=Submodule('hw/xbox/nv2a/thirdparty/nv2a_vsh_cpu') ), +Lib('backward-cpp', 'https://github.com/bombela/backward-cpp', + mit, 'https://raw.githubusercontent.com/bombela/backward-cpp/master/LICENSE.txt' + ships_static=all_platforms, + submodule=Submodule('thirdparty/backward-cpp') + ), + # # Data files included with xemu # diff --git a/thirdparty/backward-cpp b/thirdparty/backward-cpp new file mode 160000 index 00000000000..51f0700452c --- /dev/null +++ b/thirdparty/backward-cpp @@ -0,0 +1 @@ +Subproject commit 51f0700452cf71c57d43c2d028277b24cde32502 diff --git a/thirdparty/meson.build b/thirdparty/meson.build new file mode 100644 index 00000000000..6560ca0bada --- /dev/null +++ b/thirdparty/meson.build @@ -0,0 +1,11 @@ +if libunwind.found() + softmmu_ss.add(libunwind) +endif + +if libdw.found() + softmmu_ss.add(libdw) +endif + +softmmu_ss.add(files( + 'backward-cpp/backward.cpp' +))