From: siboud Date: Sat, 26 Feb 2005 22:39:01 +0000 (+0000) Subject: fixed seg fault in tree compilation for filter X-Git-Tag: v0.12.20~2611 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=410c83dada404562b5094c08d7a069d9030feb28;p=lttv.git fixed seg fault in tree compilation for filter git-svn-id: http://ltt.polymtl.ca/svn@878 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index ec457eb8..b5addcf0 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -28,6 +28,12 @@ * - the exists an other lttv_filter which conflicts with this one */ +/* + * TODO + * - refine switch of expression in multiple uses functions + * - add the current simple expression to the tree + */ + #include /* @@ -177,7 +183,6 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) { */ lttv_filter_tree* tree = lttv_filter_tree_new(); lttv_filter_tree* subtree = NULL; -// lttv_filter_tree* current_tree = NULL; GPtrArray *tree_stack = g_ptr_array_new(); g_ptr_array_add( tree_stack,(gpointer) tree ); @@ -227,13 +232,13 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) { for(i=0;istr); - g_print("%c\n",expression[i]); + g_print("%c ",expression[i]); switch(expression[i]) { /* * logical operators */ case '&': /* and */ - t1 = g_ptr_array_index(tree_stack,tree_stack->len-1); + t1 = (lttv_filter_tree*)g_ptr_array_index(tree_stack,tree_stack->len-1); while(t1->right != LTTV_TREE_UNDEFINED) t1 = t1->r_child.t; t2 = lttv_filter_tree_new(); t2->node->type = LTTV_EXPRESSION_OP; @@ -243,14 +248,14 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) { t2->l_child.t = subtree; subtree = NULL; t1->right = LTTV_TREE_NODE; - t1->l_child.t = t2; + t1->r_child.t = t2; } else { a_simple_expression.value = a_field_component->str; a_field_component = g_string_new(""); t2->left = LTTV_TREE_LEAF; t2->l_child.leaf = g_new(lttv_simple_expression,1); t1->right = LTTV_TREE_NODE; - t1->l_child.t = t2; + t1->r_child.t = t2; } break; @@ -287,7 +292,6 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) { g_assert(tree_stack->len>0); if(subtree != NULL) { t1 = g_ptr_array_index(tree_stack,tree_stack->len-1); - /* FIXME ==> SEG FAULT */ while(t1->right != LTTV_TREE_UNDEFINED && t1->right != LTTV_TREE_LEAF) { g_assert(t1!=NULL && t1->r_child.t != NULL); t1 = t1->r_child.t; @@ -357,14 +361,33 @@ lttv_filter_new(char *expression, LttvTraceState *tcs) { g_string_append_c(a_field_component,expression[i]); } } - - + + /* processing last element of expression */ + g_assert(tree_stack->len==1); /* only root tree should remain */ + t1 = g_ptr_array_index(tree_stack,tree_stack->len-1); + while(t1->right != LTTV_TREE_UNDEFINED) t1 = t1->r_child.t; + if(subtree != NULL) { /* add the subtree */ + t1->right = LTTV_TREE_NODE; + t1->l_child.t = subtree; + subtree = NULL; + } else { /* add a leaf */ + a_simple_expression.value = a_field_component->str; + a_field_component = g_string_new(""); + t1->right = LTTV_TREE_LEAF; + t1->r_child.leaf = g_new(lttv_simple_expression,1); + } + + g_assert(tree != NULL); + g_assert(subtree == NULL); if( p_nesting>0 ) { g_warning("Wrong filtering options, the string\n\"%s\"\n\ is not valid due to parenthesis incorrect use",expression); return NULL; } + + return tree; + } /** diff --git a/ltt/branches/poly/lttv/modules/gui/filter/.deps/filter.Plo b/ltt/branches/poly/lttv/modules/gui/filter/.deps/filter.Plo index e1957564..a78cdee5 100644 --- a/ltt/branches/poly/lttv/modules/gui/filter/.deps/filter.Plo +++ b/ltt/branches/poly/lttv/modules/gui/filter/.deps/filter.Plo @@ -3,14 +3,14 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/glib-2.0/glib/gtypes.h \ /usr/lib/glib-2.0/include/glibconfig.h \ /usr/include/glib-2.0/glib/gmacros.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.2/include/limits.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.2/include/syslimits.h \ + /usr/lib/gcc-lib/i486-linux/3.3.5/include/stddef.h \ + /usr/lib/gcc-lib/i486-linux/3.3.5/include/limits.h \ + /usr/lib/gcc-lib/i486-linux/3.3.5/include/syslimits.h \ /usr/include/limits.h /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/gnu/stubs.h /usr/include/bits/posix1_lim.h \ /usr/include/bits/local_lim.h /usr/include/linux/limits.h \ /usr/include/bits/posix2_lim.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.2/include/float.h \ + /usr/lib/gcc-lib/i486-linux/3.3.5/include/float.h \ /usr/include/glib-2.0/glib/garray.h \ /usr/include/glib-2.0/glib/gasyncqueue.h \ /usr/include/glib-2.0/glib/gthread.h \ @@ -30,7 +30,7 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/glib-2.0/glib/gstring.h \ /usr/include/glib-2.0/glib/gunicode.h \ /usr/include/glib-2.0/glib/gutils.h \ - /usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h \ + /usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h \ /usr/include/glib-2.0/glib/gmarkup.h \ /usr/include/glib-2.0/glib/gmessages.h \ /usr/include/glib-2.0/glib/gnode.h \ @@ -143,7 +143,6 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/atk-1.0/atk/atknoopobjectfactory.h \ /usr/include/atk-1.0/atk/atkobjectfactory.h \ /usr/include/atk-1.0/atk/atkregistry.h \ - /usr/include/atk-1.0/atk/atkobjectfactory.h \ /usr/include/atk-1.0/atk/atkrelation.h \ /usr/include/atk-1.0/atk/atkrelationset.h \ /usr/include/atk-1.0/atk/atkselection.h \ @@ -270,10 +269,7 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/gtk-2.0/gtk/gtktextmark.h \ /usr/include/gtk-2.0/gtk/gtktextview.h \ /usr/include/gtk-2.0/gtk/gtktipsquery.h \ - /usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h \ /usr/include/gtk-2.0/gtk/gtktoolbar.h \ - /usr/include/gtk-2.0/gtk/gtktoolbutton.h \ - /usr/include/gtk-2.0/gtk/gtktoolitem.h \ /usr/include/gtk-2.0/gtk/gtktree.h \ /usr/include/gtk-2.0/gtk/gtktreednd.h \ /usr/include/gtk-2.0/gtk/gtktreeitem.h \ @@ -316,11 +312,11 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/glib-2.0/glib/gmacros.h: -/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stddef.h: +/usr/lib/gcc-lib/i486-linux/3.3.5/include/stddef.h: -/usr/lib/gcc/i386-redhat-linux/3.4.2/include/limits.h: +/usr/lib/gcc-lib/i486-linux/3.3.5/include/limits.h: -/usr/lib/gcc/i386-redhat-linux/3.4.2/include/syslimits.h: +/usr/lib/gcc-lib/i486-linux/3.3.5/include/syslimits.h: /usr/include/limits.h: @@ -338,7 +334,7 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/bits/posix2_lim.h: -/usr/lib/gcc/i386-redhat-linux/3.4.2/include/float.h: +/usr/lib/gcc-lib/i486-linux/3.3.5/include/float.h: /usr/include/glib-2.0/glib/garray.h: @@ -388,7 +384,7 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/glib-2.0/glib/gutils.h: -/usr/lib/gcc/i386-redhat-linux/3.4.2/include/stdarg.h: +/usr/lib/gcc-lib/i486-linux/3.3.5/include/stdarg.h: /usr/include/glib-2.0/glib/gmarkup.h: @@ -648,8 +644,6 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/atk-1.0/atk/atkregistry.h: -/usr/include/atk-1.0/atk/atkobjectfactory.h: - /usr/include/atk-1.0/atk/atkrelation.h: /usr/include/atk-1.0/atk/atkrelationset.h: @@ -920,14 +914,8 @@ filter.lo filter.o: filter.c /usr/include/glib-2.0/glib.h \ /usr/include/gtk-2.0/gtk/gtktipsquery.h: -/usr/include/gtk-2.0/gtk/gtktoggletoolbutton.h: - /usr/include/gtk-2.0/gtk/gtktoolbar.h: -/usr/include/gtk-2.0/gtk/gtktoolbutton.h: - -/usr/include/gtk-2.0/gtk/gtktoolitem.h: - /usr/include/gtk-2.0/gtk/gtktree.h: /usr/include/gtk-2.0/gtk/gtktreednd.h: