Revision: 2127 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2127&view=re... Author: cesspit Date: 2011-08-06 21:58:41 +0000 (Sat, 06 Aug 2011)
Log Message: ----------- debugger plugin: - fixed bug with setting frame markers for files that are not open - adding frame markers on open file event if a current file has stack traced code
Modified Paths: -------------- trunk/geany-plugins/debugger/src/callbacks.c trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/debug.h trunk/geany-plugins/debugger/src/markers.c
Modified: trunk/geany-plugins/debugger/src/callbacks.c =================================================================== --- trunk/geany-plugins/debugger/src/callbacks.c 2011-08-06 21:02:48 UTC (rev 2126) +++ trunk/geany-plugins/debugger/src/callbacks.c 2011-08-06 21:58:41 UTC (rev 2127) @@ -112,6 +112,31 @@ g_list_free(breaks); }
+ /* set frames markers if exists */ + if (DBS_STOPPED == debug_get_state()) + { + GList *iter = debug_get_stack(); + if (iter) + { + frame *f = (frame*)iter->data; + if (f->have_source && !strcmp(f->file, file)) + { + markers_add_current_instruction(f->file, f->line); + } + + iter = iter->next; + while (iter) + { + f = (frame*)iter->data; + if (f->have_source && !strcmp(f->file, file)) + { + markers_add_frame(f->file, f->line); + } + iter = iter->next; + } + } + } + /* if debug is active - tell the debug module that a file was opened */ if (DBS_IDLE != debug_get_state()) debug_on_file_open(doc);
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-08-06 21:02:48 UTC (rev 2126) +++ trunk/geany-plugins/debugger/src/debug.c 2011-08-06 21:58:41 UTC (rev 2127) @@ -957,6 +957,14 @@ }
/* + * gets current stack frames lisy + */ +GList* debug_get_stack() +{ + return stack; +} + +/* * gets debug module index from name * arguments: * modulename - debug module name
Modified: trunk/geany-plugins/debugger/src/debug.h =================================================================== --- trunk/geany-plugins/debugger/src/debug.h 2011-08-06 21:02:48 UTC (rev 2126) +++ trunk/geany-plugins/debugger/src/debug.h 2011-08-06 21:58:41 UTC (rev 2127) @@ -34,25 +34,26 @@ /* function type to execute on interrupt */ typedef void (*bs_callback)(breakpoint*, break_set_activity);
-void debug_init(GtkWidget* nb); +void debug_init(GtkWidget* nb); enum dbs debug_get_state(); -void debug_run(); -void debug_stop(); -void debug_step_over(); -void debug_step_into(); -void debug_step_out(); -void debug_execute_until(gchar *file, int line); -gboolean debug_set_break(breakpoint* bp, break_set_activity bsa); -gboolean debug_remove_break(breakpoint* bp); -void debug_request_interrupt(bs_callback cb, breakpoint* bp, break_set_activity flags); +void debug_run(); +void debug_stop(); +void debug_step_over(); +void debug_step_into(); +void debug_step_out(); +void debug_execute_until(gchar *file, int line); +gboolean debug_set_break(breakpoint* bp, break_set_activity bsa); +gboolean debug_remove_break(breakpoint* bp); +void debug_request_interrupt(bs_callback cb, breakpoint* bp, break_set_activity flags); gchar* debug_error_message(); -GList* debug_get_modules(); -int debug_get_module_index(gchar *modulename); -gboolean debug_supports_async_breaks(); -void debug_destroy(); +GList* debug_get_modules(); +int debug_get_module_index(gchar *modulename); +gboolean debug_supports_async_breaks(); +void debug_destroy(); gchar* debug_evaluate_expression(gchar *expression); -gboolean debug_current_instruction_have_sources(); -void debug_jump_to_current_instruction(); -void debug_on_file_open(GeanyDocument *doc); -gchar* debug_get_calltip_for_expression(gchar* expression); +gboolean debug_current_instruction_have_sources(); +void debug_jump_to_current_instruction(); +void debug_on_file_open(GeanyDocument *doc); +gchar* debug_get_calltip_for_expression(gchar* expression); +GList* debug_get_stack();
Modified: trunk/geany-plugins/debugger/src/markers.c =================================================================== --- trunk/geany-plugins/debugger/src/markers.c 2011-08-06 21:02:48 UTC (rev 2126) +++ trunk/geany-plugins/debugger/src/markers.c 2011-08-06 21:58:41 UTC (rev 2127) @@ -213,8 +213,11 @@ void markers_add_current_instruction(char* file, int line) { GeanyDocument *doc = document_find_by_filename(file); - sci_set_marker_at_line(doc->editor->sci, line - 1, M_CI_ARROW); - sci_set_marker_at_line(doc->editor->sci, line - 1, M_CI_BACKGROUND); + if (doc) + { + sci_set_marker_at_line(doc->editor->sci, line - 1, M_CI_ARROW); + sci_set_marker_at_line(doc->editor->sci, line - 1, M_CI_BACKGROUND); + } }
/* @@ -223,9 +226,12 @@ void markers_remove_current_instruction(char* file, int line) { GeanyDocument *doc = document_find_by_filename(file); - sci_delete_marker_at_line(doc->editor->sci, line - 1, M_CI_ARROW); - sci_delete_marker_at_line(doc->editor->sci, line - 1, M_CI_BACKGROUND); - scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0); + if (doc) + { + sci_delete_marker_at_line(doc->editor->sci, line - 1, M_CI_ARROW); + sci_delete_marker_at_line(doc->editor->sci, line - 1, M_CI_BACKGROUND); + scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0); + } }
/* @@ -234,7 +240,10 @@ void markers_add_frame(char* file, int line) { GeanyDocument *doc = document_find_by_filename(file); - sci_set_marker_at_line(doc->editor->sci, line - 1, M_FRAME); + if (doc) + { + sci_set_marker_at_line(doc->editor->sci, line - 1, M_FRAME); + } }
/* @@ -243,6 +252,9 @@ void markers_remove_frame(char* file, int line) { GeanyDocument *doc = document_find_by_filename(file); - sci_delete_marker_at_line(doc->editor->sci, line - 1, M_FRAME); - scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0); + if (doc) + { + sci_delete_marker_at_line(doc->editor->sci, line - 1, M_FRAME); + scintilla_send_message(doc->editor->sci, SCI_SETFOCUS, TRUE, 0); + } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.