libgimpbase: display thread id of the calling thread as hexadecimal...

... on macOS.
The debugger running on macOS is usually lldb and (from the reports we
get) it looks like lldb displays the tid as hexadecimal on macOS
(whereas lldb displays decimal tid on Linux! I know, it's confusing, yet
consistent with crash report experience!). So let's just do the same,
making it easy to quickly copy-search in order to look up the crashing
thread (without having to convert from decimal to hexa).
This is a bit of an approximation as I imagine we could have gdb on
macOS or whatever edge case. Let's say it's good for the common case and
still not an error otherwise (just a base conversion away).
This commit is contained in:
Jehan 2019-01-25 01:07:39 +01:00
parent 9851bc8962
commit 8e0135362e
1 changed files with 11 additions and 2 deletions

View File

@ -1324,7 +1324,12 @@ gimp_stack_trace_print (const gchar *prog_name,
eintr_count = 0;
if (! stack_printed)
{
#if defined(G_OS_WIN32) || defined(SYS_gettid) || defined(HAVE_THR_SELF)
#if defined(PLATFORM_OSX)
if (stream)
g_fprintf (stream,
"\n# Stack traces obtained from PID %d - Thread 0x%lx #\n\n",
pid, tid);
#elif defined(G_OS_WIN32) || defined(SYS_gettid) || defined(HAVE_THR_SELF)
if (stream)
g_fprintf (stream,
"\n# Stack traces obtained from PID %d - Thread %lu #\n\n",
@ -1333,7 +1338,11 @@ gimp_stack_trace_print (const gchar *prog_name,
if (trace)
{
gtrace = g_string_new (NULL);
#if defined(G_OS_WIN32) || defined(SYS_gettid) || defined(HAVE_THR_SELF)
#if defined(PLATFORM_OSX)
g_string_printf (gtrace,
"\n# Stack traces obtained from PID %d - Thread 0x%lx #\n\n",
pid, tid);
#elif defined(G_OS_WIN32) || defined(SYS_gettid) || defined(HAVE_THR_SELF)
g_string_printf (gtrace,
"\n# Stack traces obtained from PID %d - Thread %lu #\n\n",
pid, tid);