[gimp] app: add source-location information to GimpBacktrace



commit a6ec857123a2dae773716d941dbb5adb00d6d9cb
Author: Ell <ell_se yahoo com>
Date:   Mon Sep 3 15:34:39 2018 -0400

    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.

 app/core/gimpbacktrace-linux.c |  3 +++
 app/core/gimpbacktrace.h       |  3 +++
 app/widgets/gimpdashboard.c    | 37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)
---
diff --git a/app/core/gimpbacktrace-linux.c b/app/core/gimpbacktrace-linux.c
index 9e4f38d12b..a76b5be2ce 100644
--- a/app/core/gimpbacktrace-linux.c
+++ b/app/core/gimpbacktrace-linux.c
@@ -585,6 +585,9 @@ gimp_backtrace_get_address_info (guintptr                  address,
   info->symbol_address = (guintptr) dl_info.dli_saddr;
 #endif
 
+  info->source_file[0] = '\0';
+  info->source_line    = 0;
+
   return TRUE;
 }
 
diff --git a/app/core/gimpbacktrace.h b/app/core/gimpbacktrace.h
index ea676a2db5..a4ea2c2a30 100644
--- a/app/core/gimpbacktrace.h
+++ b/app/core/gimpbacktrace.h
@@ -31,6 +31,9 @@ struct _GimpBacktraceAddressInfo
 
   gchar    symbol_name[256];
   guintptr symbol_address;
+
+  gchar    source_file[256];
+  gint     source_line;
 };
 
 
diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c
index 7c3c90211c..f9b358a3f0 100644
--- a/app/widgets/gimpdashboard.c
+++ b/app/widgets/gimpdashboard.c
@@ -3899,6 +3899,43 @@ gimp_dashboard_log_write_address_map (GimpAsync     *async,
                 }
             }
 
+          if (n == 0 || strcmp (info->source_file, prev_info->source_file))
+            {
+              NONEMPTY ();
+
+              if (info->source_file[0])
+                {
+                  gimp_dashboard_log_printf (dashboard,
+                                             "<source>");
+                  gimp_dashboard_log_print_escaped (dashboard,
+                                                    info->source_file);
+                  gimp_dashboard_log_printf (dashboard,
+                                             "</source>\n");
+                }
+              else
+                {
+                  gimp_dashboard_log_printf (dashboard,
+                                             "<source />\n");
+                }
+            }
+
+          if (n == 0 || info->source_line != prev_info->source_line)
+            {
+              NONEMPTY ();
+
+              if (info->source_line)
+                {
+                  gimp_dashboard_log_printf (dashboard,
+                                             "<line>%d</line>\n",
+                                             info->source_line);
+                }
+              else
+                {
+                  gimp_dashboard_log_printf (dashboard,
+                                             "<line />\n");
+                }
+            }
+
           if (empty)
             {
               gimp_dashboard_log_printf (dashboard,


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