Revision: 1171 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1171&view=re... Author: kugel- Date: 2010-03-15 16:43:26 +0000 (Mon, 15 Mar 2010)
Log Message: ----------- Run gdb with LANG=C to avoid locale-related clashes when parsing the gdb output for the localized version break- and watchpoints.
Use new utils_copy_environment() which was recently added to the plugin api.
Modified Paths: -------------- trunk/geany-plugins/geanygdb/ChangeLog trunk/geany-plugins/geanygdb/src/gdb-io-run.c trunk/geany-plugins/geanygdb/src/gdb-ui-break.c
Modified: trunk/geany-plugins/geanygdb/ChangeLog =================================================================== --- trunk/geany-plugins/geanygdb/ChangeLog 2010-03-15 16:43:04 UTC (rev 1170) +++ trunk/geany-plugins/geanygdb/ChangeLog 2010-03-15 16:43:26 UTC (rev 1171) @@ -1,3 +1,9 @@ +2010-03-15 Thomas Martitz thomas.martitz@student.htw-berlin.de + + * src/gdb-io-run.c, src/gdb-ui-break.c: Run gdb with LANG=C to avoid + locale-related clashes when parsing the gdb output for the localized version + break- and watchpoints + 2010-03-01 Dominic Hopf dmaphy@googlemail.com
* src/gdb-io-run.c, src/gdb-io-read.c: Improve the way a running process gets
Modified: trunk/geany-plugins/geanygdb/src/gdb-io-run.c =================================================================== --- trunk/geany-plugins/geanygdb/src/gdb-io-run.c 2010-03-15 16:43:04 UTC (rev 1170) +++ trunk/geany-plugins/geanygdb/src/gdb-io-run.c 2010-03-15 16:43:26 UTC (rev 1171) @@ -22,6 +22,7 @@ #include <string.h>
#include "geanyplugin.h" +extern GeanyFunctions *geany_functions; #include "gdb-io-priv.h"
@@ -724,8 +725,15 @@ gdbio_load(const gchar * exe_name) { GError *err = NULL; + /* need to execute gdb with LANG=C because we parse the output + * for break and watch points + * however, the debugged applications ought to run under the + * systems locale (i.e. the current LANG) */ + const gchar *exclude[] = { "LANG", NULL }; + gchar **gdbio_env = utils_copy_environment(exclude, "LANG", "C", NULL); + const gchar *env_lang = g_getenv("LANG"); gdbio_exit(); - if (g_spawn_async_with_pipes(NULL, gdbio_args, NULL, + if (g_spawn_async_with_pipes(NULL, gdbio_args, gdbio_env, GDB_SPAWN_FLAGS, NULL, NULL, &gdbio_pid, &gdbio_in, &gdbio_out, NULL, &err)) { @@ -748,6 +756,8 @@ gdbio_id_out = g_io_add_watch(gdbio_ch_out, G_IO_IN, on_read_from_gdb, NULL);
gdbio_send_cmd("-gdb-set width 0\n-gdb-set height 0\n"); + /* restore LANG for apps here, gdb is under LANG=C */ + gdbio_send_cmd("-gdb-set environment LANG=%s\n", env_lang); if (exe_name) { load_target(exe_name); @@ -757,6 +767,7 @@ { gerror("Error starting debugger.", &err); } + g_strfreev(gdbui_env); }
Modified: trunk/geany-plugins/geanygdb/src/gdb-ui-break.c =================================================================== --- trunk/geany-plugins/geanygdb/src/gdb-ui-break.c 2010-03-15 16:43:04 UTC (rev 1170) +++ trunk/geany-plugins/geanygdb/src/gdb-ui-break.c 2010-03-15 16:43:26 UTC (rev 1171) @@ -351,7 +351,7 @@ { continue; } - if ((bpi) && (strstr(bpi->type, is_watchlist ? _("watchpoint") : _("breakpoint")))) + if (strstr(bpi->type, is_watchlist ? "watchpoint" : "breakpoint")) { return TRUE; } @@ -405,7 +405,7 @@ GdbBreakPointInfo *bpi = p->data; if (bpi) { - gboolean iswatch = !g_str_equal(_("breakpoint"), bpi->type); + gboolean iswatch = !g_str_equal("breakpoint", bpi->type); if (is_watchlist != iswatch) { continue;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.