Branch: refs/heads/master Author: Dimitar Zhekov dimitar.zhekov@gmail.com Committer: Dimitar Zhekov dimitar.zhekov@gmail.com Date: Tue, 15 Jan 2013 17:42:58 UTC Commit: 5541671bdc4ebb4ea65bd89d2f12583a2de5d0fa https://github.com/geany/geany-plugins/commit/5541671bdc4ebb4ea65bd89d2f1258...
Log Message: ----------- scope - added memory view, fixed glib compatibility
Modified Paths: -------------- scope/ChangeLog scope/NEWS scope/data/scope.glade scope/docs/codes.html scope/docs/scope.html scope/src/Makefile.am scope/src/break.c scope/src/common.h scope/src/conterm.c scope/src/conterm.h scope/src/debug.c scope/src/gtk216.c scope/src/gtk216.h scope/src/inspect.c scope/src/menu.c scope/src/parse.c scope/src/plugme.c scope/src/prefs.c scope/src/prefs.h scope/src/scope.c scope/src/scope.h scope/src/stack.c scope/src/thread.c scope/src/tooltip.c scope/src/utils.c scope/src/utils.h scope/src/views.c scope/src/views.h
Modified: scope/ChangeLog 43 files changed, 42 insertions(+), 1 deletions(-) =================================================================== @@ -1,6 +1,47 @@ +2013-01-15 Dimitar Zhekov dimitar.zhekov@gmail.com + + * data/scope.glade, docs/codes.html, docs/scope.html, src/common.h, + src/Makefile.am, src/memory.c, src/memory.h, src/parse.c, + src/prefs.c, src/prefs.h, src/scope.c, src/views.c, src/views.h: + Added Memory subpage. + * data/scope.glade, src/conterm.c: + GtkTextView "debug_console" -> "debug_context". + * src/break.c, src/gtk216.c, src/scope.h, src/stack.c, src/thread.c, + src/views.c: + GTK_TREE_COLUMN(get_object(name)) -> get_column(name). + * src/conterm.c, src/menu.c, src/views.c: + Handle GDK_KP_Insert/GDK_KP_Delete/GTK_ISO_Space. + * src/conterm.c: + Don't invoke console on Ctrl/Alt/Mod ASCII characters. + Don't set debug_context properties already defined in scope.glade. + * src/conterm.h: + Properly declare dc_output/dc_output_nl as extern. + * src/debug.c, src/scope.c: + Invoke finalizers in (hopefully) proper order instead of processing + pending gtk+ events on finalize. + * src/debug.c: + Small initial wait for gdb kill in finalize instead of waiting + gdb_wait_death + 1. + * src/gtk216.c, src/gtk216.h, src/scope.c: + Emulate g_array_get_element_size() under glib 2.20. + * src/menu.c, src/plugme.c, src/utils.c, src/utils.h, src/views.c: + utils_str_replace_all() -> utils_strchrepl(). + * src/scope.c: + Properly initialize inspects state. + * src/stack.c: + Select and focus the current frame instead of simply selecting. + * src/tooltip.c: + Unlimited toolbar length on pref_tooltips_length = 0, as described + in scope.html. + * src/utils.c: + Invoke g_array_get_element_size() only once in array_save(). + * docs/scope.html, src/scope.c: + Increased version to 0.82. + + 2013-01-03 Dimitar Zhekov dimitar.zhekov@gmail.com
- * src/debug.c, src/scope.c + * src/debug.c, src/scope.c: Ask user whether to terminate debugging on build actions.
* src/debug.c:
Modified: scope/NEWS 7 files changed, 7 insertions(+), 0 deletions(-) =================================================================== @@ -1,3 +1,10 @@ +Scope 0.82 (2013-01-15) + + * Added Memory subpage. + + * Fixed compatibility with glib-2.20. + + Scope 0.80 (2013-01-02)
* Mark all data views for update when a value is modified.
Modified: scope/data/scope.glade 186 files changed, 177 insertions(+), 9 deletions(-) =================================================================== @@ -122,6 +122,11 @@ <property name="stock">gtk-find</property> <property name="icon-size">1</property> </object> + <object class="GtkImage" id="memory_read_icon"> + <property name="visible">True</property> + <property name="stock">gtk-jump-to</property> + <property name="icon-size">1</property> + </object> <object class="GtkImage" id="command_send_icon"> <property name="visible">True</property> <property name="stock">gtk-ok</property> @@ -910,6 +915,93 @@ </object> </child> </object> + <object class="GtkMenu" id="memory_menu"> + <child> + <object class="GtkImageMenuItem" id="memory_refresh"> + <property name="label">gtk-refresh</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem" id="memory_separator1"> + <property name="visible">True</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="memory_read"> + <property name="label" translatable="yes">R_ead</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="image">memory_read_icon</property> + <property name="use_stock">False</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="memory_copy"> + <property name="label">gtk-copy</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </object> + </child> + <child> + <object class="GtkImageMenuItem" id="memory_clear"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="use_underline">True</property> + <property name="use_stock">True</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem" id="memory_separator2"> + <property name="visible">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="memory_group"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Group by</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="memory_group_menu"> + <child> + <object class="GtkRadioMenuItem" id="memory_group_1"> + <property name="visible">True</property> + <property name="label" translatable="yes">_1</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="memory_group_2"> + <property name="visible">True</property> + <property name="label" translatable="yes">_2</property> + <property name="use_underline">True</property> + <property name="group">memory_group_1</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="memory_group_4"> + <property name="visible">True</property> + <property name="label" translatable="yes">_4</property> + <property name="use_underline">True</property> + <property name="group">memory_group_1</property> + </object> + </child> + <child> + <object class="GtkRadioMenuItem" id="memory_group_8"> + <property name="visible">True</property> + <property name="label" translatable="yes">_8</property> + <property name="use_underline">True</property> + <property name="group">memory_group_1</property> + </object> + </child> + </object> + </child> + </object> + </child> + </object> <object class="GtkMenu" id="console_menu"> <child> <object class="GtkImageMenuItem" id="console_copy"> @@ -1257,6 +1349,16 @@ <column type="gboolean"/> </columns> </object> + <object class="GtkListStore" id="memory_store"> + <columns> + <!-- column-name memory_store_addr --> + <column type="gchararray"/> + <!-- column-name memory_store_bytes --> + <column type="gchararray"/> + <!-- column-name memory_store_ascii --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkTreeStore" id="inspect_store"> <columns> <!-- column-name inspect_store_var1 --> @@ -1844,22 +1946,85 @@ </packing> </child> <child> - <object class="GtkScrolledWindow" id="debug_window"> + <object class="GtkScrolledWindow" id="memory_window"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkTreeView" id="memory_view"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="model">memory_store</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <child> + <object class="GtkTreeViewColumn" id="memory_addr_column"> + <property name="resizable">True</property> + <child> + <object class="GtkCellRendererText" id="memory_addr"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="memory_bytes_column"> + <property name="resizable">True</property> + <child> + <object class="GtkCellRendererText" id="memory_bytes"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="memory_ascii_column"> + <property name="resizable">True</property> + <child> + <object class="GtkCellRendererText" id="memory_ascii"/> + <attributes> + <attribute name="text">2</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> </object> <packing> <property name="position">6</property> </packing> </child> <child type="tab"> + <object class="GtkLabel" id="memory_view_label"> + <property name="visible">True</property> + <property name="label" translatable="yes">Memory</property> + </object> + <packing> + <property name="position">6</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="debug_window"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + </object> + <packing> + <property name="position">7</property> + </packing> + </child> + <child type="tab"> <object class="GtkLabel" id="debug_console_label"> <property name="visible">True</property> <property name="label" translatable="yes">Debug Console</property> </object> <packing> - <property name="position">6</property> + <property name="position">7</property> <property name="tab_fill">False</property> </packing> </child> @@ -2607,6 +2772,9 @@ </packing> </child> </object> + <packing> + <property name="position">1</property> + </packing> </child> </object> </child> @@ -2880,10 +3048,10 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> + <property name="width_chars">7</property> <property name="adjustment">option_inspect_count_adjustment</property> <property name="climb_rate">1</property> <property name="numeric">True</property> - <property name="width_chars">7</property> </object> </child> </object> @@ -3548,7 +3716,7 @@ </object> </child> </object> - <object class="GtkTextView" id="debug_console"> + <object class="GtkTextView" id="debug_context"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="editable">False</property> @@ -3566,17 +3734,17 @@ </object> <object class="GtkSizeGroup" id="program_size_group"> <widgets> - <widget name="program_executable_label"/> - <widget name="program_arguments_label"/> - <widget name="program_environment_label"/> - <widget name="program_working_dir_label"/> <widget name="program_load_script_label"/> + <widget name="program_working_dir_label"/> + <widget name="program_environment_label"/> + <widget name="program_arguments_label"/> + <widget name="program_executable_label"/> </widgets> </object> <object class="GtkSizeGroup" id="inspect_size_group"> <widgets> - <widget name="inspect_expr_label"/> <widget name="inspect_name_label"/> + <widget name="inspect_expr_label"/> </widgets> </object> </interface>
Modified: scope/docs/codes.html 26 files changed, 17 insertions(+), 9 deletions(-) =================================================================== @@ -41,11 +41,11 @@
<tr><td class="nowrap">022<id>-break-condition</td> <td class="tab">breakpoint <em>Condition</em> column edited</td> - <td class="tab">-''-</td></tr> + <td class="tab"><id>-break-info</td></tr>
<tr><td class="nowrap">022<id>-break-commands</td> <td class="tab">breakpoint <em>Script</em> column edited</td> - <td class="tab">-''-</td></tr> + <td class="tab"><id>-break-info</td></tr>
<tr><td class="nowrap">023<id>-break-delete</td> <td class="tab"><em>Delete</em> or un-<em>Toggle breakpoint</em></td> @@ -131,6 +131,10 @@ <td class="tab">views idle update</td> <td class="tab">same as 02<tid>-stack-list-variables</td></tr>
+<tr><td class="nowrap">04-data-read-memory-bytes</td> + <td class="tab">views idle update</td> + <td class="tab">fill <em>Memory</em> with data</td></tr> + <tr><td class="nowrap">04<tid>-stack-info-frame</td> <td class="tab">at stopped thread without address</td> <td class="tab">fill the thread columns</td></tr> @@ -141,13 +145,13 @@ <td class="tab">gdb startup if autorun</td> <td class="tab">-exec-run if active breaks & no errors</td></tr>
-<tr><td class="nowrap">-''-</td> +<tr><td class="nowrap">05</td> <td class="tab">after temp break insert <em>location</em></td> - <td class="tab">-''-</td></tr> + <td class="tab">-exec-run if active breaks & no errors</td></tr>
-<tr><td class="nowrap">-''-</td> +<tr><td class="nowrap">05</td> <td class="tab">after temp break insert <em>1st loc</em></td> - <td class="tab">-''-</td></tr> + <td class="tab">-exec-run if active breaks & no errors</td></tr>
<tr><td class="nowrap">05-list-features</td> <td class="tab">first time gdb startup</td> @@ -183,11 +187,15 @@
<tr><td class="nowrap">07-gdb-set</td> <td class="tab">local <em>Modify</em> / <em>Value</em> column edited</td> - <td class="tab">-''-</td></tr> + <td class="tab">mark data views as dirty</td></tr>
-<tr><td class="nowrap">-''-</td> +<tr><td class="nowrap">07-gdb-set</td> <td class="tab">watch <em>Modify</em> / <em>Value</em> column edited</td> - <td class="tab">-''-</td></tr> + <td class="tab">mark data views as dirty</td></tr> + +<tr><td class="nowrap">07-data-write-memory-bytes</td> + <td class="tab">memory hex values column edited</td> + <td class="tab">mark data views as dirty</td></tr>
<tr><td class="nowrap">070<scid>-var-delete</td> <td class="tab">un-<em>Apply</em> inspect</td>
Modified: scope/docs/scope.html 5 files changed, 3 insertions(+), 2 deletions(-) =================================================================== @@ -534,7 +534,8 @@ <p><em>tooltips_send_delay</em> - increase this setting to reduce the CPU time and GDB traffic used by the tooltips, or decrease it if they appear slower than your gtk+ setting.</p>
-<p><em>pref_tooltips_length</em> - maximum length of a tooltip message, 0 = unlimited.</p> +<p><em>pref_tooltips_length</em> - maximum length of a tooltip message, 0 = unlimited. +Default = 2048.</p>
<p>[terminal] (*nix only)</p>
@@ -685,7 +686,7 @@
<b><a name="copyright">Copyright</a></b>
-<p>Scope 0.80, Copyright (C) 2012 Dimitar Toshkov Zhekov</p> +<p>Scope 0.82, Copyright (C) 2013 Dimitar Toshkov Zhekov</p>
<p>The menu and toolbar icons are from <a href="http://netbeans.org">Netbeans</a>, except for BreakPoint.</p>
Modified: scope/src/Makefile.am 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ scope_la_SOURCES = \ inspect.h \ local.c \ local.h \ + memory.c \ + memory.h \ menu.c \ menu.h \ parse.c \
Modified: scope/src/break.c 7 files changed, 3 insertions(+), 4 deletions(-) =================================================================== @@ -214,7 +214,7 @@ static void on_break_column_edited(G_GNUC_UNUSED GtkCellRendererText *renderer, }
static void on_break_ignore_editing_started(G_GNUC_UNUSED GtkCellRenderer *cell, - GtkCellEditable *editable, G_GNUC_UNUSED const gchar *path, gpointer G_GNUC_UNUSED gdata) + GtkCellEditable *editable, G_GNUC_UNUSED const gchar *path, G_GNUC_UNUSED gpointer gdata) { if (GTK_IS_EDITABLE(editable)) validator_attach(GTK_EDITABLE(editable), VALIDATOR_NUMERIC); @@ -1295,14 +1295,13 @@ static void on_break_apply_button_release(GtkWidget *widget, GdkEventButton *eve
void break_init(void) { - GObject *break_type_column = get_object("break_type_column"); GtkWidget *menu; guint i;
tree = view_connect("break_view", &model, &selection, break_cells, "break_window", NULL); store = GTK_LIST_STORE(model); sortable = GTK_TREE_SORTABLE(store); - gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(break_type_column), + gtk_tree_view_column_set_cell_data_func(get_column("break_type_column"), GTK_CELL_RENDERER(get_object("break_type")), break_type_set_data_func, NULL, NULL); g_signal_connect(get_object("break_ignore"), "editing-started", G_CALLBACK(on_break_ignore_editing_started), NULL); @@ -1315,7 +1314,7 @@ void break_init(void) g_signal_connect(selection, "changed", G_CALLBACK(on_break_selection_changed), NULL); gtk_widget_set_has_tooltip(GTK_WIDGET(tree), TRUE); g_signal_connect(tree, "query-tooltip", G_CALLBACK(on_break_query_tooltip), - GTK_TREE_VIEW_COLUMN(get_object("break_display_column"))); + get_column("break_display_column"));
menu = menu_select("break_menu", &break_menu_info, selection); g_signal_connect(tree, "key-press-event", G_CALLBACK(on_break_key_press), NULL);
Modified: scope/src/common.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -31,6 +31,7 @@ #include "gtk216.h" #include "inspect.h" #include "local.h" +#include "memory.h" #include "menu.h" #include "parse.h" #include "plugme.h"
Modified: scope/src/conterm.c 15 files changed, 7 insertions(+), 8 deletions(-) =================================================================== @@ -349,10 +349,13 @@ static void on_console_clear(G_GNUC_UNUSED const MenuItem *menu_item) static gboolean on_console_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event, G_GNUC_UNUSED gpointer gdata) { - if (event->keyval == GDK_Insert || (event->keyval >= 0x21 && event->keyval <= 0x7F)) + gboolean insert = event->keyval == GDK_Insert || event->keyval == GDK_KP_Insert; + + if (insert || (event->keyval >= 0x21 && event->keyval <= 0x7F && + event->state <= GDK_SHIFT_MASK)) { char command[2] = { event->keyval, '\0' }; - view_command_line(event->keyval == GDK_Insert ? NULL : command, NULL, NULL, TRUE); + view_command_line(insert ? NULL : command, NULL, NULL, TRUE); }
return FALSE; @@ -487,7 +490,7 @@ void conterm_init(void) "#C0C0C0", "#C000C0" }; guint i;
- console = get_widget("debug_console"); + console = get_widget("debug_context"); gtk_widget_modify_base(console, GTK_STATE_NORMAL, &pref_vte_colour_back); gtk_widget_modify_cursor(console, &pref_vte_colour_fore, &pref_vte_colour_back); ui_widget_modify_font_from_string(console, pref_vte_font); @@ -495,12 +498,8 @@ void conterm_init(void) debug_context = GTK_TEXT_VIEW(console); dc_output = context_output; dc_output_nl = context_output_nl; - gtk_text_view_set_editable(debug_context, FALSE); - gtk_text_view_set_wrap_mode(debug_context, GTK_WRAP_CHAR); - gtk_text_view_set_left_margin(debug_context, 2); - gtk_text_view_set_right_margin(debug_context, 2); - context = gtk_text_view_get_buffer(debug_context); + for (i = 0; i < NFD; i++) { fd_tags[i] = gtk_text_buffer_create_tag(context, NULL, "foreground",
Modified: scope/src/conterm.h 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -30,8 +30,8 @@ #endif /* G_OS_UNIX */
/* pseudo-fd; 3 = prompt, 4 = scope error */ -void (*dc_output)(int fd, const char *text, gint length); -void (*dc_output_nl)(int fd, const char *text, gint length); +extern void (*dc_output)(int fd, const char *text, gint length); +extern void (*dc_output_nl)(int fd, const char *text, gint length); void dc_error(const char *format, ...) G_GNUC_PRINTF(1, 2);
void dc_clear(void);
Modified: scope/src/debug.c 8 files changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -748,9 +748,6 @@ void debug_finalize(void) { signal(SIGINT, SIG_DFL); g_source_remove(source_id); - /* avoid faults in g_main_context_dispatch() */ - while (gtk_events_pending()) - gtk_main_iteration(); }
if (gdb_state != INACTIVE) @@ -758,8 +755,11 @@ void debug_finalize(void) gint count = 0;
if (kill(gdb_pid, SIGKILL) == 0) - while (waitpid(gdb_pid, NULL, WNOHANG) == 0 && count++ <= pref_gdb_wait_death) + { + g_usleep(G_USEC_PER_SEC / 1000); + while (waitpid(gdb_pid, NULL, WNOHANG) == 0 && count++ < pref_gdb_wait_death) g_usleep(G_USEC_PER_SEC / 100); + }
free_gdb(); /* may be still alive, but we can't do anything more */ statusbar_update_state(DS_INACTIVE);
Modified: scope/src/gtk216.c 64 files changed, 60 insertions(+), 4 deletions(-) =================================================================== @@ -19,6 +19,54 @@
#include "common.h"
+#if !GLIB_CHECK_VERSION(2, 20, 0) +/* :-( */ +typedef struct _ArraySize +{ + GArray *array; + guint element_size; +} ArraySize; + +GArray *array_sizes; + +static ArraySize *find_array_size(GArray *array) +{ + guint i; + gchar *data = array_sizes->data; + + for (i = 0; i < array_sizes->len; i++, data += sizeof(ArraySize)) + if (*(GArray **) data == array) + return (ArraySize *) data; + + return NULL; +} + +#undef g_array_sized_new +GArray *scope_array_sized_new(gboolean zero_terminated, gboolean clear, guint element_size, + guint reserved_size) +{ + GArray *array = g_array_sized_new(zero_terminated, clear, element_size, reserved_size); + ArraySize array_size = { array, element_size }; + + g_array_append_val(array_sizes, array_size); + return array; +} + +guint scope_array_get_element_size(GArray *array) +{ + return find_array_size(array)->element_size; +} + +#undef g_array_free +gchar *scope_array_free(GArray *array, gboolean free_segment) +{ + g_array_remove_index(array_sizes, + find_array_size(array) - (ArraySize *) array_sizes->data); + + return g_array_free(array, free_segment); +} +#endif /* GLIB 2.20.0 */ + #if !GTK_CHECK_VERSION(2, 18, 0) void gtk_widget_set_visible(GtkWidget *widget, gboolean visible) { @@ -74,8 +122,16 @@ void gtk216_init(void) SortColumnId *scd;
for (scd = sort_column_ids; scd->id; scd++) - { - GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN(get_object(scd->id)); - gtk_tree_view_column_set_sort_column_id(column, scd->sort_column_id); - } + gtk_tree_view_column_set_sort_column_id(get_column(scd->id), scd->sort_column_id); + +#if !GLIB_CHECK_VERSION(2, 20, 0) + array_sizes = g_array_sized_new(FALSE, FALSE, sizeof(ArraySize), 0x10); +#endif +} + +void gtk216_finalize(void) +{ +#if !GLIB_CHECK_VERSION(2, 20, 0) + g_array_free(array_sizes, TRUE); +#endif }
Modified: scope/src/gtk216.h 14 files changed, 14 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,19 @@
#ifndef GTK216_H
+#if !GLIB_CHECK_VERSION(2, 20, 0) +GArray *scope_array_sized_new(gboolean zero_terminated, gboolean clear, guint element_size, + guint reserved_size); +#define g_array_sized_new(zero_terminated, clear, element_size, reserved_size) \ + scope_array_sized_new((zero_terminated), (clear), (element_size), (reserved_size)) +#define g_array_new(zero_terminated, clear, elt_size) \ + g_array_sized_new((zero_terminated), (clear), (elt_size), 0) +guint scope_array_get_element_size(GArray *array); +#define g_array_get_element_size(array) scope_array_get_element_size(array) +gchar *scope_array_free(GArray *array, gboolean free_segment); +#define g_array_free(array, free_segment) scope_array_free((array), (free_segment)) +#endif /* GLIB 2.20.0 */ + #if !GTK_CHECK_VERSION(2, 18, 0) #define gtk_widget_get_visible(widget) GTK_WIDGET_VISIBLE(widget) #define gtk_widget_get_sensitive(widget) GTK_WIDGET_SENSITIVE(widget) @@ -26,6 +39,7 @@ #endif
void gtk216_init(void); +void gtk216_finalize(void);
#define GTK216_H 1 #endif
Modified: scope/src/inspect.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -397,7 +397,7 @@ void on_inspect_ndeleted(GArray *nodes) iff (*token <= '1', "%s: invalid i_oper", token) { GtkTreeIter iter; - + if (inspect_find(&iter, FALSE, token + 1)) { if (*token == '0')
Modified: scope/src/menu.c 6 files changed, 3 insertions(+), 3 deletions(-) =================================================================== @@ -65,9 +65,9 @@ gboolean menu_insert_delete(const GdkEventKey *event, const MenuInfo *menu_info, { const char *name;
- if (event->keyval == GDK_Insert) + if (event->keyval == GDK_Insert || event->keyval == GDK_KP_Insert) name = insert_name; - else if (event->keyval == GDK_Delete) + else if (event->keyval == GDK_Delete || event->keyval == GDK_KP_Delete) name = delete_name; else return FALSE; @@ -348,7 +348,7 @@ static void menu_evaluate_modify(const gchar *expr, const char *value, const gch if (gtk_dialog_run(GTK_DIALOG(modify_dialog)) == GTK_RESPONSE_ACCEPT) { text = utils_text_buffer_get_text(modify_text, -1); - utils_str_replace_all(&text, "\n", " "); + utils_strchrepl(text, '\n', ' ');
if (validate_column(text, TRUE)) {
Modified: scope/src/parse.c 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -93,6 +93,7 @@ static void on_data_modified(G_GNUC_UNUSED GArray *nodes) { "^done,ndeleted="", on_inspect_ndeleted, '7', '\0', 0 }, { "^done,path_expr="", on_inspect_path_expr, '4', '\0', 1 }, { "^done,changelist=[", on_inspect_changelist, '\0', '\0', 1 }, + { "^done,memory=[", on_memory_read_bytes, '\0', '\0', 1 }, { "^done,features=[", on_break_features, '5', '\0', 1 }, { "^done,features=[", on_target_features, '7', '\0', 1 }, { "^running", on_debug_loaded, '1', '\0', 0 },
Modified: scope/src/plugme.c 16 files changed, 0 insertions(+), 16 deletions(-) =================================================================== @@ -205,19 +205,3 @@ GtkWidget *plugme_ui_add_config_file_menu_item(const gchar *real_path, const gch
return item; } - -#ifndef utils_str_replace_all -void utils_str_replace_all(gchar **haystack, const gchar *needle, const gchar *replacement) -{ - GString *str; - - g_return_if_fail(*haystack != NULL); - - str = g_string_new(*haystack); - - g_free(*haystack); - utils_string_replace_all(str, needle, replacement); - - *haystack = g_string_free(str, FALSE); -} -#endif /* utils_str_replace_all */
Modified: scope/src/prefs.c 9 files changed, 7 insertions(+), 2 deletions(-) =================================================================== @@ -58,6 +58,9 @@ gint pref_tooltips_send_delay; gint pref_tooltips_length;
+gint pref_memory_bytes_per_line; +gchar *pref_memory_font; + #ifdef G_OS_UNIX static gboolean pref_terminal_save_pos; gboolean pref_terminal_padding; @@ -265,7 +268,7 @@ void prefs_init(void) group = stash_group_new("scope"); stash_group_add_string(group, &pref_gdb_executable, "gdb_executable", "gdb"); stash_group_add_boolean(group, &pref_gdb_async_mode, "gdb_async_mode", FALSE); - stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 0x3FFF); + stash_group_add_integer(group, &pref_gdb_buffer_length, "gdb_buffer_length", 16383); stash_group_add_integer(group, &pref_gdb_wait_death, "gdb_wait_death", 20); #ifndef G_OS_UNIX stash_group_add_integer(group, &pref_gdb_send_interval, "gdb_send_interval", 5); @@ -289,7 +292,9 @@ void prefs_init(void) stash_group_add_integer(group, &pref_show_toolbar_items, "show_toolbar_items", 0xFF); stash_group_add_integer(group, &pref_tooltips_fail_action, "tooltips_fail_action", 25); stash_group_add_integer(group, &pref_tooltips_send_delay, "tooltips_send_delay", 25); - stash_group_add_integer(group, &pref_tooltips_length, "tooltips_length", 0x7FF); + stash_group_add_integer(group, &pref_tooltips_length, "tooltips_length", 2048); + stash_group_add_integer(group, &pref_memory_bytes_per_line, "memory_line_bytes", 16); + stash_group_add_string(group, &pref_memory_font, "memory_font", ""); scope_group = group;
#ifdef stash_tree_setup
Modified: scope/src/prefs.h 3 files changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -50,6 +50,9 @@ extern gint pref_tooltips_send_delay; extern gint pref_tooltips_length;
+extern gint pref_memory_bytes_per_line; +extern gchar *pref_memory_font; + #ifdef G_OS_UNIX extern gboolean pref_terminal_padding; extern gint pref_terminal_window_x;
Modified: scope/src/scope.c 15 files changed, 9 insertions(+), 6 deletions(-) =================================================================== @@ -32,7 +32,7 @@ PLUGIN_VERSION_CHECK(215)
PLUGIN_SET_TRANSLATABLE_INFO(LOCALEDIR, GETTEXT_PACKAGE, _("Scope Debugger"), - _("Simple GDB front-end."), "0.80" , "Dimitar Toshkov Zhekov dimitar.zhekov@gmail.com") + _("Simple GDB front-end."), "0.82" , "Dimitar Toshkov Zhekov dimitar.zhekov@gmail.com")
/* Keybinding(s) */ enum @@ -553,6 +553,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata) watch_init(); stack_init(); local_init(); + memory_init(); menu_init(); menu_set_popup_keybindings(item);
@@ -572,7 +573,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata) }
toolbar_update_state(DS_INACTIVE); - watches_update_state(DS_INACTIVE); + views_update_state(DS_INACTIVE); scope_configure();
g_signal_connect(debug_panel, "switch-page", G_CALLBACK(on_view_changed), NULL); @@ -588,7 +589,6 @@ void plugin_cleanup(void) return;
gtk_widget_destroy(debug_item); - gtk_widget_destroy(debug_statusbar); gtk_widget_destroy(debug_panel);
for (item = toolbar_items; item->index != -1; item++) @@ -601,12 +601,15 @@ void plugin_cleanup(void) inspect_finalize(); thread_finalize(); break_finalize(); - utils_finalize(); + memory_finalize(); + menu_finalize(); views_finalize(); - debug_finalize(); + utils_finalize(); parse_finalize(); prefs_finalize(); - menu_finalize(); + debug_finalize(); + gtk216_finalize();
+ gtk_widget_destroy(debug_statusbar); g_object_unref(builder); }
Modified: scope/src/scope.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -25,6 +25,7 @@ void update_state(DebugState state); GObject *get_object(const char *name); GtkWidget *get_widget(const char *name); +#define get_column(name) GTK_TREE_VIEW_COLUMN(get_object(name)) #define find_widget(parent, name) GTK_WIDGET(g_object_get_data(G_OBJECT(parent), (name))) void open_debug_panel(void); void scope_configure(void);
Modified: scope/src/stack.c 8 files changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -59,7 +59,7 @@ static void stack_node_location(const ParseNode *node, const char *fid) parse_location_free(&loc);
if (!g_strcmp0(id, fid)) - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, -1); } } } @@ -81,7 +81,7 @@ void on_stack_frames(GArray *nodes) GtkTreeIter iter;
if (gtk_tree_model_get_iter_first(model, &iter)) - gtk_tree_selection_select_iter(selection, &iter); + utils_tree_set_cursor(selection, &iter, -1); } } } @@ -286,7 +286,7 @@ static void on_stack_show_entry(const MenuItem *menu_item) do { const char *func1; - + gtk_tree_model_get(model, &iter, STACK_FUNC, &func1, -1); if (!strcmp(func, func1)) { @@ -366,7 +366,7 @@ void stack_init(void) view_set_line_data_func("stack_line_column", "stack_line", STACK_LINE); gtk_widget_set_has_tooltip(GTK_WIDGET(tree), TRUE); g_signal_connect(tree, "query-tooltip", G_CALLBACK(on_view_query_tooltip), - GTK_TREE_VIEW_COLUMN(get_object("stack_base_name_column"))); + get_column("stack_base_name_column"));
g_signal_connect(tree, "key-press-event", G_CALLBACK(on_view_key_press), stack_seek_selected);
Modified: scope/src/thread.c 4 files changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -481,7 +481,7 @@ void on_thread_exited(GArray *nodes)
if (!g_strcmp0(tid, gdb_thread)) set_gdb_thread(NULL, FALSE); - + if (find_thread(tid, &iter)) { gboolean was_selected = !g_strcmp0(tid, thread_id); @@ -897,7 +897,7 @@ void thread_init(void) view_set_sort_func(sortable, THREAD_TARGET_ID, thread_ident_compare); gtk_widget_set_has_tooltip(GTK_WIDGET(tree), TRUE); g_signal_connect(tree, "query-tooltip", G_CALLBACK(on_view_query_tooltip), - GTK_TREE_VIEW_COLUMN(get_object("thread_base_name_column"))); + get_column("thread_base_name_column"));
thread_groups = array_new(ThreadGroup, 0x10); RUNNING = _("Running");
Modified: scope/src/tooltip.c 2 files changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -56,7 +56,7 @@ static void tooltip_set(gchar *text)
if (show) { - if (strlen(output) > (guint) pref_tooltips_length + 3) + if (pref_tooltips_length && strlen(output) > (size_t) pref_tooltips_length + 3) strcpy(output + pref_tooltips_length, "...");
tooltip_trigger();
Modified: scope/src/utils.c 26 files changed, 24 insertions(+), 2 deletions(-) =================================================================== @@ -113,6 +113,27 @@ const gchar *utils_skip_spaces(const gchar *text) return text; }
+void utils_strchrepl(char *text, char c, char rep) +{ + char *p = text; + + while (*text) + { + if (*text == c) + { + if (rep) + *text = rep; + } + else if (!rep) + *p++ = *text; + + text++; + } + + if (!rep) + *p = '\0'; +} + gchar *array_append(GArray *array) { g_array_set_size(array, array->len + 1); @@ -194,8 +215,9 @@ void array_save(GArray *array, GKeyFile *config, const gchar *prefix, ASaveFunc { guint i, n = 0; gchar *data = array->data; + guint size = g_array_get_element_size(array);
- for (i = 0; i < array->len; i++, data += g_array_get_element_size(array)) + for (i = 0; i < array->len; i++, data += size) { char *section = g_strdup_printf("%s_%d", prefix, n); n += save_func(config, section, data); @@ -663,7 +685,7 @@ static void on_insert_text(GtkEditable *editable, gchar *new_text, gint new_text G_GNUC_UNUSED gint *position, gpointer gdata) { gboolean valid = TRUE; - + if (new_text_length == -1) new_text_length = (gint) strlen(new_text);
Modified: scope/src/utils.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -27,6 +27,7 @@ void utils_handle_button_release(GtkWidget *widget, GdkEventButton *event); gboolean utils_check_path(const char *pathname, gboolean file, int mode); /* "" ok */ const gchar *utils_skip_spaces(const gchar *text); +void utils_strchrepl(char *text, char c, char repl);
#define array_new(type, start) g_array_sized_new(FALSE, FALSE, sizeof(type), (start)) gchar *array_append(GArray *array);
Modified: scope/src/views.c 13 files changed, 8 insertions(+), 5 deletions(-) =================================================================== @@ -40,6 +40,7 @@ { FALSE, stack_clear, stack_update, TRUE, DS_DEBUG }, { FALSE, locals_clear, locals_update, TRUE, DS_DEBUG }, { FALSE, watches_clear, watches_update, TRUE, DS_DEBUG }, + { FALSE, memory_clear, memory_update, FALSE, DS_SENDABLE }, { FALSE, NULL, dc_update, FALSE, DS_DEBUG }, { FALSE, inspects_clear, inspects_update, FALSE, DS_DEBUG }, { FALSE, tooltip_clear, tooltip_update, FALSE, DS_SENDABLE }, @@ -56,6 +57,7 @@ void views_data_dirty(void) view_dirty(VIEW_STACK); view_dirty(VIEW_LOCALS); view_dirty(VIEW_WATCHES); + view_dirty(VIEW_MEMORY); view_dirty(VIEW_INSPECT); view_dirty(VIEW_TOOLTIP); } @@ -171,7 +173,7 @@ gboolean on_view_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event, /* from msgwindow.c */ gboolean enter_or_return = ui_is_keyval_enter_or_return(event->keyval);
- if (enter_or_return || event->keyval == GDK_space) + if (enter_or_return || event->keyval == GDK_space || event->keyval == GDK_KP_Space) seeker(enter_or_return);
return FALSE; @@ -316,7 +318,7 @@ static void view_line_cell_data_func(G_GNUC_UNUSED GtkTreeViewColumn *column,
void view_set_line_data_func(const char *column, const char *cell, gint column_id) { - gtk_tree_view_column_set_cell_data_func(GTK_TREE_VIEW_COLUMN(get_object(column)), + gtk_tree_view_column_set_cell_data_func(get_column(column), GTK_CELL_RENDERER(get_object(cell)), view_line_cell_data_func, GINT_TO_POINTER(column_id), NULL); } @@ -337,7 +339,7 @@ void view_display_edited(GtkTreeModel *model, gboolean condition, const gchar *p gtk_tree_model_get(model, &iter, COLUMN_NAME, &name, COLUMN_HB_MODE, &hb_mode, -1); locale = utils_get_locale_from_display(new_text, hb_mode); - utils_str_replace_all(&locale, "\n", " "); + utils_strchrepl(locale, '\n', ' '); debug_send_format(F, format, name, locale); g_free(locale); } @@ -348,7 +350,7 @@ void view_display_edited(GtkTreeModel *model, gboolean condition, const gchar *p
void view_column_set_visible(const char *name, gboolean visible) { - gtk_tree_view_column_set_visible(GTK_TREE_VIEW_COLUMN(get_object(name)), visible); + gtk_tree_view_column_set_visible(get_column(name), visible); }
void view_seek_selected(GtkTreeSelection *selection, gboolean focus, SeekerType seeker) @@ -467,7 +469,8 @@ static void on_command_send_button_clicked(G_GNUC_UNUSED GtkButton *button, char *locale;
thread_synchronize(); - utils_str_replace_all(&text, "\n", " "); + utils_strchrepl(text, '\n', ' '); + gtk_text_buffer_set_text(command_text, text, -1); start = utils_skip_spaces(text); locale = gtk_toggle_button_get_active(command_locale) ? utils_get_locale_from_utf8(start) : strdup(start);
Modified: scope/src/views.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -27,6 +27,7 @@ VIEW_STACK, VIEW_LOCALS, VIEW_WATCHES, + VIEW_MEMORY, VIEW_CONSOLE, VIEW_INSPECT, VIEW_TOOLTIP,
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).