From 9026d1803949f7131ae26983f473b44fa0dd06ed Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Tue, 9 Sep 2025 07:51:42 -0300 Subject: [PATCH] app: Make possible to append _NT_SYMBOL_PATH --- app/signals.c | 20 +++++++++++++++++--- libgimp/gimp.c | 23 ++++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/app/signals.c b/app/signals.c index effd4d63bd..cf65f6d695 100644 --- a/app/signals.c +++ b/app/signals.c @@ -53,7 +53,9 @@ void gimp_init_signal_handlers (gchar **backtrace_file) { time_t t; -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) && defined(ENABLE_RELOCATABLE_RESOURCES) + gchar *bin_dir; + size_t codeview_path_len; gchar *codeview_path; #endif gchar *filename; @@ -63,11 +65,23 @@ gimp_init_signal_handlers (gchar **backtrace_file) #endif #ifdef G_OS_WIN32 +#ifdef ENABLE_RELOCATABLE_RESOURCES /* FIXME: https://github.com/jrfonseca/drmingw/issues/91 */ - codeview_path = g_build_filename (gimp_installation_directory (), - "bin", NULL); + bin_dir = g_build_filename (gimp_installation_directory (), "bin", NULL); + codeview_path_len = strlen (g_getenv ("_NT_SYMBOL_PATH") ? g_getenv ("_NT_SYMBOL_PATH") : "") + strlen (bin_dir) + 2; + codeview_path = g_try_malloc (codeview_path_len); + if (codeview_path == NULL) + { + g_warning ("Failed to allocate memory"); + } + if (g_getenv ("_NT_SYMBOL_PATH")) + g_snprintf (codeview_path, codeview_path_len, "%s;%s", bin_dir, g_getenv ("_NT_SYMBOL_PATH")); + else + g_snprintf (codeview_path, codeview_path_len, "%s", bin_dir); g_setenv ("_NT_SYMBOL_PATH", codeview_path, TRUE); g_free (codeview_path); + g_free (bin_dir); +#endif /* This has to be the non-roaming directory (i.e., the local directory) as backtraces correspond to the binaries on this diff --git a/libgimp/gimp.c b/libgimp/gimp.c index cc7f1359d8..cea2d7b29e 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -227,16 +227,33 @@ gimp_main (GType plug_in_type, /* Use Dr. Mingw (dumps backtrace on crash) if it is available. */ { time_t t; +#ifdef ENABLE_RELOCATABLE_RESOURCES + gchar *plugin_dir; + size_t codeview_path_len; gchar *codeview_path; +#endif gchar *filename; gchar *dir; wchar_t *plug_in_backtrace_path_utf16; - /* FIXME: https://github.com/jrfonseca/drmingw/issues/91 */ - codeview_path = g_build_filename (gimp_installation_directory (), - "bin", NULL); +#ifdef ENABLE_RELOCATABLE_RESOURCES + /* FIXME: https://github.com/jrfonseca/drmingw/issues/91 + * FIXME: This needs to take into account the plugin path + plugin_dir = ??? + codeview_path_len = strlen (g_getenv ("_NT_SYMBOL_PATH") ? g_getenv ("_NT_SYMBOL_PATH") : "") + strlen (plugin_dir) + 2; + codeview_path = g_try_malloc (codeview_path_len); + if (codeview_path == NULL) + { + g_warning ("Failed to allocate memory"); + } + if (g_getenv ("_NT_SYMBOL_PATH")) + g_snprintf (codeview_path, codeview_path_len, "%s;%s", plugin_dir, g_getenv ("_NT_SYMBOL_PATH")); + else + g_snprintf (codeview_path, codeview_path_len, "%s", plugin_dir); g_setenv ("_NT_SYMBOL_PATH", codeview_path, TRUE); g_free (codeview_path); + g_free (plugin_dir);*/ +#endif /* This has to be the non-roaming directory (i.e., the local * directory) as backtraces correspond to the binaries on this