Commit Graph

15 Commits

Author SHA1 Message Date
Ell
d86d017980 app: in GimpBacktrace Linux backend, don't leak backtrace when dropping threads
Should have been part of commit
a29d040db5.

(cherry picked from commit 01f9409902)
2018-12-01 04:33:48 -05:00
Ell
31acea2cf7 app: in GimpBacktrace Linux backend, make blacklisted_thread_names const
(cherry picked from commit c749097dcc)
2018-12-01 03:52:36 -05:00
Ell
fafeb7bf07 app: a few improvements to the GimpBacktrace Linux backend
Blacklist the "threaded-ml" thread, which seems to mask the
backtrace signal.

Improve signal-handler synchronozation, to avoid segfaulting when
giving up on waiting for all threads to handle the signal.
Furthermore, when one or more threads fail to handle the signal in
time, return a GimpBacktrace instance with backtraces for all the
other threads, and with empty backtraces for all the non-responding
threads, instead of returning NULL and leaking the allocated
instance.  Don't blacklist threads that failed to handle the signal
in time, and instead shorten the wait period for handling the
signal, and yield execution during waiting to lower the CPU usage.

(cherry picked from commit a29d040db5)
2018-11-07 14:26:40 -05:00
Ell
b1cba6b142 app: always use libunwind for symbol names in GimpBacktrace Linux backend
In the GimpBacktrace Linux backend, always use libunwind, when
available, to find symbol names, even if dladdr() or libbacktrace
had already found one.  libunwind provides more descriptive names
in certain cases, and, in particular, full symbol names for C++
lambdas.

Note that, in some cases, this can result in a discrepancy between
the reported symbol name, and the corresponding source location.

(cherry picked from commit 72fc01742b)
2018-10-11 03:35:30 -04:00
Ell
b065ff7de7 app: add source location information to the Linux GimpBacktrace backend
When libbacktrace is available, use it to retrieve source location
information in the Linux GimpBacktrace backend.

(cherry picked from commit 7cdd1ebeef)
2018-09-22 22:39:17 -04:00
Ell
896af012cb app: in gimpbacktrace-linux, use SA_RESTART for the backtrace signal
(cherry picked from commit e8c1cd79ba)
2018-09-16 09:00:20 -04:00
Ell
468a4ad109 app: more cleanup in GimpBacktrace
Improve out-of-range check in gimp_backtrace_find_thread_by_id().

Remove unnecessary #include <exchndl.h> in gimpbacktrace-windows.c,
and revert commit 644234e99d (the
DrMingw detection happens at runtime).  The Windows backend can
work without DrMingw, it just can't find all the symbols, and
doesn't provide source-location information.

(cherry picked from commit b9f1ab8f53)
2018-09-05 14:59:58 -04:00
Ell
0fcf02a7c6 app, tools: add "running" thread attribute to GimpBacktrace/performance-log
The "running" attribute (readable through
gimp_backtrace_is_thread_running(), and recorded in the performance
log) specifies if the thread was in a running or suspended state at
the time the backtrace was taken.  It is accurate on Linux, but
only approximated on Windows.

Adapt the performance-log-expand.py tool to maintain this attribute
(and any future thread attributes we might add).

(cherry picked from commit 78adb7c900)
2018-09-03 18:30:34 -04:00
Ell
21f708a297 app: add source-location information to GimpBacktrace
Add source filename and line number fields to the
GimpBacktraceAddressInfo struct, populated through
gimp_backtrace_get_address_info().  This is not currently supported
by the Linux backend, but is supported by the Windows backend,
which we'll be added in the next commit.

(cherry picked from commit a6ec857123)
2018-09-03 15:58:01 -04:00
Ell
06a22a9cf8 app: more GimpBacktrace tidying
... in preparation for the Windows backend.

(cherry picked from commit 422f6a55e4)
2018-09-03 15:58:01 -04:00
Ell
d89930cac9 app: remove unused #define in gimpbacktrace-linux.c
(cherry picked from commit c4d89bfe0b)
2018-09-02 14:33:32 -04:00
Ell
14c3c33f1b app: rename gimp_backtrace_get_symbol_info() to ..._get_address_info()
This function returns information about the given address, which
is currently mostly limited to the corresponding symbol
information, but we might want to add address-specific information
in the future, such as a line number.

(cherry picked from commit 7ac87dc01e)
2018-09-02 13:26:09 -04:00
Ell
dd1a17d67e app: remove stray g_printerr() from gimpbacktrace-linux.c
(cherry picked from commit 0d3647f854)
2018-09-02 09:13:36 -04:00
Ell
14addc12e8 app: minor cleanup in GimpBacktrace
(cherry picked from commit cb8dd047d0)
2018-09-02 09:08:26 -04:00
Ell
536fc332e0 app: add GimpBacktrace
GimpBacktrace provides an interface for creating and traversing
multi-threaded backtraces, as well as querying symbol information.
While we already have some backtrace functionality, it relies on
external tools for the most part, and as such is rather expensive,
and is only meant for producing opaque backtraces.  GimpBacktrace,
on the other hand, is meant to be relatively cheap (we're going to
use it for profiling,) and allow inspection of the backtrace data.
In the future, it might make sense to replace some, or all, of the
other backtrace functions with GimpBacktrace.

GimpBacktrace currently only supports Linux.  By default, it uses
dladdr() to query symbol information, which is somewhat limited (in
particular, it doesn't work for static functions.)  When libunwind
is installed, GimpBacktrace uses it to get more complete symbol
information.  libunwind is currently an optional dependency, but it
might make sense to promote it to a mandatory, or opt-out,
dependency, as it's lightweight and widely available.

On other platforms, the GimpBacktrace interface can still be used,
but it always returns NULL backtraces.

(cherry picked from commit 80bf686c94)
2018-09-02 03:24:51 -04:00