Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMMON: added scummvm_assert macro and stacktrace support #3357

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

@mgerhardy
Copy link
Contributor

@mgerhardy mgerhardy commented Sep 10, 2021

Adding a few macros to replace the normal assert with an own version for scummvm. This has the advantage that instead of silently crashing the game when no debugger is attached, you still get an error message.

We could also extend this to include the function, file and line number - or present a dialog in order to allow to attach a debugger.

SDL has a great implementation of handling asserts the proper way. We could adopt this.

This is an implementation in my own voxel engine - https://github.com/mgerhardy/engine/blob/master/src/modules/core/Assert.h / https://github.com/mgerhardy/engine/blob/master/src/modules/core/Assert.cpp - including breakpoints and stacktraces.

common/textconsole.h Outdated Show resolved Hide resolved
@bluegr
Copy link
Member

@bluegr bluegr commented Sep 10, 2021

Nice idea! I like it

I find the naming of the macros to be a bit confusing. Perhaps scummvm_assert_warn() and scummvm_assert_error() would be more straightforward?

@mgerhardy mgerhardy force-pushed the pr/scummvm-assert branch from ea69d14 to f5c76c4 Sep 16, 2021
@mgerhardy mgerhardy force-pushed the pr/scummvm-assert branch from f5c76c4 to b7603f7 Sep 16, 2021
@mgerhardy
Copy link
Contributor Author

@mgerhardy mgerhardy commented Sep 16, 2021

	scummvm_assert(false, "Just a test")

is producing this output

WARNING: Just a test - false!
#0 /home/mgerhardy/dev/scummvm/scummvm unsigned long backward::details::unwind<backward::StackTraceImpl<backward::system_tag::linux_tag>::callback>(backward::StackTraceImpl<backward::system_tag::linux_tag>::callback, unsigned long) [0x55d6df5be842]
#1 /home/mgerhardy/dev/scummvm/scummvm backward::StackTraceImpl<backward::system_tag::linux_tag>::load_here(unsigned long, void*, void*) [0x55d6df5bd29e]
#2 /home/mgerhardy/dev/scummvm/scummvm createStacktrace() [0x55d6df5bcbb1]
#3 /home/mgerhardy/dev/scummvm/scummvm BaseBackend::printStacktrace() [0x55d6df557062]
#4 /home/mgerhardy/dev/scummvm/scummvm TwinE::TwinEEngine::run() [0x55d6df467477]
#5 /home/mgerhardy/dev/scummvm/scummvm runGame(Plugin const*, Plugin const*, OSystem&, Common::String const&) [0x55d6df4494c4]
#6 /home/mgerhardy/dev/scummvm/scummvm scummvm_main [0x55d6df44adad]
#7 /home/mgerhardy/dev/scummvm/scummvm main [0x55d6df44699a]
#8 /usr/lib/x86_64-linux-gnu/libc-2.31.so __libc_start_main [0x7f57a21b8d09]
#9 /home/mgerhardy/dev/scummvm/scummvm _start [0x55d6df402839]
#10   [0xffffffffffffffff]
scummvm: engines/twine/twine.cpp:263: virtual Common::Error TwinE::TwinEEngine::run(): Assertion `false' failed.
[1]    4071638 abort      ./scummvm

@Die4Ever
Copy link
Member

@Die4Ever Die4Ever commented Sep 16, 2021

this is really cool, maybe we should put stack traces in the error function too?

@mgerhardy mgerhardy closed this Sep 16, 2021
@mgerhardy mgerhardy reopened this Sep 16, 2021
@mgerhardy mgerhardy changed the title RFC: COMMON: added scummvm_assert_XXX macros COMMON: added scummvm_assert_XXX macros Sep 16, 2021
@mgerhardy mgerhardy changed the title COMMON: added scummvm_assert_XXX macros COMMON: added scummvm_assert macro and stacktrace support Sep 16, 2021
* Convert statement to string via pre-processor
*/
#define STRINGIFY_X(s) #s
#define STRINGIFY(s) STRINGIFY_X(s)
Copy link
Member

@Die4Ever Die4Ever Sep 19, 2021

I'm curious why this is chained instead of just doing #s directly

Copy link
Contributor Author

@mgerhardy mgerhardy Sep 20, 2021

this is because the pre-processor would otherwise just stringify the expression - not the result of the expression.

Copy link
Member

@Die4Ever Die4Ever Sep 20, 2021

edit: nvm, I tested it and this is good, I'll test out some more things

I didn't know that. But if chained preprocessor macros execute expressions, then that means the change in common/system.h

#ifdef NDEBUG
// none debug build should rely on the system headers to define assert
#define scummvm_assert(cond, message) assert(cond);

This would be a chained call to assert, which means it might be actually evaluating the expression? I can test this out a bit later tonight.

@Die4Ever
Copy link
Member

@Die4Ever Die4Ever commented Sep 19, 2021

seems like the failing build is only when c++11 is disabled, maybe we should just disable the USE_STACKTRACES flag when c++11 is disabled?

compile errors from CXX='ccache g++' ./configure --enable-all-engines --disable-c++11
2021-09-19T04:41:38.8193240Z Makefile.common:170: recipe for target 'backends/stacktraces/stacktrace.o' failed
2021-09-19T04:41:38.8194873Z In file included from backends/stacktraces/stacktrace.cpp:74:0:
2021-09-19T04:41:38.8196015Z backends/stacktraces/backward.h:521:7: error: template argument 3 is invalid
2021-09-19T04:41:38.8196924Z  class handle {
2021-09-19T04:41:38.8197778Z        ^~~~~~
2021-09-19T04:41:38.8199145Z backends/stacktraces/backward.h:521:14: error: expected ‘>’ before ‘{’ token
2021-09-19T04:41:38.8199905Z  class handle {
2021-09-19T04:41:38.8200268Z               ^
2021-09-19T04:41:38.8201210Z backends/stacktraces/backward.h:521:14: error: expected unqualified-id before ‘{’ token
2021-09-19T04:41:38.8202401Z backends/stacktraces/backward.h:604:2: warning: extra ‘;’ [-Wpedantic]
2021-09-19T04:41:38.8203094Z  };
2021-09-19T04:41:38.8203393Z   ^
2021-09-19T04:41:38.8204983Z backends/stacktraces/backward.h:628:12: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8205854Z    details::handle<char *> _demangle_buffer;
2021-09-19T04:41:38.8206304Z             ^~~~~~
2021-09-19T04:41:38.8207630Z backends/stacktraces/backward.h: In member function ‘std::__cxx11::string backward::details::demangler_impl<backward::system_tag::linux_tag>::demangle(const char*)’:
2021-09-19T04:41:38.8209097Z backends/stacktraces/backward.h:618:50: error: ‘_demangle_buffer’ was not declared in this scope
2021-09-19T04:41:38.8210151Z      char *result = abi::__cxa_demangle(funcname, _demangle_buffer.get(),
2021-09-19T04:41:38.8210712Z                                                   ^~~~~~~~~~~~~~~~
2021-09-19T04:41:38.8211679Z backends/stacktraces/backward.h:618:50: note: suggested alternative: ‘_demangle_buffer_length’
2021-09-19T04:41:38.8212574Z      char *result = abi::__cxa_demangle(funcname, _demangle_buffer.get(),
2021-09-19T04:41:38.8213132Z                                                   ^~~~~~~~~~~~~~~~
2021-09-19T04:41:38.8213586Z                                                   _demangle_buffer_length
2021-09-19T04:41:38.8214166Z backends/stacktraces/backward.h: At global scope:
2021-09-19T04:41:38.8215543Z backends/stacktraces/backward.h:1551:20: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8216366Z    typedef details::handle<bfd *,
2021-09-19T04:41:38.8216778Z                     ^~~~~~
2021-09-19T04:41:38.8217964Z backends/stacktraces/backward.h:1555:20: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8218960Z    typedef details::handle<asymbol **> bfd_symtab_t;
2021-09-19T04:41:38.8219443Z                     ^~~~~~
2021-09-19T04:41:38.8220372Z backends/stacktraces/backward.h:1558:5: error: ‘bfd_handle_t’ does not name a type; did you mean ‘bfd_target’?
2021-09-19T04:41:38.8221085Z      bfd_handle_t handle;
2021-09-19T04:41:38.8221586Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8221907Z      bfd_target
2021-09-19T04:41:38.8222813Z backends/stacktraces/backward.h:1560:5: error: ‘bfd_symtab_t’ does not name a type; did you mean ‘bfd_stat’?
2021-09-19T04:41:38.8223498Z      bfd_symtab_t symtab;
2021-09-19T04:41:38.8223845Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8224160Z      bfd_stat
2021-09-19T04:41:38.8225380Z backends/stacktraces/backward.h:1561:5: error: ‘bfd_symtab_t’ does not name a type; did you mean ‘bfd_stat’?
2021-09-19T04:41:38.8226166Z      bfd_symtab_t dynamic_symtab;
2021-09-19T04:41:38.8226572Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8226911Z      bfd_stat
2021-09-19T04:41:38.8228703Z backends/stacktraces/backward.h: In member function ‘virtual backward::ResolvedTrace backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::resolve(backward::ResolvedTrace)’:
2021-09-19T04:41:38.8231349Z backends/stacktraces/backward.h:1428:35: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8233385Z      if (fobj == nullptr || !fobj->handle) {
2021-09-19T04:41:38.8233834Z                                    ^~~~~~
2021-09-19T04:41:38.8235408Z backends/stacktraces/backward.h:1430:18: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8237665Z        if (!fobj->handle) {
2021-09-19T04:41:38.8238251Z                   ^~~~~~
2021-09-19T04:41:38.8240370Z backends/stacktraces/backward.h: In member function ‘backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject* backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::load_object_with_bfd(const string&)’:
2021-09-19T04:41:38.8242396Z backends/stacktraces/backward.h:1585:5: error: ‘bfd_handle_t’ was not declared in this scope
2021-09-19T04:41:38.8243220Z      bfd_handle_t bfd_handle;
2021-09-19T04:41:38.8243610Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8244452Z backends/stacktraces/backward.h:1585:5: note: suggested alternative: ‘bfd_target’
2021-09-19T04:41:38.8245264Z      bfd_handle_t bfd_handle;
2021-09-19T04:41:38.8245637Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8245951Z      bfd_target
2021-09-19T04:41:38.8246807Z backends/stacktraces/backward.h:1588:5: error: ‘bfd_handle’ was not declared in this scope
2021-09-19T04:41:38.8247632Z      bfd_handle.reset(bfd_fdopenr(filename_object.c_str(), "default", fd));
2021-09-19T04:41:38.8248316Z      ^~~~~~~~~~
2021-09-19T04:41:38.8249180Z backends/stacktraces/backward.h:1588:5: note: suggested alternative: ‘bfd_demangle’
2021-09-19T04:41:38.8250018Z      bfd_handle.reset(bfd_fdopenr(filename_object.c_str(), "default", fd));
2021-09-19T04:41:38.8250564Z      ^~~~~~~~~~
2021-09-19T04:41:38.8250891Z      bfd_demangle
2021-09-19T04:41:38.8251762Z backends/stacktraces/backward.h:1611:5: error: ‘bfd_symtab_t’ was not declared in this scope
2021-09-19T04:41:38.8252464Z      bfd_symtab_t symtab, dynamic_symtab;
2021-09-19T04:41:38.8252882Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8253688Z backends/stacktraces/backward.h:1611:5: note: suggested alternative: ‘bfd_stat’
2021-09-19T04:41:38.8254378Z      bfd_symtab_t symtab, dynamic_symtab;
2021-09-19T04:41:38.8254795Z      ^~~~~~~~~~~~
2021-09-19T04:41:38.8255102Z      bfd_stat
2021-09-19T04:41:38.8255930Z backends/stacktraces/backward.h:1615:7: error: ‘symtab’ was not declared in this scope
2021-09-19T04:41:38.8256653Z        symtab.reset(static_cast<bfd_symbol **>(
2021-09-19T04:41:38.8257098Z        ^~~~~~
2021-09-19T04:41:38.8257895Z backends/stacktraces/backward.h:1615:7: note: suggested alternative: ‘swab’
2021-09-19T04:41:38.8258596Z        symtab.reset(static_cast<bfd_symbol **>(
2021-09-19T04:41:38.8259030Z        ^~~~~~
2021-09-19T04:41:38.8259325Z        swab
2021-09-19T04:41:38.8260176Z backends/stacktraces/backward.h:1621:7: error: ‘dynamic_symtab’ was not declared in this scope
2021-09-19T04:41:38.8260959Z        dynamic_symtab.reset(static_cast<bfd_symbol **>(
2021-09-19T04:41:38.8261418Z        ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8262649Z backends/stacktraces/backward.h:1621:7: note: suggested alternative: ‘bfd_set_symtab’
2021-09-19T04:41:38.8263478Z        dynamic_symtab.reset(static_cast<bfd_symbol **>(
2021-09-19T04:41:38.8263979Z        ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8264334Z        bfd_set_symtab
2021-09-19T04:41:38.8265941Z backends/stacktraces/backward.h:1631:8: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8267524Z      r->handle = move(bfd_handle);
2021-09-19T04:41:38.8267922Z         ^~~~~~
2021-09-19T04:41:38.8269346Z backends/stacktraces/backward.h:1632:8: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘symtab’
2021-09-19T04:41:38.8270556Z      r->symtab = move(symtab);
2021-09-19T04:41:38.8271051Z         ^~~~~~
2021-09-19T04:41:38.8272098Z backends/stacktraces/backward.h:1632:22: error: ‘symtab’ was not declared in this scope
2021-09-19T04:41:38.8273019Z      r->symtab = move(symtab);
2021-09-19T04:41:38.8273419Z                       ^~~~~~
2021-09-19T04:41:38.8274357Z backends/stacktraces/backward.h:1632:22: note: suggested alternative: ‘swab’
2021-09-19T04:41:38.8275187Z      r->symtab = move(symtab);
2021-09-19T04:41:38.8275558Z                       ^~~~~~
2021-09-19T04:41:38.8275890Z                       swab
2021-09-19T04:41:38.8277528Z backends/stacktraces/backward.h:1633:8: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘dynamic_symtab’
2021-09-19T04:41:38.8278920Z      r->dynamic_symtab = move(dynamic_symtab);
2021-09-19T04:41:38.8279359Z         ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8280197Z backends/stacktraces/backward.h:1633:30: error: ‘dynamic_symtab’ was not declared in this scope
2021-09-19T04:41:38.8281122Z      r->dynamic_symtab = move(dynamic_symtab);
2021-09-19T04:41:38.8281563Z                               ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8282419Z backends/stacktraces/backward.h:1633:30: note: suggested alternative: ‘bfd_set_symtab’
2021-09-19T04:41:38.8283340Z      r->dynamic_symtab = move(dynamic_symtab);
2021-09-19T04:41:38.8283780Z                               ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8284162Z                               bfd_set_symtab
2021-09-19T04:41:38.8286480Z backends/stacktraces/backward.h: In member function ‘backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_sym_result backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_symbol_details(backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject*, void*, void*)’:
2021-09-19T04:41:38.8292517Z backends/stacktraces/backward.h:1660:33: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8294037Z      bfd_map_over_sections(fobj->handle.get(), &find_in_section_trampoline,
2021-09-19T04:41:38.8294639Z                                  ^~~~~~
2021-09-19T04:41:38.8295181Z In file included from backends/stacktraces/backward.h:229:0,
2021-09-19T04:41:38.8295912Z                  from backends/stacktraces/stacktrace.cpp:74:
2021-09-19T04:41:38.8298587Z backends/stacktraces/backward.h: In member function ‘void backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_in_section(bfd_vma, bfd_vma, backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject*, asection*, backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_sym_result&)’:
2021-09-19T04:41:38.8301928Z backends/stacktraces/backward.h:1679:38: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8303824Z      if ((bfd_get_section_flags(fobj->handle.get(), section) & SEC_ALLOC) == 0)
2021-09-19T04:41:38.8304511Z                                       ^
2021-09-19T04:41:38.8306058Z backends/stacktraces/backward.h:1686:50: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8307558Z      bfd_vma sec_addr = bfd_get_section_vma(fobj->handle.get(), section);
2021-09-19T04:41:38.8308248Z                                                   ^
2021-09-19T04:41:38.8308845Z In file included from backends/stacktraces/stacktrace.cpp:74:0:
2021-09-19T04:41:38.8310682Z backends/stacktraces/backward.h:1708:32: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘symtab’
2021-09-19T04:41:38.8312516Z      if (!result.found && fobj->symtab) {
2021-09-19T04:41:38.8312991Z                                 ^~~~~~
2021-09-19T04:41:38.8313545Z In file included from backends/stacktraces/backward.h:229:0,
2021-09-19T04:41:38.8314550Z                  from backends/stacktraces/stacktrace.cpp:74:
2021-09-19T04:41:38.8316200Z backends/stacktraces/backward.h:1710:17: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8317605Z            fobj->handle.get(), section, fobj->symtab.get(), addr - sec_addr,
2021-09-19T04:41:38.8318141Z                  ^
2021-09-19T04:41:38.8319711Z backends/stacktraces/backward.h:1710:17: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8321195Z            fobj->handle.get(), section, fobj->symtab.get(), addr - sec_addr,
2021-09-19T04:41:38.8321727Z                  ^
2021-09-19T04:41:38.8323446Z backends/stacktraces/backward.h:1710:46: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘symtab’
2021-09-19T04:41:38.8324953Z            fobj->handle.get(), section, fobj->symtab.get(), addr - sec_addr,
2021-09-19T04:41:38.8325546Z                                               ^
2021-09-19T04:41:38.8326136Z In file included from backends/stacktraces/stacktrace.cpp:74:0:
2021-09-19T04:41:38.8327963Z backends/stacktraces/backward.h:1714:32: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘dynamic_symtab’
2021-09-19T04:41:38.8329518Z      if (!result.found && fobj->dynamic_symtab) {
2021-09-19T04:41:38.8330157Z                                 ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8330816Z In file included from backends/stacktraces/backward.h:229:0,
2021-09-19T04:41:38.8331511Z                  from backends/stacktraces/stacktrace.cpp:74:
2021-09-19T04:41:38.8333399Z backends/stacktraces/backward.h:1716:17: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8334853Z            fobj->handle.get(), section, fobj->dynamic_symtab.get(),
2021-09-19T04:41:38.8335378Z                  ^
2021-09-19T04:41:38.8336947Z backends/stacktraces/backward.h:1716:17: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8342743Z            fobj->handle.get(), section, fobj->dynamic_symtab.get(),
2021-09-19T04:41:38.8343309Z                  ^
2021-09-19T04:41:38.8344961Z backends/stacktraces/backward.h:1716:46: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘dynamic_symtab’
2021-09-19T04:41:38.8346493Z            fobj->handle.get(), section, fobj->dynamic_symtab.get(),
2021-09-19T04:41:38.8347073Z                                               ^
2021-09-19T04:41:38.8349750Z backends/stacktraces/backward.h: In member function ‘backward::ResolvedTrace::source_locs_t backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::backtrace_inliners(backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject*, backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::find_sym_result)’:
2021-09-19T04:41:38.8353131Z backends/stacktraces/backward.h:1731:50: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8355122Z        result.found = bfd_find_inliner_info(fobj->handle.get(), &result.filename,
2021-09-19T04:41:38.8355820Z                                                   ^
2021-09-19T04:41:38.8357386Z backends/stacktraces/backward.h:1731:50: error: ‘struct backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libbfd>::bfd_fileobject’ has no member named ‘handle’
2021-09-19T04:41:38.8359220Z        result.found = bfd_find_inliner_info(fobj->handle.get(), &result.filename,
2021-09-19T04:41:38.8359894Z                                                   ^
2021-09-19T04:41:38.8360496Z In file included from backends/stacktraces/stacktrace.cpp:74:0:
2021-09-19T04:41:38.8361281Z backends/stacktraces/backward.h: At global scope:
2021-09-19T04:41:38.8362719Z backends/stacktraces/backward.h:1924:20: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8363956Z    typedef details::handle<Dwfl *, details::deleter<void, Dwfl *, &dwfl_end>>
2021-09-19T04:41:38.8364498Z                     ^~~~~~
2021-09-19T04:41:38.8365824Z backends/stacktraces/backward.h:1926:12: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8366840Z    details::handle<Dwfl_Callbacks *, details::default_delete<Dwfl_Callbacks *>>
2021-09-19T04:41:38.8367387Z             ^~~~~~
2021-09-19T04:41:38.8368325Z backends/stacktraces/backward.h:1928:3: error: ‘dwfl_handle_t’ does not name a type; did you mean ‘dwfl_linecu’?
2021-09-19T04:41:38.8369056Z    dwfl_handle_t _dwfl_handle;
2021-09-19T04:41:38.8369428Z    ^~~~~~~~~~~~~
2021-09-19T04:41:38.8369757Z    dwfl_linecu
2021-09-19T04:41:38.8371361Z backends/stacktraces/backward.h: In member function ‘virtual backward::ResolvedTrace backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::resolve(backward::ResolvedTrace)’:
2021-09-19T04:41:38.8372999Z backends/stacktraces/backward.h:1781:7: error: ‘_dwfl_cb’ was not declared in this scope
2021-09-19T04:41:38.8373708Z        _dwfl_cb.reset(new Dwfl_Callbacks);
2021-09-19T04:41:38.8374118Z        ^~~~~~~~
2021-09-19T04:41:38.8374941Z backends/stacktraces/backward.h:1781:7: note: suggested alternative: ‘dwfl_pid’
2021-09-19T04:41:38.8375771Z        _dwfl_cb.reset(new Dwfl_Callbacks);
2021-09-19T04:41:38.8376189Z        ^~~~~~~~
2021-09-19T04:41:38.8376512Z        dwfl_pid
2021-09-19T04:41:38.8377382Z backends/stacktraces/backward.h:1786:7: error: ‘_dwfl_handle’ was not declared in this scope
2021-09-19T04:41:38.8378148Z        _dwfl_handle.reset(dwfl_begin(_dwfl_cb.get()));
2021-09-19T04:41:38.8378593Z        ^~~~~~~~~~~~
2021-09-19T04:41:38.8379408Z backends/stacktraces/backward.h:1786:7: note: suggested alternative: ‘dwfl_end’
2021-09-19T04:41:38.8380157Z        _dwfl_handle.reset(dwfl_begin(_dwfl_cb.get()));
2021-09-19T04:41:38.8380606Z        ^~~~~~~~~~~~
2021-09-19T04:41:38.8381059Z        dwfl_end
2021-09-19T04:41:38.8382074Z backends/stacktraces/backward.h:1802:10: error: ‘_dwfl_handle’ was not declared in this scope
2021-09-19T04:41:38.8382776Z      if (!_dwfl_handle) {
2021-09-19T04:41:38.8383140Z           ^~~~~~~~~~~~
2021-09-19T04:41:38.8384027Z backends/stacktraces/backward.h:1802:10: note: suggested alternative: ‘dwfl_end’
2021-09-19T04:41:38.8384725Z      if (!_dwfl_handle) {
2021-09-19T04:41:38.8385085Z           ^~~~~~~~~~~~
2021-09-19T04:41:38.8385438Z           dwfl_end
2021-09-19T04:41:38.8386343Z backends/stacktraces/backward.h:1809:40: error: ‘_dwfl_handle’ was not declared in this scope
2021-09-19T04:41:38.8387230Z      Dwfl_Module *mod = dwfl_addrmodule(_dwfl_handle.get(), trace_addr);
2021-09-19T04:41:38.8388162Z                                         ^~~~~~~~~~~~
2021-09-19T04:41:38.8389019Z backends/stacktraces/backward.h:1809:40: note: suggested alternative: ‘dwfl_end’
2021-09-19T04:41:38.8389850Z      Dwfl_Module *mod = dwfl_addrmodule(_dwfl_handle.get(), trace_addr);
2021-09-19T04:41:38.8390398Z                                         ^~~~~~~~~~~~
2021-09-19T04:41:38.8390794Z                                         dwfl_end
2021-09-19T04:41:38.8391339Z backends/stacktraces/backward.h: At global scope:
2021-09-19T04:41:38.8392641Z backends/stacktraces/backward.h:3689:54: error: ‘>>’ should be ‘> >’ within a nested template argument list
2021-09-19T04:41:38.8393537Z    typedef std::vector<std::pair<unsigned, std::string>> lines_t;
2021-09-19T04:41:38.8394196Z                                                       ^~
2021-09-19T04:41:38.8394563Z                                                       > >
2021-09-19T04:41:38.8395901Z backends/stacktraces/backward.h:3801:12: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8396888Z    details::handle<std::ifstream *, details::default_delete<std::ifstream *>>
2021-09-19T04:41:38.8397458Z             ^~~~~~
2021-09-19T04:41:38.8398712Z backends/stacktraces/backward.h: In constructor ‘backward::SourceFile::SourceFile(const string&)’:
2021-09-19T04:41:38.8399998Z backends/stacktraces/backward.h:3700:7: error: ‘_file’ was not declared in this scope
2021-09-19T04:41:38.8400801Z        _file.reset(new std::ifstream(new_path.c_str()));
2021-09-19T04:41:38.8401276Z        ^~~~~
2021-09-19T04:41:38.8402280Z backends/stacktraces/backward.h:3705:10: error: ‘_file’ was not declared in this scope
2021-09-19T04:41:38.8402970Z      if (!_file || !is_open()) {
2021-09-19T04:41:38.8403477Z           ^~~~~
2021-09-19T04:41:38.8404765Z backends/stacktraces/backward.h: In member function ‘bool backward::SourceFile::is_open() const’:
2021-09-19T04:41:38.8406000Z backends/stacktraces/backward.h:3709:33: error: ‘_file’ was not declared in this scope
2021-09-19T04:41:38.8406971Z    bool is_open() const { return _file->is_open(); }
2021-09-19T04:41:38.8407446Z                                  ^~~~~
2021-09-19T04:41:38.8409048Z backends/stacktraces/backward.h: In member function ‘backward::SourceFile::lines_t& backward::SourceFile::get_lines(unsigned int, unsigned int, backward::SourceFile::lines_t&)’:
2021-09-19T04:41:38.8410639Z backends/stacktraces/backward.h:3722:5: error: ‘_file’ was not declared in this scope
2021-09-19T04:41:38.8411557Z      _file->clear();
2021-09-19T04:41:38.8411915Z      ^~~~~
2021-09-19T04:41:38.8413234Z backends/stacktraces/backward.h: In member function ‘void backward::SourceFile::swap(backward::SourceFile&)’:
2021-09-19T04:41:38.8414637Z backends/stacktraces/backward.h:3780:30: error: ‘_file’ was not declared in this scope
2021-09-19T04:41:38.8415374Z    void swap(SourceFile &b) { _file.swap(b._file); }
2021-09-19T04:41:38.8415830Z                               ^~~~~
2021-09-19T04:41:38.8416925Z backends/stacktraces/backward.h:3780:43: error: ‘class backward::SourceFile’ has no member named ‘_file’
2021-09-19T04:41:38.8417868Z    void swap(SourceFile &b) { _file.swap(b._file); }
2021-09-19T04:41:38.8418357Z                                            ^~~~~
2021-09-19T04:41:38.8419021Z backends/stacktraces/backward.h: At global scope:
2021-09-19T04:41:38.8420458Z backends/stacktraces/backward.h:4256:12: error: ‘handle’ in namespace ‘backward::details’ does not name a template type
2021-09-19T04:41:38.8421361Z    details::handle<char *> _stack_content;
2021-09-19T04:41:38.8421934Z             ^~~~~~
2021-09-19T04:41:38.8423170Z backends/stacktraces/backward.h: In constructor ‘backward::SignalHandling::SignalHandling(const std::vector<int>&)’:
2021-09-19T04:41:38.8424754Z backends/stacktraces/backward.h:4164:5: error: ‘_stack_content’ was not declared in this scope
2021-09-19T04:41:38.8425587Z      _stack_content.reset(static_cast<char *>(malloc(stack_size)));
2021-09-19T04:41:38.8426111Z      ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8426929Z backends/stacktraces/backward.h:4164:5: note: suggested alternative: ‘stack_t’
2021-09-19T04:41:38.8427867Z      _stack_content.reset(static_cast<char *>(malloc(stack_size)));
2021-09-19T04:41:38.8428373Z      ^~~~~~~~~~~~~~
2021-09-19T04:41:38.8428679Z      stack_t
2021-09-19T04:41:38.8429179Z make: *** [backends/stacktraces/stacktrace.o] Error 1

@mgerhardy
Copy link
Contributor Author

@mgerhardy mgerhardy commented Sep 22, 2021

The used lib should be determined in configure and not in the code - otherwise we link all the libs - even those, that aren't in use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants