Revision: 2124 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2124&view=re... Author: cesspit Date: 2011-08-06 13:30:45 +0000 (Sat, 06 Aug 2011)
Log Message: ----------- debugger plugin: - fixing gdb output parsing bug - adjusting margin click breakpoint switching behaviour
Modified Paths: -------------- trunk/geany-plugins/debugger/src/breakpoints.c trunk/geany-plugins/debugger/src/breakpoints.h trunk/geany-plugins/debugger/src/callbacks.c trunk/geany-plugins/debugger/src/dbm_gdb.c
Modified: trunk/geany-plugins/debugger/src/breakpoints.c =================================================================== --- trunk/geany-plugins/debugger/src/breakpoints.c 2011-08-06 10:15:27 UTC (rev 2123) +++ trunk/geany-plugins/debugger/src/breakpoints.c 2011-08-06 13:30:45 UTC (rev 2124) @@ -504,18 +504,22 @@ * file - breakpoints filename * line - breakpoints line */ -gboolean breaks_is_set(char* file, int line) +break_state breaks_get_state(char* file, int line) { + break_state bs = BS_NOT_SET; + /* first look for the tree for the given file */ GTree *tree; - if (!(tree = g_hash_table_lookup(files, file))) - return FALSE; - else + if (tree = g_hash_table_lookup(files, file)) { - /* lookup for the break in GTree*/ - gpointer p = g_tree_lookup(tree, GINT_TO_POINTER(line)); - return p && ((breakpoint*)p)->enabled; + breakpoint *bp = g_tree_lookup(tree, GINT_TO_POINTER(line)); + if (bp) + { + bs = bp->enabled ? BS_ENABLED : BS_DISABLED; + } } + + return bs; }
/*
Modified: trunk/geany-plugins/debugger/src/breakpoints.h =================================================================== --- trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-06 10:15:27 UTC (rev 2123) +++ trunk/geany-plugins/debugger/src/breakpoints.h 2011-08-06 13:30:45 UTC (rev 2124) @@ -19,6 +19,12 @@ * MA 02110-1301, USA. */
+typedef enum _break_state { + BS_NOT_SET, + BS_ENABLED, + BS_DISABLED +} break_state; + typedef void (*move_to_line_cb)(char* file, int line);
gboolean breaks_init(move_to_line_cb callback); @@ -30,7 +36,7 @@ void breaks_set_hits_count(char* file, int line, int count); void breaks_set_condition(char* file, int line, char* condition); void breaks_move_to_line(char* file, int line_from, int line_to); -gboolean breaks_is_set(char* file, int line); +break_state breaks_get_state(char* file, int line); GtkWidget* breaks_get_widget(); GList* breaks_get_for_document(char* file); GList* breaks_get_all();
Modified: trunk/geany-plugins/debugger/src/callbacks.c =================================================================== --- trunk/geany-plugins/debugger/src/callbacks.c 2011-08-06 10:15:27 UTC (rev 2123) +++ trunk/geany-plugins/debugger/src/callbacks.c 2011-08-06 13:30:45 UTC (rev 2124) @@ -134,11 +134,14 @@ char* file = editor->document->file_name; int line = sci_get_line_from_position(editor->sci, nt->position) + 1; - - if (!breaks_is_set(file, line)) + + break_state bs = breaks_get_state(file, line); + if (BS_NOT_SET == bs) breaks_add(file, line, NULL, TRUE, 0); - else + else if (BS_ENABLED == bs) breaks_remove(file, line); + else if (BS_DISABLED == bs) + breaks_switch(file, line); scintilla_send_message(editor->sci, SCI_SETFOCUS, TRUE, 0); @@ -261,10 +264,14 @@ if (doc) { int line = sci_get_current_line(doc->editor->sci) + 1; - if (!breaks_is_set(DOC_FILENAME(doc), line)) + break_state bs = breaks_get_state(DOC_FILENAME(doc), line); + if (BS_NOT_SET == bs) breaks_add(DOC_FILENAME(doc), line, NULL, TRUE, 0); - else + else if (BS_ENABLED == bs) breaks_remove(DOC_FILENAME(doc), line); + else if (BS_DISABLED == bs) + breaks_switch(DOC_FILENAME(doc), line); + scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0); } break;
Modified: trunk/geany-plugins/debugger/src/dbm_gdb.c =================================================================== --- trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-08-06 10:15:27 UTC (rev 2123) +++ trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-08-06 13:30:45 UTC (rev 2124) @@ -799,12 +799,11 @@ int num = atoi(bstart); bstart += strlen(bstart) + 1; - bstart = strstr(bstart, "fullname="") + strlen("fullname=""); - *strchr(bstart, '"') = '\0'; + bstart = strstr(bstart, "original-location="") + strlen("original-location=""); + *strchr(bstart, ':') = '\0'; gchar *fname = bstart; bstart += strlen(bstart) + 1; - bstart = strstr(bstart, "line="") + strlen("line=""); *strchr(bstart, '"') = '\0'; int bline = atoi(bstart);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org