253 Commits

Author SHA1 Message Date
4715c7a2b4 addded support qmake build system 2020-09-09 13:30:47 +03:00
François-Xavier Bourlet
1efdd145b5
Merge pull request #180 from pedronavf/patch-2
Fix rare crash when looking for a function name
2020-08-05 23:54:43 -07:00
Pedro Navarro
ca5480c220
Fix rare crash when looking for a function name
If we fall back to DWARF processing trying to find a function name we deallocated the wrong object because of a copy/paste error. This part of the code was hit only very rarely, which made this bug undetected for a long time.
2020-08-05 23:39:39 -07:00
François-Xavier Bourlet
6203f1fd08
Merge pull request #178 from tomdov/patch-2
Underflow in size() if stacktrace is smaller than skip_n_firsts()
2020-07-21 13:54:22 -07:00
tomdov
10c8df5c00
size() may return negative number
this will cause super-mega long loop (from ~max size_t till 0)
2020-07-21 21:29:53 +03:00
François-Xavier Bourlet
29e4061494 clang-format 2020-05-04 15:01:55 -07:00
Martin Gerhardy
738e3c6c5a Fix invalid memset call
Also reformat another memset call, for consistency.

Closes #170
2020-05-04 14:59:51 -07:00
François-Xavier Bourlet
cc475eb3b0
Merge pull request #166 from okeuday/without_c++11_compatibility
Fix for C++ compilers without C++11
2020-04-14 17:55:01 -07:00
Michael Truog
74dd7d6733
Fix for C++ compilers without C++11 2020-04-14 13:28:11 -07:00
François-Xavier Bourlet
83da75636c
Merge pull request #165 from okeuday/binutils_2.34
Fix for binutils 2.34
v1.5
2020-04-13 19:24:48 -07:00
Michael Truog
6174c26f76
Fix for binutils 2.34
* For macro changes at https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fd3619828e94a24a92cddec42cbc0ab33352eeb4
2020-04-13 15:42:46 -07:00
François-Xavier Bourlet
03b45955d0
Merge pull request #164 from forrestv/getline_lvalue
Call `std::getline` with an lvalue `std::ifstream` rather than an rvalue
2020-04-13 09:44:11 -07:00
Forrest Voight
f66f422fef 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:

ext/backward-cpp/backward.hpp: In static member function 'static std::string backward::TraceResolverLinuxBase::get_argv0()':
ext/backward-cpp/backward.hpp:1031:66: error: no matching function for call to 'getline(std::ifstream, std::string&, char)'
     std::getline(std::ifstream("/proc/self/cmdline"), argv0, '\0');
                                                                  ^
ext/backward-cpp/backward.hpp:1031:66: note: candidates are:
/usr/include/c++/4.8/bits/basic_string.h:2799:5: note: std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::basic_string<_CharT, _Traits, _Alloc>&, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
     getline(basic_istream<char>& __in, basic_string<char>& __str,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2799:5: note:   no known conversion for argument 1 from 'std::ifstream {aka std::basic_ifstream<char>}' to 'std::basic_istream<char>&'
2020-04-13 02:50:29 -05:00
François-Xavier Bourlet
1ab8c87754
Merge pull request #154 from dpacbach/master
Allow specifying list of source file search paths in environment var
2020-03-02 16:11:43 -08:00
David P. Sicilia
c122f1f988 Put delimiter string into backward::details namespace. 2020-02-27 11:24:40 -05:00
David P. Sicilia
b30401a81f Use const char[] for delimiter string instead of macro. 2020-02-27 11:13:19 -05:00
David P. Sicilia
4053b2e2e3 Address some reviewer comments:
1. Make path splitting function less generic.
  2. Improve efficiency of emptiness test on C string.
  3. Cache result of splitting environment variable.
2020-02-26 17:23:52 -05:00
David P. Sicilia
257e5e57a0 Merge branch 'master' of https://github.com/bombela/backward-cpp 2020-02-26 16:58:21 -05:00
François-Xavier Bourlet
c51737a75c
Merge pull request #158 from eklitzke/dwarf_file_handle
fix bad pointer comparison in libdwarf backend
2020-02-10 12:40:54 -08:00
François-Xavier Bourlet
a15d29c076
Merge pull request #157 from eklitzke/master
fix a memory leak when __cxa_demangle reallocs
2020-02-10 12:40:13 -08:00
Evan Klitzke
10764bbffc
fix bad pointer comparison in libdwarf backend 2020-01-25 11:01:30 -08:00
Evan Klitzke
dd8af2505e
fix a memory leak when __cxa_demangle reallocs 2020-01-25 10:55:02 -08:00
David P. Sicilia
96007bd8e7 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.
2019-12-24 17:34:06 -05:00
François-Xavier Bourlet
4e7e988595
Merge pull request #143 from dutow/win-support
Windows support
2019-12-04 15:36:07 -08:00
Zsolt Parragi
7cbf4c25e9 Windows (Clang9, MSVC2017) implementation
Remaining issues:
* some warinings
2019-11-29 12:33:22 +01:00
Zsolt Parragi
ec14c48e3e Making tests less platform dependent.
Tests executables made several assumptions that are only valid on
some system/compiler:

* That the main function is found even in a shared library (not true
  on windows). To fix this, test_main is now an ojbect library
* That the extern test_registry in test.cpp will be initialized
  before any actual test uses it. This was either a lucky coincidence
  on linux, or being related to the variable being initialized in a
  shared library. The variable is now initialized by a function,
  guarantaaing initialization order.
* That test.hpp is only inluded once per binary, which was only true
  because it was once part of a DLL, once the executable, hiding ODR
  violations. As now it's linked twice within the same binary, some
  functions had to be made inline.
* not is not a valid C++ operator, replaced all occurences with !
2019-11-29 12:16:13 +01:00
Zsolt Parragi
4dfd5e6e24 Use a macro instead of direct noinline attributes.
This is a prerequisite of MSVC support, as it uses a different syntax.
2019-11-29 12:15:54 +01:00
Zsolt Parragi
7cf5ece17d Build tests by default when backward is a top level project 2019-11-29 12:15:50 +01:00
François-Xavier Bourlet
377cd4b66c
Merge pull request #150 from FlyGoat/master
Add mips support
2019-11-23 08:15:34 -08:00
Jiaxun Yang
3cec08149d Add mips support
MIPS didn't export regs at mcontext_t so we need to cast it as sigcontext.
All test passed on my mips64el machine.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
2019-11-23 21:34:56 +08:00
François-Xavier Bourlet
aa3f253efc
Merge pull request #147 from forrestv/issue146
Fix for issue #146
2019-09-25 11:20:36 -07:00
Forrest Voight
1ecbdc6491 Handle executable being deleted or replaced by directly opening
`/proc/self/exe` rather than file it links to. Fixes issue #146.
2019-09-25 12:52:52 -05:00
Forrest Voight
79e7738e1f Extracted duplicated code for get_argv0 and read_symlink 2019-09-23 14:17:45 -05:00
François-Xavier Bourlet
2831aaaf61
Merge pull request #142 from bombela/clang-format
clang-format
2019-09-05 16:12:11 -07:00
François-Xavier Bourlet
9fb93a08aa clang-format 2019-09-05 13:41:10 -07:00
François-Xavier Bourlet
db6adef8ab
Merge pull request #144 from johnsalmon/master
Improve portability to non-glibc Linux systems
2019-08-29 11:33:53 -07:00
François-Xavier Bourlet
e50dff5a38
Merge pull request #114 from BotellaA/patch-1
Update BackwardConfig.cmake
2019-08-29 10:37:52 -07:00
John Salmon
af2debf91e StackTraceImpl::operator[] is const
This is only matters when compiling with -DBACWARD_SYSTEM_UNKNOWN.
2019-08-25 20:56:27 -04:00
John Salmon
80af93580f Improve portability to non-glibc Linux systems
Linux is not synonymous with glibc.  Alpine linux (among others) uses
libmusl as the standard C library.  Alpine/libmusl doesn't have
backtrace, dladdr1, execinfo.h or error.h.  It does have libunwind
and program_invocation_name and libdwarf and libelf are available as
packages.

This patch makes backward-cpp work on Alpine linux (and hopefully
others that rely on libmusl).

This patch makes dladdr1 dependent on the __GLIBC__ pp-symbol
(rather than __ANDROID__).

It uses __has_include (protected by a defined()) rather than __APPLE__
to decide whether to include <error.h> in _test_main.cpp.
2019-08-25 20:34:28 -04:00
François-Xavier Bourlet
27349d0a75
Merge pull request #137 from marcomagdy/missing-ref-qualifier
Add missing ref qualifier
2019-06-06 12:32:28 -07:00
Marco Magdy
9c4c163583 squash! Add missing ref qualifier to the other overload 2019-06-03 15:29:56 +00:00
Marco Magdy
fb4a00d1f8
Add missing ref qualifier
returning a `const T` as opposed to `const T&` serves little purpose and is most likely not what the writer intended.
This change was called out by clang-tidy.
2019-06-01 10:26:18 -07:00
François-Xavier Bourlet
98747968ad
cmake_minimum_required 2.8.12 -> 3.0
Closes #131
2019-05-07 06:37:45 -07:00
François-Xavier Bourlet
b353585d4b
Merge pull request #128 from skalkoto/fix-gcc-unknown-pragma-warning
Fix unknown pragma warning in gcc
2018-11-26 11:43:33 -08:00
Nikos Skalkotos
b7ffd640ec Fix unknown pragma warning in gcc
Check if the compiler is clang before using clang only pragma statements.
2018-11-06 14:05:47 +02:00
François-Xavier Bourlet
936c1c0f28
Merge pull request #126 from mrostecki/gnuinstalldirs
cmake: Use GNUInstallDirs for libdir and includedir
2018-10-23 07:08:35 -07:00
Michal Rostecki
d4f6779afb cmake: Use GNUInstallDirs for libdir and includedir
The comon practice in cmake to allow to specify the libdir or
includedir using GNUInstallDirs which introduces the following
options:

* CMAKE_INSTALL_INCLUDEDIR
* CMAKE_INSTALL_LIBDIR

The main motivation behind this change is ability to use /usr/lib64
instead of /usr/lib as a libdir.
2018-10-22 16:20:08 +02:00
François-Xavier Bourlet
a5adc5a866
Merge pull request #120 from pkestene/nvcc_wrapper
Make backward-cpp compatible with nvcc_wrapper
2018-09-22 23:20:48 -07:00
François-Xavier Bourlet
06cfe31a34
Merge pull request #125 from okeuday/master
Fix compilation for GCC (tested with 5.4.0)
2018-09-22 23:20:17 -07:00
Michael Truog
7539d53b54
Fix compilation for GCC (tested with 5.4.0) 2018-09-22 19:10:56 -07:00