A beautiful stack trace pretty printer for C++

Related tags

Debug backward-cpp
Overview

Backward-cpp badge

Backward is a beautiful stack trace pretty printer for C++.

If you are bored to see this:

default trace

Backward will spice it up for you:

pretty stackstrace

There is not much to say. Of course it will be able to display the code snippets only if the source files are accessible (else see trace #4 in the example).

All "Source" lines and code snippet prefixed by a pipe "|" are frames inline the next frame. You can see that for the trace #1 in the example, the function you_shall_not_pass() was inlined in the function ...read2::do_test() by the compiler.

Installation

Install backward.hpp

Backward is a header only library. So installing Backward is easy, simply drop a copy of backward.hpp along with your other source files in your C++ project. You can also use a git submodule or really any other way that best fits your environment, as long as you can include backward.hpp.

Install backward.cpp

If you want Backward to automatically print a stack trace on most common fatal errors (segfault, abort, un-handled exception...), simply add a copy of backward.cpp to your project, and don't forget to tell your build system.

The code in backward.cpp is trivial anyway, you can simply copy what it's doing at your convenience.

Note for folly library users: must define backward::SignalHandling sh; after folly::init(&argc, &argv);.

Configuration & Dependencies

Integration with CMake

If you are using CMake and want to use its configuration abilities to save you the trouble, you can easily integrate Backward, depending on how you obtained the library.

As a subdirectory:

In this case you have a subdirectory containing the whole repository of Backward (eg.: using git-submodules), in this case you can do:

add_subdirectory(/path/to/backward-cpp)

# This will add backward.cpp to your target
add_executable(mytarget mysource.cpp ${BACKWARD_ENABLE})

# This will add libraries, definitions and include directories needed by backward
# by setting each property on the target.
add_backward(mytarget)

Modifying CMAKE_MODULE_PATH

In this case you can have Backward installed as a subdirectory:

list(APPEND CMAKE_MODULE_PATH /path/to/backward-cpp)
find_package(Backward)

# This will add libraries, definitions and include directories needed by backward
# through an IMPORTED target.
target_link_libraries(mytarget PUBLIC Backward::Backward)

Notice that this is equivalent to using the the approach that uses add_subdirectory(), however it uses cmake's imported target mechanism.

Installation through a regular package manager

In this case you have obtained Backward through a package manager.

Packages currently available:

find_package(Backward)

# This will add libraries, definitions and include directories needed by backward
# through an IMPORTED target.
target_link_libraries(mytarget PUBLIC Backward::Backward)

Libraries to unwind the stack

On Linux and macOS, backtrace can back-trace or "walk" the stack using the following libraries:

unwind

Unwind comes from libgcc, but there is an equivalent inside clang itself. With unwind, the stacktrace is as accurate as it can possibly be, since this is used by the C++ runtine in gcc/clang for stack unwinding on exception.

Normally libgcc is already linked to your program by default.

libunwind from the libunwind project

apt-get install binutils-dev (or equivalent)

Libunwind provides, in some cases, a more accurate stacktrace as it knows to decode signal handler frames and lets us edit the context registers when unwinding, allowing stack traces over bad function references.

For best results make sure you are using libunwind 1.3 or later, which added unw_init_local2 and support for handling signal frames.

CMake will warn you when configuring if your libunwind version doesn't support signal frames.

On macOS clang provides a libunwind API compatible library as part of its environment, so no third party libraries are necessary.

Compile with debug info

You need to compile your project with generation of debug symbols enabled, usually -g with clang++ and g++.

Note that you can use -g with any level of optimization, with modern debug information encoding like DWARF, it only takes space in the binary (it's not loaded in memory until your debugger or Backward makes use of it, don't worry), and it doesn't impact the code generation (at least on GNU/Linux x86_64 for what I know).

If you are missing debug information, the stack trace will lack details about your sources.

Libraries to read the debug info

Backward supports pretty printed stack traces on GNU/Linux, macOS and Windows, it will compile fine under other platforms but will not do anything. Pull requests are welcome :)

Also, by default you will get a really basic stack trace, based on the backtrace_symbols API:

default trace

You will need to install some dependencies to get the ultimate stack trace. Three libraries are currently supported, the only difference is which one is the easiest for you to install, so pick your poison:

libbfd from the GNU/binutils

apt-get install binutils-dev (or equivalent)

And do not forget to link with the lib: g++/clang++ -lbfd -ldl ...

This library requires dynamic loading. Which is provided by the library dl. Hence why we also link with -ldl.

Then define the following before every inclusion of backward.hpp (don't forget to update backward.cpp as well):

#define BACKWARD_HAS_BFD 1

libdw from the elfutils

apt-get install libdw-dev (or equivalent)

And do not forget to link with the lib and inform Backward to use it:

#define BACKWARD_HAS_DW 1

Of course you can simply add the define (-DBACKWARD_HAS_...=1) and the linkage details in your build system and even auto-detect which library is installed, it's up to you.

libdwarf and libelf

apt-get install libdwarf-dev (or equivalent)

And do not forget to link with the lib and inform Backward to use it:

#define BACKWARD_HAS_DWARF 1

There are several alternative implementations of libdwarf and libelf that are API compatible so it's possible, although it hasn't been tested, to replace the ones used when developing backward (in bold, below):

Of course you can simply add the define (-DBACKWARD_HAS_...=1) and the linkage details in your build system and even auto-detect which library is installed, it's up to you.

That's it, you are all set, you should be getting nice stack traces like the one at the beginning of this document.

API

If you don't want to limit yourself to the defaults offered by backward.cpp, and you want to take some random stack traces for whatever reason and pretty print them the way you love or you decide to send them all to your buddies over the Internet, you will appreciate the simplicity of Backward's API.

Stacktrace

The StackTrace class lets you take a "snapshot" of the current stack. You can use it like this:

using namespace backward;
StackTrace st; st.load_here(32);
Printer p; p.print(st);

The public methods are:

class StackTrace { public:
	// Take a snapshot of the current stack, with at most "trace_cnt_max"
	// traces in it. The first trace is the most recent (ie the current
	// frame). You can also provide a trace address to load_from() assuming
	// the address is a valid stack frame (useful for signal handling traces).
	// Both function return size().
	size_t load_here(size_t trace_cnt_max)
	size_t load_from(void* address, size_t trace_cnt_max)

	// The number of traces loaded. This can be less than "trace_cnt_max".
	size_t size() const

	// A unique id for the thread in which the trace was taken. The value
	// 0 means the stack trace comes from the main thread.
	size_t thread_id() const

	// Retrieve a trace by index. 0 is the most recent trace, size()-1 is
	// the oldest one.
	Trace operator[](size_t trace_idx)
};

TraceResolver

The TraceResolver does the heavy lifting, and intends to transform a simple Trace from its address into a fully detailed ResolvedTrace with the filename of the source, line numbers, inlined functions and so on.

You can use it like this:

using namespace backward;
StackTrace st; st.load_here(32);

TraceResolver tr; tr.load_stacktrace(st);
for (size_t i = 0; i < st.size(); ++i) {
	ResolvedTrace trace = tr.resolve(st[i]);
	std::cout << "#" << i
		<< " " << trace.object_filename
		<< " " << trace.object_function
		<< " [" << trace.addr << "]"
	<< std::endl;
}

The public methods are:

class TraceResolver { public:
	// Pre-load whatever is necessary from the stack trace.
	template <class ST>
		void load_stacktrace(ST&)

	// Resolve a trace. It takes a ResolvedTrace, because a `Trace` is
	// implicitly convertible to it.
	ResolvedTrace resolve(ResolvedTrace t)
};

SnippetFactory

The SnippetFactory is a simple helper class to automatically load and cache source files in order to extract code snippets.

class SnippetFactory { public:
	// A snippet is a list of line numbers and line contents.
	typedef std::vector<std::pair<size_t, std::string> > lines_t;

	// Return a snippet starting at line_start with up to context_size lines.
	lines_t get_snippet(const std::string& filename,
			size_t line_start, size_t context_size)

	// Return a combined snippet from two different locations and combine them.
	// context_size / 2 lines will be extracted from each location.
	lines_t get_combined_snippet(
			const std::string& filename_a, size_t line_a,
			const std::string& filename_b, size_t line_b,
			size_t context_size)

	// Tries to return a unified snippet if the two locations from the same
	// file are close enough to fit inside one context_size, else returns
	// the equivalent of get_combined_snippet().
	lines_t get_coalesced_snippet(const std::string& filename,
			size_t line_a, size_t line_b, size_t context_size)

Printer

A simpler way to pretty print a stack trace to the terminal. It will automatically resolve the traces for you:

using namespace backward;
StackTrace st; st.load_here(32);
Printer p;
p.object = true;
p.color_mode = ColorMode::always;
p.address = true;
p.print(st, stderr);

You can set a few options:

class Printer { public:
	// Print a little snippet of code if possible.
	bool snippet = true;

	// Colorize the trace
	//  - ColorMode::automatic: Activate colors if possible. For example, when using a TTY on linux.
	//  - ColorMode::always: Always use colors.
	//  - ColorMode::never: Never use colors.
	bool color_mode = ColorMode::automatic;

	// Add the addresses of every source location to the trace.
	bool address = false;

	// Even if there is a source location, also prints the object
	// from where the trace came from.
	bool object = false;

	// Resolve and print a stack trace to the given C FILE* object.
	// On linux, if the FILE* object is attached to a TTY,
	// color will be used if color_mode is set to automatic.
	template <typename StackTrace>
		FILE* print(StackTrace& st, FILE* fp = stderr);

	// Resolve and print a stack trace to the given std::ostream object.
	// Color will only be used if color_mode is set to always. 
	template <typename ST>
		std::ostream& print(ST& st, std::ostream& os);

SignalHandling

A simple helper class that registers for you the most common signals and other callbacks to segfault, hardware exception, un-handled exception etc.

backward.cpp simply uses it like that:

backward::SignalHandling sh;

Creating the object registers all the different signals and hooks. Destroying this object doesn't do anything. It exposes only one method:

bool loaded() const // true if loaded with success

Trace object

To keep the memory footprint of a loaded StackTrace on the low-side, there a hierarchy of trace object, from a minimal Trace to a ResolvedTrace.

Simple trace

struct Trace {
	void*  addr; // address of the trace
	size_t idx;  // its index (0 == most recent)
};

Resolved trace

A ResolvedTrace should contains a maximum of details about the location of the trace in the source code. Note that not all fields might be set.

struct ResolvedTrace: public Trace {

	struct SourceLoc {
		std::string function;
		std::string filename;
		size_t      line;
		size_t      col;
	};

	// In which binary object this trace is located.
	std::string                    object_filename;

	// The function in the object that contains the trace. This is not the same
	// as source.function which can be an function inlined in object_function.
	std::string                    object_function;

	// The source location of this trace. It is possible for filename to be
	// empty and for line/col to be invalid (value 0) if this information
	// couldn't be deduced, for example if there is no debug information in the
	// binary object.
	SourceLoc                      source;

	// An optional list of "inliners". All of these sources locations where
	// inlined in the source location of the trace (the attribute right above).
	// This is especially useful when you compile with optimizations turned on.
	typedef std::vector<SourceLoc> source_locs_t;
	source_locs_t                  inliners;
};

Contact and copyright

François-Xavier Bourlet [email protected]

Copyright 2013-2017 Google Inc. All Rights Reserved. MIT License.

Disclaimer

Although this project is owned by Google Inc. this is not a Google supported or affiliated project.

Comments
  • Segmentation fault (Address not mapped to object [(nil)]) on printing end

    Segmentation fault (Address not mapped to object [(nil)]) on printing end

    It segfaults on end of printing stacktrace, on line 3975 raise(info->si_signo); .

          >  52:   LOG_INFO << reinterpret_cast<DataPipe *>(pipes[0])->print();
             53: }
             54: 
             55: int main(int argc, char **argv) {
    Segmentation fault (Address not mapped to object [(nil)])
    

    And it prints a redefinition warning if I uncomment #define BACKWARD_HAS_BFD 1

    #define BACKWARD_HAS_DW 1
    #define BACKWARD_HAS_BFD 1
    #include "backward.hpp"
    

    this is what I use now

    opened by xgdgsc 25
  • Fix memory leak in linux demangler

    Fix memory leak in linux demangler

    The __cxa_demangle() call was leaking the demangled name buffer (Confirmed by valgrind).

    If I understood the __cxa_demangle() docs right, the issue was that you were mixing the two operating modes (User buffer vs __cxa_demangle() allocated buffer). You passed a garbage pointer to __cxa_demangle(), which expects null or a pointer to a malloc() allocated block of size bytes. Note also size is 0 in your implementation. Basically the leak comes from __cxa_demangle() doing a realloc() on your garbage pointer.

    The fix is as simple as telling __cxa_demangle() to allocate the buffer itself.

    Just for reference, here is the __cxa_demangle() documentation explaining this behavior:

    https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.3/a01696.html

    opened by Manu343726 16
  • Update conan recipes to use the latest recipe APIs. Fixes #90

    Update conan recipes to use the latest recipe APIs. Fixes #90

    See #90.

    Basically, the conan recipes and the build commands used by the CI were outdated (the conan team seem to have been working so hard these last months, releasing like rabbits :P)

    opened by Manu343726 11
  • Fix signal handler

    Fix signal handler

    opened by elfring 10
  • Symbols can't be resolved, if debug symbols are stripped into .debug file

    Symbols can't be resolved, if debug symbols are stripped into .debug file

    The regression was introduced in patch to this ticket: https://github.com/bombela/backward-cpp/issues/146, here https://github.com/forrestv/backward-cpp/commit/1ecbdc649147ef4a8e34d2a61f46a7e211758f2e.

    opened by Gerold103 9
  • Introduce TraceResolver::load_addresses() for raw address array

    Introduce TraceResolver::load_addresses() for raw address array

    TraceResolver has a load_stacktrace() method accepting only an object like StackTrace. That object is basically an array of pointers.

    This was not really convenient, because

    1. it required carrying of this StackTrace object from the moment of its creation to the load_stacktrace() invocation. Sometimes this is a long path. And that may break encapsulation, if a project, using Backward, does not want to include Backward header anywhere except for 1 or 2 C++ files, responsible for collection and resolution of addresses. So basically, load_stacktrace() prevented split of stack load and stack resolution into separate submodules of a project;

    2. that made impossible to use Backward to resolve a stack, collected not via Backward.

    The patch introduces a new method load_addresses(), accepting an array of addresses. That solves both problems.

    Alongside, to avoid increase of code duplication by empty load_addresses() methods in the classes where they are not needed, now both load_stacktrace() and load_addresses() are in one base class, used by all resolvers. load_addresses() is a virtual method, which does nothing, except for a couple of classes, where it is overridden as backtrace_symbols(). load_stacktrace() just calls load_addresses() and doesn't need to be defined everywhere again and again.

    opened by Gerold103 8
  • Relative source paths in debug info

    Relative source paths in debug info

    Hi, I happens that, in some build systems/configurations, a binary can end up with relative paths to source files in the debug info in the binary. This can happen in some cases when building a C++ program with CMake+Ninja (and currently this behavior is not easy to workaround in general). Then, if the program is run in a different directory then backward-cpp will not be able to locate the source files and so the stack trace will not contain snippets.

    I propose allowing the user to specify an optional path prefix that backward-cpp will use when searching for source files using the following algorithm in the SourceFile class:

    1. If the source file path is absolute, just open it as-is.
    2. If the path is relative then first try to open it as-is; if this fails, and if there is a user-specified prefix, prepend the prefix to the filename and retry opening the file.

    The prefix could be specified through an environment variable BACKWARD_CPP_SRC_PREFIX, how does that sound? If it sounds OK, then I can submit a PR for it. Also open to other suggestions.

    opened by dpacbach 7
  • Getting exact line where exception is thrown

    Getting exact line where exception is thrown

    I would like to get the exact line where the runtime_error is raised in a catch scope. Is is possible without using a custom exception ? I couldn't manage to do it with st.load_from and backtrace function. With a backward::SignalHandling and no catch it manages to display the exact line. It seems it is because the context can be retrieved by sigaction: https://github.com/bombela/backward-cpp/blob/98747968adbcaf4f6c860a7c0614b25895c9a103/backward.hpp#L3730 Is there an equivalent when catching the exception ? My purpose is to display a nice stacktrace when an unexpected exception is raised in google test.

    #include <stdexcept>
    
    #define BACKWARD_HAS_BFD 1
    #include "backward.hpp"
    
    void foo()
    {
        try {
            throw std::runtime_error("error");
        } catch (std::exception &e) {
            backward::StackTrace st;
            backward::Printer printer;
            st.load_here();
            printer.print(st);
        }
    }
    
    int main()
    {
        foo();
        return 0;
    }
    
    opened by maingoh 7
  • CMake linking problem

    CMake linking problem

    I am trying to use the first CMake method, and am totally a CMake novice. I got the project to build fine without the 2 external dependencies (so the less pretty stack traces).

    add_subdirectory(/path/to/backward-cpp)
    
    # This will add backward.cpp to your target
    add_executable(mytarget mysource.cpp ${BACKWARD_ENABLE})
    target_link_libraries(mytarget
    [my libraries])
    # This will add libraries, definitions and include directories needed by backward
    # by setting each property on the target.
    add_backward(mytarget)
    

    I installed both of the suggested extra dependencies, and the BackwardConfig.cmake file is detecting one of them, so I get

    -- BACKWARD_HAS_UNWIND=1
    -- BACKWARD_HAS_BACKTRACE=0
    -- BACKWARD_HAS_BACKTRACE_SYMBOL=0
    -- BACKWARD_HAS_DW=1
    -- BACKWARD_HAS_BFD=0
    

    (As an aside, the logic located in BackwardConfig.cmake makes it seem like HAS_DW or HAS_BFD could only be true mutually exclusively, was this the intention?)

    However, when I build the program, I get an error with a long list of 'undefined reference' e.g.

    CMakeFiles/backward.dir/backward.cpp.o: In function `backward::TraceResolverLinuxImpl<backward::trace_resolver_tag::libdw>::resolve(backward::ResolvedTrace)':
    /home/[my path]/backward-cpp/backward.hpp:1158: undefined reference to `dwfl_linux_proc_find_elf'
    /home/[my path]/backward-cpp/backward.hpp:1159: undefined reference to `dwfl_standard_find_debuginfo'
    etc.
    

    which I think is a linker error? Any idea what I'm doing wrong? Do I need to add a line in target_link_libraries?

    opened by ljarin 7
  • Add ARM support

    Add ARM support

    This should fix #29 when cross-compiling for ARM. It would be great to add CI builds to the repo so we can run tests automagically. It's possible to run ARM docker containers with QEMU (See https://gist.github.com/Manu343726/ca0ceb224ea789415387)

    opened by Manu343726 7
  • Signal handling and reentrancy

    Signal handling and reentrancy

    Nonreentrant functions should not be used in signal handlers. https://www.gnu.org/software/libc/manual/html_node/Nonreentrancy.html

    I notice that StackTrace uses a std::vector<void *> for storage that is dynamically allocated inside the signal handler (when load_here/load_from is called in handleSignal). Generally, storage in a signal handler should be allocated on the stack.

    How do you properly handle reentrancy? It's not clear to me that you do.

    question 
    opened by mmurrian 6
  • Support Unknown System build with `BACKWARD_SYSTEM_UNKNOWN=1` in user take stack trace case.

    Support Unknown System build with `BACKWARD_SYSTEM_UNKNOWN=1` in user take stack trace case.

    In fact, I was build with NDK r21e, which didn't provide execinfo.h.

    So I set BACKWARD_SYSTEM_UNKNOWN=1 to build.

    I use backward-cpp to tack stacktrace, compiler complain

    backward.hpp:1236:23: error: no member named 'begin' in 'backward::StackTrace'
        load_addresses(st.begin(), static_cast<int>(st.size()));
    backward.hpp:4056:15: note: in instantiation of function template specialization 'backward::TraceResolverImplBase::load_stackt
    race<backward::StackTrace>' requested here
        _resolver.load_stacktrace(st);
    backward.hpp:4017:5: note: in instantiation of function template specialization 'backward::Printer::print_stacktrace<backward:
    :StackTrace>' requested here
        print_stacktrace(st, os, colorize);
    

    So I add this api into StackTraceImpl

    opened by Ghost-LZW 0
  • error in backward.hpp

    error in backward.hpp

    i get a lots of errors in same line:

    image

    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2589: '(': illegal token on right side of '::'
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2144: syntax error: 'unknown-type' should be preceded by ')'
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2661: 'std::vector<void *,std::allocator<void *>>::resize': no overloaded function takes 0 arguments
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2144: syntax error: 'unknown-type' should be preceded by ';'
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2143: syntax error: missing ')' before '.'
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C3928: '->': trailing return type is not allowed after a parenthesized declarator
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C3484: syntax error: expected '->' before the return type
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C3613: missing return type after '->' ('int' assumed)
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2146: syntax error: missing ';' before identifier 'size'
    C:\Users\fabio\CLionProjects\SchifoAPI\backward/backward.hpp(1210): error C2059: syntax error: ')'
    

    adding this two 2 line above the problematic line no more error

    #undef max
    #undef min
    _stacktrace.resize(std::min(_stacktrace.size(), skip_n_firsts() + depth));
    

    image

    opened by fabio1999ita 0
  • Unqualified calls to std::move

    Unqualified calls to std::move

    https://github.com/bombela/backward-cpp/blob/647eccde8e87d7669be1be8c661e26f1a78a3244/backward.hpp#L1640-L1642

    This causes a warning with Clang that unqualified calls to std::move are being performed. I haven't looked into the code much but it should probably be a matter of qualifying the calls with std:: (or a custom class/namespace if a custom move function is being used).

    opened by LorenDB 0
  • CMake Error

    CMake Error

    I'm trying to build this project on a RHEL7 machine, but CMake fails with this error:

    ./builds.sh cmake
    Creating build_c++98_gcc-4.4
    CMake Error at /usr/local/share/cmake-3.20/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
      Could not find compiler set in environment variable CXX:
    
      g++-4.4.
    
    Call Stack (most recent call first):
      CMakeLists.txt:24 (project)
    
    
    CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    

    I am not familiar with CMake, and have no idea why g++ 4.4 is even tried, the g++ compiler version is:

    $ g++ --version
    g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ cmake --version
    cmake version 3.20.0
    
    CMake suite maintained and supported by Kitware (kitware.com/cmake).
    
    $ env | grep CXX
    CXX=/usr/bin/g++
    CMAKE_CXX_COMPILER=/usr/bin/g++
    
    opened by dingetje 1
  • No pretty trace if using compressed debug sections

    No pretty trace if using compressed debug sections

    If I used compressed debug sections (see https://maskray.me/blog/2022-01-23-compressed-debug-sections) I only get outputs like (using test_stacktraceand adding -gz to the cmake configuration for compiling and linking):

    Stack trace (most recent call last):
    #9    Object "", at 0xffffffffffffffff, in
    #8    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b52bad, in _start
    BFD: DWARF error: section .debug_info is larger than its filesize! (0x93ef57 vs 0x530ea0)
    #7    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff93e13c082, in __libc_start_main
    #6    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b5300c, in main
    #5    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b52cf9, in run_test(test::TestBase&, bool)
    #4    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b5314b, in test::TestBase::run()
    #3    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b5377a, in TEST_minitrace::do_test()
    #2    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b53724, in collect_trace(backward::StackTrace&)
    #1    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b545a9, in backward::StackTraceImpl<backward::system_tag::linux_tag>::load_here(unsigned long, void*, void*)
    #0    Object "/home/m/backward-cpp/build/test_stacktrace", at 0x562503b57cb5, in unsigned long backward::details::unwind<backward::StackTraceImpl<backward::system_tag::linux_tag>::callback>(backward::StackTraceImpl<backward::system_tag::linux_tag>::callback, unsigned long)
    -- test case success: minitrace
    

    Without the -gz flags everything works as expected and I get the source printed as expected.

    Not sure if there is an easy way to fix that.

    opened by mathiaswagner 0
Releases(v1.6)
  • v1.6(Aug 12, 2021)

    Notable additions:

    • RISC-V mcontext.
    • Support for Apple Silicon.
    • libunwind for Linux and macOS.
    • C++17 compatibility.

    The rest is all bug fixes.

    Summary of changes in no particular order.

    Alexey Ochapov (1):

    • 23b9050fc6cbaa3cfd62aa48d360a23629ab2c45 specify that variable values in stacktraces are not supported currently

    Andreas Schwab (1):

    • f5f329ff8255bbf111b774c494b96b8408b0d640 Add support for RISC-V mcontext

    Anonymous Maarten (4):

    • 7272606bc8aa6e24650f7cf85fc3f38be362bb60 Use lowercased Windows SDK headers
    • ee814f12b8a742aa84789aeeda1c0661195a7c48 Only define NOMINMAX if not defined already
    • 8bf0e1ce1aa939348c954b3cb0cf037a585984df Only do '#pragma comment(lib, "xxx.lib")' on MSVC
    • 146e2edaac9fad6910e4c337b540cab01d1a072f cmake: link to dbghelp, psapi and msvcr90 on mingw

    Brad Tighe (1):

    • 032207fcb943bd80067021ab862929ad9b6ea68e fix #208. TraceResolverImpl<system_tag::windows_tag> does not inherit from a base class, but as of #162 the resolve method is marked override, causing a compiler error.

    Christophe Bedard (3):

    • 2c9d878108649eaf360e7eaf0351d750c3d88760 Fix unushed parameter warnings
    • 9e20b2e70ba47851db6a2afe7837b2b88309b40d Add empty virtual destructor to TraceResolverImplBase base class
    • bfa0c9b5b54f43528538e3e56d857ef4b545fc08 Fix NAME_MISMATCHED arg error on CMake>=3.17

    Emre Ataseven (1):

    • 9f49ea34e1fa3071bb502c29b51a0f55d34b4b73 fix typo in variable name

    François-Xavier Bourlet (30):

    • 29e4061494e1ac4e40b2b09fd3e35c310ca137fc clang-format
    • e82d10769d880c442d3d49ccf87ddfd76f8033ee Remove outdated build status badge
    • f6f7253656159f225b88e03d38b2dec52f1e6258 Typo #elif -> #else

    Ilya A. Kriveshko (1):

    • 84b1111aacd14ebd667a90edca250627ee22d5db fix memory leak from demangle

    Martin Gerhardy (2):

    • 738e3c6c5ae168dcd7ad387508a42281faa87e46 Fix invalid memset call
    • d1ce8ba04b1ef23acc671746656aadd34f8dbbaf Fixed a few compile errors

    Michael Truog (1):

    • 74dd7d6733d1ab6b79994f4acbc1ad86ba950d23 Fix for C++ compilers without C++11

    Oliver Old (3):

    • c9f2b47c9b07e564cea757c121f6b7f6e0983f86 Don't pass buffer as format string and free buffer
    • 067fb096726af13c65bf0fe3bd02ab09a15a6e70 Fix wrong condition
    • d34e4601a7424d333e681c0f57436868192c28ca Fix indentation

    Pedro Navarro (3):

    • ca5480c220d461d8b4c3d04595718dc6a95402e0 Fix rare crash when looking for a function name
    • 6084a394a51935a115ecd9cb106f469b9c70a3f2 DW_AT_call_file is an unsigned value
    • a8a2efdeb9fe7ce72520d7e6db22032b06559f6c Added libunwind support to Linux and macOS

    Philip Rader (1):

    • 72970bfb17a8171211f7b5d300db844c2507a36a Add support for Apple Silicon

    Przemyslaw Olejniczak (1):

    • 4f1a69110957942cae704543667b0cb0431cf1e9 MSVC: does not compile with Unicode/Multi-Byte character set

    Tomislav Zubcic (1):

    • f7ad5142e1dee10065ca2bd23fbd585400d56fc9 Fix compilation issue on windows.

    Vladislav Shpilevoy (3):

    • 220eda3565b3320d71c4d9ae9734a3a0621b4f92 Introduce TraceResolver::load_addresses() for raw address array
    • a9b2ab504c5d7a2265302f8a76b1fe431035ff02 Make bfd_fileobject accessed by pointer
    • f09389529da71b0f6f89cafd982c809e9eb5de0f Use /proc/self/exe as the last resort for libbfd

    c99 (2):

    • 42df989165f28fe4fe788363a0750b6745eeb2ba Add for std::back_inserter
    • 5d1d61059e1727a7102f9641c970ff06bc5b1aed Fix printing stack trace under Windows.

    hshakula (1):

    • 0b4483f8e2143e35bc157d7bf76bcbdd063a2553 Fix compilation error with C++17 compiler

    rulerOfTheHuns (1):

    • 04efb6f55da72a7dfccb5ea76140a8b5e4e1095a fix output on windows #204

    tomdov (1):

    • 10c8df5c0044fc7e7af289e2e64977f9543acb0a size() may return negative number

    xgdgsc (2):

    • 643bccca4c916eabe25dc1e056e90dff54acda05 add note for folly users
    • 09059927fadc20e19c1934d597659f1f34413b0f fix #188. Cmake warning on find_package(Backward).
    Source code(tar.gz)
    Source code(zip)
  • v1.5(Apr 14, 2020)

    Summary of changes in no particular order.

    Arnaud Botella (1):

      Update BackwardConfig.cmake
    

    David P. Sicilia (5):

      Allow specifying list of source file search paths in environment variable.
      
      This is useful for binaries (using backward-cpp) that are built with
      relative source file paths.  In such a situation, backward-cpp will
      generally not be able to locate the source files.  This change allows
      the user to specify a delimited list of search paths in the following
      environment variable: BACKWARD_CXX_SOURCE_PREFIXES
    
      The paths are separated by semicolons on Windows and colons otherwise.
      When the environment variable is set, those search paths will be tried
      first.  If they do not yield any valid files then backward-cpp will
      fall back to current behavior.
    
      Address some reviewer comments:
      Use const char[] for delimiter string instead of macro.
      Put delimiter string into `backward::details` namespace.
    

    Evan Klitzke (2):

      fix a memory leak when __cxa_demangle reallocs
      fix bad pointer comparison in libdwarf backend
    

    Forrest Voight (3):

      Extracted duplicated code for `get_argv0` and `read_symlink`
      Handle executable being deleted or replaced by directly opening `/proc/self/exe` rather than file it links to. Fixes issue #146.
      Call std::getline with an lvalue std::ifstream rather than an rvalue. Older libstdc++ versions (e.g. 4.8.2) don't have the rvalue overload of std::getline. This fixes this error when compiled with libstdc++ 4.8.2:
    

    Jiaxun Yang (1):

      Add mips support
    

    John Salmon (2):

      Improve portability to non-glibc Linux systems
      StackTraceImpl::operator[] is const
    

    Marco Magdy (2):

      Add missing ref qualifier
      squash! Add missing ref qualifier to the other overload
    

    Michael Truog (2):

      Fix compilation for GCC (tested with 5.4.0)
      Fix for binutils 2.34
    

    Michal Rostecki (1):

      cmake: Use GNUInstallDirs for libdir and includedir
    

    Nikos Skalkotos (1):

      Fix unknown pragma warning in gcc
    

    Pierre Kestener (3):

      check if compiler is nvcc/nvcc_wrapper to trigger off cxx gnu extensions and pedantic error flags
      Merge branch 'master' of https://github.com/bombela/backward-cpp into nvcc_wrapper
      make sure to detect nvcc compiler even if used embedded in mpi compiler wrapper
    

    Zsolt Parragi (4):

      Build tests by default when backward is a top level project
      Use a macro instead of direct noinline attributes.
      Making tests less platform dependent.
      Windows (Clang9, MSVC2017) implementation
    
    Source code(tar.gz)
    Source code(zip)
  • v1.4(Jul 6, 2018)

    A bunch of updates, like better supports for cmake and conan. Small bug fixes. Various performance improvement. Support of ostream. Compilation with all sort of pedantic option turned on.

    Source code(tar.gz)
    Source code(zip)
Owner
François-Xavier Bourlet
let me: Rewrite = in.Rust()?;
François-Xavier Bourlet
Pretty Printer for Modern C++

Highlights Single header file Requires C++17 MIT License Quick Start Simply include pprint.hpp and you're good to go. #include <pprint.hpp> To start p

Pranav 879 Dec 22, 2022
NeoGB Printer an SD card-based standalone Game Boy Printer emulator.

An open-source and standalone Gameboy Printer emulator 100% compatible with all officially released games (110 in total) that support the accessory. Just print and save the images as BMP

Rafael Zenaro 85 Dec 22, 2022
A Game Boy Printer emulator that supports the Phomemo T02 printer

ESP32 + Phomemo T02 Game Boy Printer This project lets you print Game Boy Printer images via Bluetooth using a Phomemo T02 thermal printer and an ESP3

Jack Gaino 11 Aug 25, 2022
A C++ data container replicating std::stack functionality but with better performance than standard library containers in a stack context.

plf::stack A data container replicating std::stack functionality but with better performance than standard library containers in a stack context. C++9

Matt Bentley 47 Sep 11, 2022
A Linux x64 tool to trace registers and memory regions.

HellTracer Description A Linux x64 tool to trace registers and memory regions. Build the tool Clone the repository. Compile the tool with make. Add th

Aurélien Tournebise 29 Sep 8, 2022
Full Apex/EAC/Origin Trace Files Cleaner

Apex Cleaner Full Apex/EAC/Origin Trace Files Cleaner This is the best cleaner I've ever made. So this is a Full Apex Legends trace cleaner. Mostly my

Sarnax 74 Dec 25, 2022
Clang build analysis tool using -ftime-trace

Clang Build Analyzer Clang C/C++ build analysis tool when using Clang 9+ -ftime-trace. The -ftime-trace compiler flag (see blog post or Clang 9 releas

Aras Pranckevičius 716 Dec 25, 2022
android analysis tools, jni trace by native hook, libc hook, write log with caller's addr in file or AndroidLog

编译方法 unix like mkdir "build" cd build cmake .. -DNDK=your_ndk_path/Android/sdk/ndk/22.0.7026061 -DANDROID_ABI=armeabi-v7a make -j8 或者使用andriod studio编

pony 63 Dec 1, 2022
Legendware with a Beautiful Menu

Legendware with a Beautiful Menu. Some stuff has been changed but its nothing revolutionary

K4 49 Nov 28, 2022
making dwm as beautiful as possible

chadwm (Initial look) (empty workspaces have their color greyed out) NOTE: This is vanilla dwm bar (status2d patch for setting colors) not dwmblocks o

null 1k Dec 31, 2022
✨ Your best friend when it comes to making your output beautiful ✨

?? Fadey ✨ Your best friend when it comes to making your output beautiful ✨ ?? Content: About Requirements Installation Features Performance Shoutout

Fluffy 3 Nov 29, 2021
Making dwm as beautiful as possible!

chadwm (Initial look) (empty workspaces have their color greyed out) NOTE: This is vanilla dwm bar (status2d patch for setting colors) not dwmblocks o

null 1k Dec 31, 2022
2021 Fall Comp2012h Final Project. A Plant-Vs-Zombie style desktop game with beautiful graphics and sound effects. Developer: thomas914, mitester and tiliuau.

Underperforming Students vs Teachers Table of Contents Underperforming Students vs Teachers Table of Contents Authors Code Conventions Workflow Class

null 3 Apr 14, 2022
A header-only library for C++(0x) that allows automagic pretty-printing of any container.

cxx-prettyprint =============== A pretty printing library for C++ containers. Synopsis: Simply by including this header-only library in your sourc

Louis Delacroix 535 Nov 26, 2022
Juice the carrots from ウマ娘プリティーダービー (Umamusume Pretty Derby) - Android implementation

Riru-CarrotJuicer Hooks the decryption function in libnative.so of ウマ娘プリティーダービー (Umamusume Pretty Derby), to allow inspecting the packets. For Windows

Huang Yue 27 Aug 9, 2022
Localify "ウマ娘: Pretty Derby" DMM client

中文 赛马娘 (DMM版) 本地化补丁 使用方法: 将 version.dll 和 config.json 以及 config.json 中引用的字典放置于 umamusume.exe 边上 启动游戏 设置选项: enableConsole 启用用来输出调试信息的控制台 (true/false) e

GEEKiDoS 218 Dec 30, 2022
Juice the carrots from ウマ娘プリティーダービー (Umamusume Pretty Derby) - Windows implementation

Hooks the decryption function in libnative.dll of ウマ娘プリティーダービー (Umamusume Pretty Derby), to allow inspecting the packets (and provide some useful information during the game).

Huang Yue 81 Dec 16, 2022
Pretty much the repo name sums it up.

?? Console_Calculator Version Supported Date Ended Support v.1.0 ✔️ ?? Features The ?? Console_Calculator can do basic arithmatic, and yes there is no

Angelo Petrai 3 Dec 31, 2021
This project is pretty straightforward, you have to recode printf. You will learn what is and how to implement variadic functions. Once you validate it, you will reuse this function in your future projects.

100/100 Introduction to ft_printf This is the third project in the 1337 Curriculum #42network . This project is pretty straight forward, recode the pr

Zakaria Yacoubi 4 May 27, 2022
its a pretty dodo 0.1% os

Dodo OS why did i make this os? idk im bored and i wanted to learn alot of new stuff. so i decided to make dodo os. i will see for how far i will go i

Voidy Devleoper 5 Jan 4, 2022