74 Commits

Author SHA1 Message Date
Arkadiusz Piekarz
f8b6d76dd2 Fix compilation on GCC with -Wsign-conversion by using static_cast 2018-05-05 18:53:52 +02:00
Arkadiusz Piekarz
127243ca9f Fix compilation on GCC with -Wold-style-cast by using static_cast and reinterpret_cast 2018-05-05 18:53:52 +02:00
François-Xavier Bourlet
8f76407505
Merge pull request #102 from pedronavf/patch-2
Added instruction pointer for 32 bit OS X
2018-05-05 08:00:16 -07:00
François-Xavier Bourlet
5319fb3cc6
Merge pull request #103 from pedronavf/patch-3
Remove warning about unused variable 'info"
2018-05-05 07:55:54 -07:00
François-Xavier Bourlet
b75f050edd
Merge pull request #104 from clnperez/linux_defines
add check for __linux__
2018-05-05 07:54:51 -07:00
Pedro Navarro
2ba1296b5f libdwarf/libelf implementation 2018-05-01 12:02:59 -07:00
Christy Norman
98528c1405 add check for __linux__
Some compiler flags and/or compilers will set this instead. There are
undoubtedly others but I know this fixes my problem.

The flag that I'm currently seeing alter this is `-std=c++0x`.

Signed-off-by: Christy Norman <christy@linux.vnet.ibm.com>
2018-04-02 15:56:08 -04:00
Pedro Navarro
a18aa777bc
Remove warning about unused variable 'info"
On some platforms we got a warning about 'info' not being used because the #if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L was not true. Can't remember which platform right now but this patch addressed it.
2018-03-30 11:56:15 -07:00
Pedro Navarro
91c92d94b6
Added instruction pointer for 32 bit OS X 2018-03-30 11:51:10 -07:00
Pedro Navarro
c25d2e0f8e Remove override warnings in C++11 builds (#100)
GCC shows warnings (like:

warning: 'virtual std::streamsize backward::cfile_streambuf::xsputn(const char_type*, std::streamsize)' can be marked override [-Wsuggest-override] 

In the cfile_streambuf class. This patch #defines override to be nothingness in C++98 and adds the override keyword to the functions with the warnings.
2018-03-27 20:38:50 -07:00
Stephan Zuercher
44ae9609e8 functional mac port (#70)
* functional mac port

* combine common parts of Linux and Darwin implementations

* add unwind support for apple

* insure BACKWARD_HAS_BACKTRACE_SYMBOL is set for BACKWARD_SYSTEM_DARWIN

* fix indentation

* use pthread_self and pthread_main_np
2018-02-06 22:43:16 -08:00
preetikhorjuvenkar
4ebf74018e Added s390x support code. 2018-01-30 05:09:30 +00:00
tdowns
2221a39225 one more more const correction addition, review changes 2017-12-01 13:12:38 -06:00
tdowns
3f45d70f42 make operator[](size_t) for StackTrace const 2017-11-17 23:42:59 -06:00
Forrest Voight
7a9229f57c Handle dladdr not returning the true location of the executable, but merely argv[0]. see issue #80
If an executable is run by e.g. being on the PATH (anything that results in argv[0] not being a valid
path to the executable), problems ensue when backward-cpp tries to print a stack trace.

dladdr returns argv[0] in dli_fname for symbols contained in the main executable, which is not a valid
path if the executable was found by a search of the PATH environment variable. Then, load_object_with_bfd
is called on that non-existent filename and fails.

The implemented solution is to detect `dladdr` returning `argv[0]` and replace it with the executable's
path, read from the /proc/self/exe symlink.
2017-11-08 22:20:42 -05:00
Forrest Voight
bd862932e5 Fixed memory leak in demangle()
abi::__cxa_demangle returns null and does nothing with output_buffer on failure, resulting in previous value of _demangle_buffer being leaked
2017-11-08 22:13:48 -05:00
Forrest Voight
d62c9fefd9 Fixed bfd_close being called on null pointer if bfd_fdopenr returns null 2017-11-08 22:13:48 -05:00
Georgios Bitzes
d29afac746 Allow running sighandler logic as part of a cleanup chain
In our code, we need to take certain cleanup actions
after receiving a SIGSEGV. This makes it difficult to
integrate with backward, as our custom sighandler is overriden.

A simple solution is to have backward-cpp expose the
core sighandling logic as a public function, which
we can simply call from within our code. This is not
currently possible since sig_handler is private, and
additionally raises the signal again at the end.

This pull request makes the above possible. The alternative
is to copy handleSignal into our own code, which is just ugly.
2017-10-31 11:25:15 +01:00
Dāvis Mosāns
884a7c39a3 Fix data type conversion warnings 2017-09-13 15:06:38 +03:00
Dāvis Mosāns
cd155ec977 Remove SIGUNUSED, it doesn't exist anymore
This fixes #71
2017-09-13 15:06:24 +03:00
François-Xavier Bourlet
857bc8fc31 Merge pull request #67 from chsterz/feature/aarch64-support
Add aarch64 support
2017-07-03 15:11:25 -07:00
Rafal Crypto Tigusoft
89b77f96b9
Fix the ip==0 workaround to skip opening-parentheses 2017-06-29 14:33:54 +00:00
Christoph Sterz
61876549f1 Add aarch64 support
*Read the pc as specified for aarch64 processors.
*Disable division by zero tests, since aarch64 does not trap these and
 therefore does not generate SIGFPEs there.
*All other tests succeed.
2017-06-29 15:12:18 +02:00
Rafal Crypto Tigusoft
e1bf45fd0c
After review pr#66 2017-06-29 10:57:04 +00:00
Rafal Crypto Tigusoft
dd552a10c8
fix off-by-one when resolve goes up to ip==0 frame 2017-06-29 10:57:04 +00:00
François-Xavier Bourlet
f9f732ddeb Merge pull request #63 from rfree-d/fix_warning_ip_minus1
To pass sanitization, do not rely on underflow 0-1
2017-06-28 11:40:58 -07:00
Govind Sahai
9ecb5c6bf3 Added _ to remove warning 2017-06-25 00:21:05 +05:30
Rafal Crypto Tigusoft
7430bea233
Fixed problem with decltype (on older compiler/travis) 2017-06-22 17:08:30 +00:00
Rafal Crypto Tigusoft
4fc30f7ce6
To pass sanitization, do not rely on underflow 0-1
for ip==0, we sometimes calculate ip-=1.
ip is unsigned, so this is an underflow.

This is not strictly an UB, but more pedantic sanitizers
do catch this and report as possible error.

So why not instead just explicitly set value 0xffff...
(result of 0-1) and avoid this warnings.
2017-06-22 16:35:40 +00:00
François-Xavier Bourlet
8eb8fad38f Add color mode.
This is a breaking change.

The printer now offers a color_mode setting: automatic, always, never.

When given a FILE* stream on linux, the automatic mode will retrieve
file descriptor behind it and call isatty().
2017-05-28 17:03:29 -07:00
François-Xavier Bourlet
c432e7ef8d Merge branch 'print-to-streams' of https://github.com/ogdf/backward-cpp into ogdf-print-to-streams 2017-05-28 15:16:29 -07:00
François-Xavier Bourlet
71dafcb203 Merge pull request #60 from ogdf/g++7-warnings
Fix g++ 7.0.1 warnings
2017-03-29 14:36:47 -07:00
François-Xavier Bourlet
6ae8564fbd enable tests that somebody thought it was a good idea to permanently disable. 2017-03-15 17:32:15 -07:00
François-Xavier Bourlet
5557e53f23 Only catch signals with a default action of "Core"
Close #59
2017-03-15 17:01:35 -07:00
Stephan Beyer
f147949e65 Fix -Wshadow warnings from g++ 7.0.1 2017-03-05 19:14:41 +01:00
Stephan Beyer
df124abe08 Fix -Wimplicit-fallthrough warning from g++ 7.0.1
The fallthrough (missing break after a case in a switch) is
not necessary. We can just move the whole default code move
down after the switch.
2017-03-05 19:13:50 +01:00
Kevin Funk
f76d7299be Fix -Wmissing-noreturn warning from Clang 2017-02-21 16:08:25 +01:00
Anton Kreuzkamp
a1ab90920b Use && instead of and.
Operator names are not supported by MSVC out of the box. Using them
breaks code that needs to build with MSVC and/or (thus) uses
"-fno-operator-names". As a header-only library should pursue maximal
portability, this commit replaces the single usage of operator names
with the more portable operator syntax.
2017-02-21 10:15:45 +01:00
Rui Pires
82de54d6e4 adds support for ppc architecture 2016-12-12 21:38:27 +00:00
François-Xavier Bourlet
e371aa91e3 Merge pull request #44 from ogdf/make-skip-public
Make StackTraceImpl*::skip_n_firsts() setter public
2016-11-17 11:39:35 -08:00
Stephan Beyer
f046d0d5dd Make StackTraceImpl*::skip_n_firsts() setter public
When the stack trace is used directly (and not by a signal),
one may want to hide some of the first stack items because
they will always be the same calls.
2016-10-28 18:59:51 +02:00
Stephan Beyer
3e7d61f670 Printer: Make context sizes configurable 2016-10-27 17:35:45 +02:00
Stephan Beyer
e8ec7beb1e Let Colorizer reset on initialization 2016-10-25 21:50:21 +02:00
Stephan Beyer
bda53f29f9 Make Printer::print methods available for streams 2016-10-25 21:50:21 +02:00
Milian Wolff
ad84214192 Define PACKAGE and PACKAGE_VERSION before including bfd.h
On ArchLinux at least the bfd.h header errors out early if
PACKAGE or PACKAGE_VERSION have not been set. This patch
makes backward.hpp compile on this platform for me.
2016-06-01 10:33:52 +02:00
Manu343726
74cd785e61 Add ARM support 2016-05-04 10:50:22 +02:00
Anton Kreuzkamp
f1b70b1ef7 Rename variable "signals" to "unix_signals".
This change is needed for compatibility to Qt applications.

Qt defines a macro "signals" that expands to nothing and is used by
Qt's meta object compiler (which is kind of a C++ pre-processor) to
add signal-slot feature (http://doc.qt.io/qt-5/signalsandslots.html).
This will cause compilation of backward.hpp to fail, when used from a
Qt application, because the variable "signals" will be expanded to ""
by the cpp pre processor.
2016-04-07 18:26:20 +02:00
Edison Gustavo Muenz
c3ed021828 Replace usages of alternative usages of boolean operators with more more standard ones since they don't compile in Visual Studio 2010.
Replacements are:
- 'and' => '&&'
- 'or'  => '||'
- 'not' => '!'

Also added some missing includes since MSVC was complaining of missing
symbols.
2015-09-10 12:12:55 -03:00
Edison Gustavo Muenz
7b3e9511ef Compilers with GLIBC < 2.10 don't have the psiginfo() function 2015-08-28 18:01:53 -03:00
hesiod
7a56ae336a Fix compilation warning under clang
Clang complains about adding const to a reference type having no effect.
Fix this by adding and using a const_ref_t.
2014-10-18 18:35:13 +02:00