/* * called from debug module when debugger is being stopped */ static void on_debugger_stopped (int thread_id) { /* update debug state */ debug_state = DBS_STOPPED; /* update buttons panel state */ if (!interrupt_data) { btnpanel_set_debug_state(debug_state); } /* clear calltips cache */ g_hash_table_remove_all(calltips); /* if a stop was requested for asyncronous exiting - * stop debug module and exit */ if (exit_pending) { active_module->stop(); exit_pending = FALSE; return; } /* check for async activities pending */ if (interrupt_data) { interrupt_cb(interrupt_data); interrupt_data = NULL; active_module->resume(); return; } /* clear stack tree view */ stree_set_active_thread_id(thread_id); /* get current stack trace and put in the tree view */ stack = active_module->get_stack(); GList *iter = stack; while (iter) { frame *f = (frame*)iter->data; stree_add(f); iter = g_list_next(iter); } stree_select_first_frame(TRUE); /* files */ GList *files = active_module->get_files(); /* remove from list and make writable those files, that are not in the current list */ iter = read_only_pages; while (iter) { if (!g_list_find_custom(files, iter->data, (GCompareFunc)g_strcmp0)) { /* set document writable */ GeanyDocument *doc = document_find_by_real_path((const gchar*)iter->data); if (doc) scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, 0, 0); /* free file name */ g_free(iter->data); /* save next item pointer */ GList *next = iter->next; /* remove current item */ read_only_pages = g_list_delete_link(read_only_pages, iter); /* set next item and continue */ iter = next; continue; } iter = iter->next; } /* add to the list and make readonly those files from the current list that are new */ iter = files; while (iter) { if (!g_list_find_custom(read_only_pages, iter->data, (GCompareFunc)g_strcmp0)) { /* set document readonly */ GeanyDocument *doc = document_find_by_real_path((const gchar*)iter->data); if (doc) scintilla_send_message(doc->editor->sci, SCI_SETREADONLY, 1, 0); /* add new file to the list */ read_only_pages = g_list_append(read_only_pages, g_strdup((gchar*)iter->data)); } iter = iter->next; } g_list_free(files); /* autos */ GList *autos = active_module->get_autos(); update_variables(GTK_TREE_VIEW(atree), NULL, autos); /* watches */ GList *watches = active_module->get_watches(); update_variables(GTK_TREE_VIEW(wtree), NULL, watches); if (stack) { frame *current = (frame*)stack->data; if (current->have_source) { /* open current instruction position */ editor_open_position(current->file, current->line); } /* add current instruction marker */ add_stack_markers(); } /* enable widgets */ enable_sensitive_widgets(TRUE); /* remove breaks readonly if current module doesn't support run-time breaks operation */ if (!(active_module->features & MF_ASYNC_BREAKS)) bptree_set_readonly(FALSE); }
/* * Occures when key is pressed. * Handles debug Run/Stop/... and add/remove breakpoint activities */ gboolean keys_callback(guint key_id) { switch (key_id) { case KEY_RUN: debug_run(); break; case KEY_STOP: debug_stop(); break; case KEY_RESTART: debug_restart(); break; case KEY_STEP_OVER: debug_step_over(); break; case KEY_STEP_INTO: debug_step_into(); break; case KEY_STEP_OUT: debug_step_out(); break; case KEY_EXECUTE_UNTIL: { GeanyDocument *doc = document_get_current(); if (doc) { int line = sci_get_current_line(doc->editor->sci) + 1; debug_execute_until(DOC_FILENAME(doc), line); } break; } case KEY_BREAKPOINT: { GeanyDocument *doc = document_get_current(); if (doc) { int line = sci_get_current_line(doc->editor->sci) + 1; 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 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; } case KEY_CURRENT_INSTRUCTION: { if (DBS_STOPPED == debug_get_state() && debug_current_instruction_have_sources()) { debug_jump_to_current_instruction(); gtk_widget_set_sensitive(tab_call_stack, FALSE); stree_select_first_frame(FALSE); gtk_widget_set_sensitive(tab_call_stack, TRUE); } } } return TRUE; }