Revision: 2222 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2222&view=re... Author: cesspit Date: 2011-10-03 12:02:11 +0000 (Mon, 03 Oct 2011) Log Message: ----------- debugger: gdb errors handling, casting warnings
Modified Paths: -------------- trunk/geany-plugins/debugger/src/dbm_gdb.c trunk/geany-plugins/debugger/src/dconfig.c trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/debug.h trunk/geany-plugins/debugger/src/debug_module.h trunk/geany-plugins/debugger/src/dpaned.c
Modified: trunk/geany-plugins/debugger/src/dbm_gdb.c =================================================================== --- trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-10-03 12:02:11 UTC (rev 2222) @@ -251,6 +251,7 @@ * asyncronous gdb output reader * looks for a stopped event, then notifies "debug" module and removes async handler */ +enum dbs debug_get_state(); static gboolean on_read_from_gdb(GIOChannel * src, GIOCondition cond, gpointer data) { gchar *line; @@ -276,7 +277,9 @@ target_pid = atoi(line + strlen("=thread-group-created,id="")); } else if (g_str_has_prefix(line, "=library-loaded") || g_str_has_prefix(line, "=library-unloaded")) + { file_refresh_needed = TRUE; + } else if (*line == '*') { /* asyncronous record found */ @@ -296,19 +299,6 @@ /* removing read callback (will pulling all output left manually) */ g_source_remove(gdb_id_out);
- /* update autos */ - update_autos(); - - /* update watches */ - update_watches(); - - /* update files */ - if (file_refresh_needed) - { - update_files(); - file_refresh_needed = FALSE; - } - /* looking for a reason to stop */ char *next = NULL; char *reason = strstr(record, "reason="") + strlen("reason=""); @@ -325,8 +315,22 @@ else if (!strcmp(reason, "exited-signalled")) stop_reason = SR_EXITED_SIGNALLED; + if (SR_BREAKPOINT_HIT == stop_reason || SR_END_STEPPING_RANGE == stop_reason) { + /* update autos */ + update_autos(); + + /* update watches */ + update_watches(); + + /* update files */ + if (file_refresh_needed) + { + update_files(); + file_refresh_needed = FALSE; + } + dbg_cbs->set_stopped(); } else if (stop_reason == SR_SIGNAL_RECIEVED) @@ -339,16 +343,22 @@ dbg_cbs->set_stopped(); } else if (stop_reason == SR_EXITED_NORMALLY || stop_reason == SR_EXITED_SIGNALLED) + { stop(); + } } } else if (g_str_has_prefix (line, "^error")) { - dbg_cbs->set_stopped(); - /* removing read callback (will pulling all output left manually) */ g_source_remove(gdb_id_out);
+ /* set debugger stopped if is running */ + if (DBS_STOPPED != debug_get_state()) + { + dbg_cbs->set_stopped(); + } + /* get message */ char *msg = strstr(line, "msg="") + strlen("msg=""); *strrchr(msg, '"') = '\0';
Modified: trunk/geany-plugins/debugger/src/dconfig.c =================================================================== --- trunk/geany-plugins/debugger/src/dconfig.c 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/dconfig.c 2011-10-03 12:02:11 UTC (rev 2222) @@ -347,7 +347,7 @@ { case CP_TABBED_MODE: { - g_key_file_set_boolean(keyfile_plugin, "tabbed_mode", "enabled", (gboolean)config_value); + g_key_file_set_boolean(keyfile_plugin, "tabbed_mode", "enabled", *((gboolean*)config_value)); break; } case CP_OT_TABS: @@ -358,7 +358,7 @@ } case CP_OT_SELECTED: { - g_key_file_set_integer(keyfile_plugin, "one_panel_mode", "selected_tab_index", (int)config_value); + g_key_file_set_integer(keyfile_plugin, "one_panel_mode", "selected_tab_index", *((int*)config_value)); break; } case CP_TT_LTABS: @@ -369,7 +369,7 @@ } case CP_TT_LSELECTED: { - g_key_file_set_integer(keyfile_plugin, "two_panels_mode", "left_selected_tab_index", (int)config_value); + g_key_file_set_integer(keyfile_plugin, "two_panels_mode", "left_selected_tab_index", *((int*)config_value)); break; } case CP_TT_RTABS: @@ -380,7 +380,7 @@ } case CP_TT_RSELECTED: { - g_key_file_set_integer(keyfile_plugin, "two_panels_mode", "right_selected_tab_index", (int)config_value); + g_key_file_set_integer(keyfile_plugin, "two_panels_mode", "right_selected_tab_index", *((int*)config_value)); break; } }
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/debug.c 2011-10-03 12:02:11 UTC (rev 2222) @@ -622,7 +622,7 @@ /* clear calltips cache */ g_hash_table_remove_all(calltips);
- /* if the stop was requested for asyncronous exitig - + /* if a stop was requested for asyncronous exiting - * stop debug module and exit */ if (exit_pending) { @@ -631,8 +631,8 @@ return; }
- /* if the stop was requested for asyncronous exitig - - * stop debug module and exit */ + /* if a restart was requested for asyncronous exiting - + * restart debug module and exit */ if (restart_pending) { active_module->restart(); @@ -847,7 +847,6 @@ static void on_debugger_error (const gchar* message) { dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", message); - debug_stop(); }
/* callbacks structure to pass to debugger module */
Modified: trunk/geany-plugins/debugger/src/debug.h =================================================================== --- trunk/geany-plugins/debugger/src/debug.h 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/debug.h 2011-10-03 12:02:11 UTC (rev 2222) @@ -22,15 +22,6 @@ #include "debug_module.h" #include "markers.h"
-/* debug states enumeration */ -enum dbs { - DBS_IDLE, - DBS_STOPPED, - DBS_STOP_REQUESTED, - DBS_RUNNING, - DBS_RUN_REQUESTED, -}; - /* function type to execute on interrupt */ typedef void (*bs_callback)(gpointer);
Modified: trunk/geany-plugins/debugger/src/debug_module.h =================================================================== --- trunk/geany-plugins/debugger/src/debug_module.h 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/debug_module.h 2011-10-03 12:02:11 UTC (rev 2222) @@ -19,6 +19,15 @@ * MA 02110-1301, USA. */
+/* debug states enumeration */ +enum dbs { + DBS_IDLE, + DBS_STOPPED, + DBS_STOP_REQUESTED, + DBS_RUNNING, + DBS_RUN_REQUESTED, +}; + /* type to hold callbacks to call from debugger modules */ typedef struct _dbg_callbacks { void (*set_run) ();
Modified: trunk/geany-plugins/debugger/src/dpaned.c =================================================================== --- trunk/geany-plugins/debugger/src/dpaned.c 2011-10-03 08:50:46 UTC (rev 2221) +++ trunk/geany-plugins/debugger/src/dpaned.c 2011-10-03 12:02:11 UTC (rev 2222) @@ -202,7 +202,7 @@ config_set_panel( config_part_tabs, array, - config_part_selected_index, page_num, + config_part_selected_index, &page_num, 0 ); @@ -261,7 +261,7 @@ else config_part = CP_TT_RSELECTED; - config_set_panel(config_part, (gpointer)arg2, 0); + config_set_panel(config_part, (gpointer)&arg2, 0);
return TRUE; } @@ -429,5 +429,5 @@ CONNECT_PAGE_SIGNALS();
- config_set_panel(CP_TABBED_MODE, (gpointer)tabbed, 0); + config_set_panel(CP_TABBED_MODE, (gpointer)&tabbed, 0); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org