[gimp/wip/bug792787-debug-stacktrace-GUI: 2/2] app: add lldb as backtrace-creator alternative to gdb.



commit 3e901cda8f3fc06ea78ae175e00b993ca3045eee
Author: Jehan <jehan girinstud io>
Date:   Fri Jan 26 18:12:56 2018 +0100

    app: add lldb as backtrace-creator alternative to gdb.
    
    It seems that on some platforms (macOS in particular), this may be more
    common to have.

 app/errors.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/app/errors.c b/app/errors.c
index e194274..4dea4e6 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -385,6 +385,28 @@ gimp_get_stack_trace (void)
     {
       g_free (gdb_stdout);
     }
+  if (! trace)
+    {
+      /* Alternatively, use LLDB. It seems to be more common on some
+       * platforms, especially macOS.
+       */
+      gchar *args_lldb[11] = { "lldb", "--attach-pid", NULL, "--batch",
+                               "--one-line", "bt",
+                               "--one-line-on-crash", "bt",
+                               "--one-line-on-crash", "quit", NULL };
+
+      args_lldb[2] = pid;
+      if (g_spawn_sync (NULL, args_lldb, NULL,
+                        G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
+                        NULL, NULL, &gdb_stdout, NULL, NULL, NULL))
+        {
+          trace = g_strdup (gdb_stdout);
+        }
+      else if (gdb_stdout)
+        {
+          g_free (gdb_stdout);
+        }
+    }
 
 #endif
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]