Tobias Brunner
21af89f941
backtrace: Add ability to lookup function names via libbfd
...
dladdr() is not always able to determine the function names while
libbfd often can in such cases.
2022-12-02 14:57:47 +01:00
Tobias Brunner
2bf110d9f8
backtrace: Fix build with newer MinGW versions
...
A recent change added CALLBACK to PENUM_PAGE_FILE_CALLBACKW/A in psapi.h,
which conflicts with our own macro of the same name. Our compat/windows.h
header undefs the Windows definition, but that only works if Windows
headers are included before ours, which wasn't the case for psapi.h.
2022-11-10 13:44:21 +01:00
Tobias Brunner
27da024a5d
backtrace: Only define print_sourceline() and esc() if actually used
2022-10-03 17:36:17 +02:00
Tobias Brunner
19ef2aec15
Update copyright headers after acquisition by secunet
2022-06-28 10:22:56 +02:00
Tobias Brunner
f0a20dd2b8
backtrace: The BFD API changed in newer versions
2021-05-05 16:17:54 +02:00
Tobias Brunner
1b67166921
Unify format of HSR copyright statements
2018-05-23 16:32:53 +02:00
Tobias Brunner
95a63bf281
Migrate all enumerators to venumerate() interface change
2017-05-26 13:56:44 +02:00
Tobias Brunner
c71e6820ab
backtrace: Fix symbol lookup in dynamic symtab via libbfd
2014-10-14 17:26:48 +02:00
Tobias Brunner
0e48f67562
backtrace: Remove name checks after SymFromAddr() calls
...
The Name member is an array whose address is always defined.
2014-07-02 12:11:59 +02:00
Martin Willi
8c2c63e09d
backtrace: Use GetModuleInformation/GetModuleFileNameEx directly on Win32
...
The K32 variants are actually needed on 64-bit only.
2014-06-06 16:28:28 +02:00
Martin Willi
087e02e47e
backtrace: Inline esc() helper, making it available to all build variants
2014-06-04 15:52:58 +02:00
Martin Willi
2127831cda
backtrace: Support backtraces on Windows without DbgHelp
...
While DbgHelp provides a convenient API to create backtraces, any executable
linking against DbgHelp gets a more than a significant slow down. Further, it
can only lookup global symbols, as it expects PDB files we can't produce with a
MinGW build.
With some core Kernel32.dll functionality, we can capture stack traces much
faster. Together with the optional libbfd, we can print very fine backtraces.
When --enable-bfd-backtraces is used on Windows, a libbfd.dll is required for
the build. Such a DLL can be created from the binutils sources using:
# build binutils with mingw...
# extract archive members from binutils libraries
x86_64-w64-mingw32-ar x $BINUTILS/bfd/.libs/libbfd.a
x86_64-w64-mingw32-ar x $BINUTILS/intl/libintl.a
x86_64-w64-mingw32-ar x $BINUTILS/libiberty/libiberty.a
# create self-contained libbfd.a, with index
x86_64-w64-mingw32-ar qs libbfd.a *.o
# create DLL from static library
x86_64-w64-mingw32-dlltool -e libbfd.o -l libbfd.lib libbfd.a
x86_64-w64-mingw32-gcc -shared libbfd.a libbfd.o -o libbfd.dll
2014-06-04 15:52:58 +02:00
Martin Willi
a7e943a640
backtrace: Add DbgHelp based Windows support for creating/printing backtraces
2014-06-04 15:52:57 +02:00
Martin Willi
7a13990964
backtrace: Support backtracing even if library is not initialized
...
But of course backtracing must be initialized anyway using backtrace_init().
2013-11-06 10:31:00 +01:00
Martin Willi
a24515c515
backtrace: rename clone() method clashing with system call
...
Fixes #376 .
2013-08-09 09:13:39 +02:00
Martin Willi
d9c459e855
backtrace: add a clone() method
2013-07-10 17:28:18 +02:00
Martin Willi
ad58246f53
backtrace: use backtrace_symbols() only if we have backtrace() and dladdr() fails
2013-06-19 16:09:31 +02:00
Martin Willi
29324299fe
backtrace: use atos instead of addr2line on OS X to resolve source lines
2013-05-06 15:15:24 +02:00
Martin Willi
83714577a9
backtrace: add an alternative stack unwinding implementation using libunwind
2013-05-06 15:15:24 +02:00
Tobias Brunner
2b1e2434e4
esc() is only used if dladdr(3) is available
2013-03-08 16:45:09 +01:00
Martin Willi
b668f1417d
Don't invoke addr2line if dladdr() did not yield a filename
2013-03-04 15:50:21 +01:00
Martin Willi
fe03f51302
backtrace_t.log() takes a NULL file pointer to log to registered dbg() hook
2013-03-04 15:45:03 +01:00
Martin Willi
8b24863b1f
Don't use color escapes when printing backtraces to a non-TTY file
2013-03-04 15:07:03 +01:00
Tobias Brunner
12642a6831
Moved data structures to new collections subfolder
2012-10-24 16:00:49 +02:00
Tobias Brunner
d5962b874f
Compilation error fixed if dladdr is not available
2012-07-14 11:43:40 +02:00
Martin Willi
40ae0feeb1
Silence cast warning on 32-bit platforms
2012-07-13 13:43:16 +02:00
Martin Willi
0e3c697c05
Don't set BFD_DECOMPRESS when building against older binutils
2012-07-13 13:42:31 +02:00
Martin Willi
4c6c934635
With --enable-bfd-backtraces, use binutils libbfd to resolve backtraces
...
The invocation of addr2line to resolve backtrace source locations
is slow and cumbersome. When using libbfd directly, we can eliminate
the overhead of the process invocation. Even better, we can cache
library symbol names, bringing wicked fast lookups. As a neat bonus,
we can resolve static function names.
2012-07-13 13:23:29 +02:00
Martin Willi
32400cd91a
Added a convenience function to dump backtraces for gdb-less debugging
2012-05-21 12:18:49 +02:00
Martin Willi
61a141d01c
Added a frame enumerator to backtrace_t
2011-05-16 15:22:21 +02:00
Martin Willi
c238e8ea86
Added an equals function to backtrace_t
2011-05-16 15:22:21 +02:00
Martin Willi
79edee7422
Migrated backtrace_t to METHOD macro
2011-05-16 15:22:21 +02:00
Tobias Brunner
8e4da8f2e8
Use %tx to print a value of type ptrdiff_t.
2011-04-14 18:11:46 +02:00
Martin Willi
b94feb4b05
backtrace->contains_function takes multiple names, speeding up whitelist check drastically
2011-01-17 18:19:44 +01:00
Martin Willi
091d178060
Option to skip slow addr2line resolution in leak-detective
2010-05-20 17:37:18 +02:00
Martin Willi
80252c8a46
Store return value of getc() in an int to correctly test it against EOF
2009-10-22 13:13:06 +02:00
Martin Willi
7daf5226b7
removed trailing spaces ([[:space:]]+$)
2009-09-04 13:46:09 +02:00
Tobias Brunner
8c5d72cd0b
removing svn keyword $Id$ from all files
2009-04-30 13:19:35 +00:00
Andreas Steffen
6319cd74ea
pluto uses the libstrongswan leak detective and a stripped-down version of library_t
2009-04-16 08:25:47 +00:00
Martin Willi
ebf0e20ae7
fixed leak
...
fixed build if !HAVE_BACKTRACE
2008-11-06 14:05:58 +00:00
Martin Willi
f7237cf37a
separated backtrace functionality from leak_detective, used in
...
leak_detective
mutex profiling
signal handler
2008-11-05 13:58:19 +00:00