From 85efdc3a0d5a75ff753b63ac104ec1c3ae537f94 Mon Sep 17 00:00:00 2001 From: antangelo Date: Fri, 2 Aug 2024 19:15:47 -0400 Subject: [PATCH] wip --- .gitmodules | 3 +++ configure | 2 +- meson.build | 13 +++++++++++++ scripts/archive-source.sh | 1 + scripts/gen-license.py | 6 ++++++ thirdparty/backward-cpp | 1 + thirdparty/meson.build | 11 +++++++++++ 7 files changed, 36 insertions(+), 1 deletion(-) create mode 160000 thirdparty/backward-cpp create mode 100644 thirdparty/meson.build diff --git a/.gitmodules b/.gitmodules index 4118661130c..7a46e5cbfc6 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 = https://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..d4f1b78c874 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' +))