[anjuta] gdb: Allow inspecting expressions containing spaces
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] gdb: Allow inspecting expressions containing spaces
- Date: Mon, 14 Mar 2011 20:31:03 +0000 (UTC)
commit 0b23aa45dabaa19ce176eccb7bb1df4367b27f64
Author: Nanci de Brito Bonfim <nancibonfim gmail com>
Date: Mon Mar 14 21:24:16 2011 +0100
gdb: Allow inspecting expressions containing spaces
plugins/debug-manager/watch.c | 6 +++++-
plugins/gdb/plugin.c | 15 +++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/plugins/debug-manager/watch.c b/plugins/debug-manager/watch.c
index d85bc02..26f5975 100644
--- a/plugins/debug-manager/watch.c
+++ b/plugins/debug-manager/watch.c
@@ -124,7 +124,7 @@ debug_tree_inspect_evaluate_dialog (ExprWatch * ew, const gchar* expression)
/* Add in watch window */
new_expr = debug_tree_get_first (dlg.tree);
- if (new_expr != NULL)
+ if ((new_expr != NULL) && (strlen(new_expr) != 0))
{
var.expression = new_expr;
debug_tree_add_watch (ew->debug_tree, &var, FALSE);
@@ -251,6 +251,10 @@ on_debug_tree_inspect (GtkAction *action, gpointer user_data)
{
expression = ianjuta_editor_get_current_word (IANJUTA_EDITOR (te), NULL);
}
+ if (g_regex_match_simple("^\\s*$", expression,G_REGEX_MULTILINE | G_REGEX_DOLLAR_ENDONLY, G_REGEX_MATCH_ANCHORED))
+ {
+ expression = NULL;
+ }
debug_tree_inspect_evaluate_dialog (ew, expression);
g_free (expression);
diff --git a/plugins/gdb/plugin.c b/plugins/gdb/plugin.c
index 14f1241..aaaf7db 100644
--- a/plugins/gdb/plugin.c
+++ b/plugins/gdb/plugin.c
@@ -242,6 +242,13 @@ gdb_plugin_initialize (GdbPlugin *this)
debugger_set_pretty_printers (this->debugger, this->pretty_printers);
}
+/* Helper functions
+ *---------------------------------------------------------------------------*/
+
+gchar *quote_expression (const gchar *expression) {
+ return g_strconcat("\"", expression, "\"", NULL);
+}
+
/* Callback for saving session
*---------------------------------------------------------------------------*/
@@ -1149,7 +1156,7 @@ idebugger_variable_destroy (IAnjutaDebuggerVariable *plugin, const gchar *name,
{
GdbPlugin *gdb = ANJUTA_PLUGIN_GDB (plugin);
- debugger_delete_variable (gdb->debugger, name);
+ debugger_delete_variable (gdb->debugger, quote_expression(name));
return TRUE;
}
@@ -1169,7 +1176,7 @@ idebugger_variable_assign (IAnjutaDebuggerVariable *plugin, const gchar *name, c
{
GdbPlugin *gdb = ANJUTA_PLUGIN_GDB (plugin);
- debugger_assign_variable (gdb->debugger, name, value);
+ debugger_assign_variable (gdb->debugger, quote_expression(name), value);
return TRUE;
}
@@ -1179,7 +1186,7 @@ idebugger_variable_list_children (IAnjutaDebuggerVariable *plugin, const gchar *
{
GdbPlugin *gdb = ANJUTA_PLUGIN_GDB (plugin);
- debugger_list_variable_children (gdb->debugger, name, from, callback, user_data);
+ debugger_list_variable_children (gdb->debugger, quote_expression(name), from, callback, user_data);
return TRUE;
}
@@ -1189,7 +1196,7 @@ idebugger_variable_create (IAnjutaDebuggerVariable *plugin, const gchar *name, I
{
GdbPlugin *gdb = ANJUTA_PLUGIN_GDB (plugin);
- debugger_create_variable (gdb->debugger, name, callback, user_data);
+ debugger_create_variable (gdb->debugger, quote_expression(name), callback, user_data);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]