[gimp] libgimpbase: consistent gimp_stack_trace namespace for stack trace functions
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpbase: consistent gimp_stack_trace namespace for stack trace functions
- Date: Thu, 22 Feb 2018 11:44:03 +0000 (UTC)
commit 374fee451c17e19003cd4fabde890e3680ece61e
Author: Michael Natterer <mitch gimp org>
Date: Thu Feb 22 12:35:43 2018 +0100
libgimpbase: consistent gimp_stack_trace namespace for stack trace functions
Change the rest of the source accordingly.
NEWS | 3 +-
app/dialogs/preferences-dialog.c | 2 +-
app/errors.c | 6 ++--
app/gui/gui-message.c | 3 +-
libgimp/gimp.c | 4 +-
libgimpbase/gimpbase.def | 5 ++-
libgimpbase/gimputils.c | 73 +++++++++++++++++++------------------
libgimpbase/gimputils.h | 6 ++--
8 files changed, 53 insertions(+), 49 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3e2afce..61735be 100644
--- a/NEWS
+++ b/NEWS
@@ -68,7 +68,8 @@ Libgimp:
procedures. If for instance, a second-level plug-in is interrupted
interactively, we don't want to process this as an error but as a
cancellation.
- - New gimp_print_stack_trace() and gimp_on_error_query() for debug.
+ - New gimp_stack_trace_available(), gimp_stack_trace_print() and
+ gimp_stack_trace_query() for debugging.
GUI and Usability:
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 37fab9a..9384ce6 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1244,7 +1244,7 @@ prefs_dialog_new (Gimp *gimp,
* which case the feature is always available.
*/
hbox = NULL;
- if (! gimp_utils_backtrace_available (TRUE))
+ if (! gimp_stack_trace_available (TRUE))
{
#ifndef HAVE_EXECINFO_H
hbox = prefs_hint_box_new (GIMP_ICON_DIALOG_WARNING,
diff --git a/app/errors.c b/app/errors.c
index 6072462..930b627 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -322,7 +322,7 @@ gimp_eek (const gchar *reason,
* and is waiting for us in a text file.
*/
fd = g_fopen (backtrace_file, "w");
- has_backtrace = gimp_print_stack_trace ((const gchar *) full_prog_name,
+ has_backtrace = gimp_stack_trace_print ((const gchar *) full_prog_name,
fd, NULL);
fclose (fd);
#endif
@@ -357,7 +357,7 @@ gimp_eek (const gchar *reason,
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
- gimp_on_error_query ((const gchar *) full_prog_name);
+ gimp_stack_trace_query ((const gchar *) full_prog_name);
}
break;
@@ -368,7 +368,7 @@ gimp_eek (const gchar *reason,
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
- gimp_print_stack_trace ((const gchar *) full_prog_name,
+ gimp_stack_trace_print ((const gchar *) full_prog_name,
stdout, NULL);
}
break;
diff --git a/app/gui/gui-message.c b/app/gui/gui-message.c
index 0559bc3..6e93b22 100644
--- a/app/gui/gui-message.c
+++ b/app/gui/gui-message.c
@@ -127,6 +127,7 @@ gui_message (Gimp *gimp,
}
g_mutex_unlock (&mutex);
}
+
if (gen_trace)
{
/* We need to create the trace here because for multi-thread
@@ -134,7 +135,7 @@ gui_message (Gimp *gimp,
* function will simply be useless. It needs to happen in the
* buggy thread to be meaningful.
*/
- gimp_print_stack_trace (NULL, NULL, &trace);
+ gimp_stack_trace_print (NULL, NULL, &trace);
}
if (g_strcmp0 (GIMP_ACRONYM, domain) != 0)
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index cf767a2..e1de1ef 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -1917,7 +1917,7 @@ gimp_plugin_sigfatal_handler (gint sig_num)
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
- gimp_on_error_query (progname);
+ gimp_stack_trace_query (progname);
}
break;
@@ -1927,7 +1927,7 @@ gimp_plugin_sigfatal_handler (gint sig_num)
sigemptyset (&sigset);
sigprocmask (SIG_SETMASK, &sigset, NULL);
- gimp_print_stack_trace (progname, stdout, NULL);
+ gimp_stack_trace_print (progname, stdout, NULL);
}
break;
}
diff --git a/libgimpbase/gimpbase.def b/libgimpbase/gimpbase.def
index 6bd44eb..794ec4c 100644
--- a/libgimpbase/gimpbase.def
+++ b/libgimpbase/gimpbase.def
@@ -110,7 +110,6 @@ EXPORTS
gimp_micro_version
gimp_minor_version
gimp_offset_type_get_type
- gimp_on_error_query
gimp_orientation_type_get_type
gimp_paint_application_mode_get_type
gimp_param_memsize_get_type
@@ -150,7 +149,6 @@ EXPORTS
gimp_plug_in_directory
gimp_plug_in_directory_file
gimp_precision_get_type
- gimp_print_stack_trace
gimp_progress_command_get_type
gimp_rectangle_intersect
gimp_rectangle_union
@@ -160,7 +158,10 @@ EXPORTS
gimp_select_criterion_get_type
gimp_signal_private
gimp_size_type_get_type
+ gimp_stack_trace_available
gimp_stack_trace_mode_get_type
+ gimp_stack_trace_print
+ gimp_stack_trace_query
gimp_strip_uline
gimp_stroke_method_get_type
gimp_sysconf_directory
diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c
index d3dbbcd..c088a9c 100644
--- a/libgimpbase/gimputils.c
+++ b/libgimpbase/gimputils.c
@@ -1086,7 +1086,39 @@ gimp_flags_value_get_abbrev (GFlagsClass *flags_class,
}
/**
- * gimp_print_stack_trace:
+ * gimp_stack_trace_available:
+ * @optimal: whether we get optimal traces.
+ *
+ * Returns #TRUE if we have dependencies to generate backtraces. If
+ * @optimal is #TRUE, the function will return #TRUE only when we
+ * are able to generate optimal traces (i.e. with GDB or LLDB);
+ * otherwise we return #TRUE even if only backtrace() API is available.
+ *
+ * On Win32, we return TRUE if Dr. Mingw is built-in, FALSE otherwise.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_stack_trace_available (gboolean optimal)
+{
+#ifndef G_OS_WIN32
+ if (gimp_utils_gdb_available (7, 0) ||
+ gimp_utils_lldb_available (0, 0))
+ return TRUE;
+#ifdef HAVE_EXECINFO_H
+ if (! optimal)
+ return TRUE;
+#endif
+#else /* G_OS_WIN32 */
+#ifdef HAVE_EXCHNDL
+ return TRUE;
+#endif
+#endif /* G_OS_WIN32 */
+ return FALSE;
+}
+
+/**
+ * gimp_stack_trace_print:
* @prog_name: the program to attach to.
* @stream: a #FILE * stream.
* @trace: location to store a newly allocated string of the trace.
@@ -1114,7 +1146,7 @@ gimp_flags_value_get_abbrev (GFlagsClass *flags_class,
* Since: 2.10
**/
gboolean
-gimp_print_stack_trace (const gchar *prog_name,
+gimp_stack_trace_print (const gchar *prog_name,
gpointer stream,
gchar **trace)
{
@@ -1273,7 +1305,7 @@ gimp_print_stack_trace (const gchar *prog_name,
}
/**
- * gimp_on_error_query:
+ * gimp_stack_trace_query:
* @prog_name: the program to attach to.
*
* This is mostly the same as g_on_error_query() except that we use our
@@ -1284,7 +1316,7 @@ gimp_print_stack_trace (const gchar *prog_name,
* Since: 2.10
**/
void
-gimp_on_error_query (const gchar *prog_name)
+gimp_stack_trace_query (const gchar *prog_name)
{
#ifndef G_OS_WIN32
gchar buf[16];
@@ -1312,7 +1344,7 @@ gimp_on_error_query (const gchar *prog_name)
else if ((buf[0] == 'S' || buf[0] == 's')
&& buf[1] == '\n')
{
- if (! gimp_print_stack_trace (prog_name, stdout, NULL))
+ if (! gimp_stack_trace_print (prog_name, stdout, NULL))
g_fprintf (stderr, "%s\n", "Stack trace not available on your system.");
goto retry;
}
@@ -1321,37 +1353,6 @@ gimp_on_error_query (const gchar *prog_name)
#endif
}
-/**
- * gimp_utils_backtrace_available:
- * @optimal: whether we get optimal traces.
- *
- * Returns #TRUE if we have dependencies to generate backtraces. If
- * @optimal is #TRUE, the function will return #TRUE only when we
- * are able to generate optimal traces (i.e. with GDB or LLDB);
- * otherwise we return #TRUE even if only backtrace() API is available.
- *
- * On Win32, we return TRUE if Dr. Mingw is built-in, FALSE otherwise.
- *
- * Since: 2.10
- **/
-gboolean
-gimp_utils_backtrace_available (gboolean optimal)
-{
-#ifndef G_OS_WIN32
- if (gimp_utils_gdb_available (7, 0) ||
- gimp_utils_lldb_available (0, 0))
- return TRUE;
-#ifdef HAVE_EXECINFO_H
- if (! optimal)
- return TRUE;
-#endif
-#else /* G_OS_WIN32 */
-#ifdef HAVE_EXCHNDL
- return TRUE;
-#endif
-#endif /* G_OS_WIN32 */
- return FALSE;
-}
/* Private functions. */
diff --git a/libgimpbase/gimputils.h b/libgimpbase/gimputils.h
index a759767..b2d9170 100644
--- a/libgimpbase/gimputils.h
+++ b/libgimpbase/gimputils.h
@@ -75,11 +75,11 @@ const gchar * gimp_flags_value_get_help (GFlagsClass *flags_class,
const gchar * gimp_flags_value_get_abbrev (GFlagsClass *flags_class,
GFlagsValue *flags_value);
-gboolean gimp_print_stack_trace (const gchar *prog_name,
+gboolean gimp_stack_trace_available (gboolean optimal);
+gboolean gimp_stack_trace_print (const gchar *prog_name,
gpointer stream,
gchar **trace);
-void gimp_on_error_query (const gchar *prog_name);
-gboolean gimp_utils_backtrace_available (gboolean optimal);
+void gimp_stack_trace_query (const gchar *prog_name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]