]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Callgrind: fix (part of?) bug 191992.
authorJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Fri, 29 May 2009 15:30:08 +0000 (15:30 +0000)
committerJosef Weidendorfer <Josef.Weidendorfer@gmx.de>
Fri, 29 May 2009 15:30:08 +0000 (15:30 +0000)
Matching of function names was wrong.
Thanks to  Timo Lindfors

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10169

callgrind/clo.c

index a15a5d5bcb1d21bfa93044d3b35c11eb16bd6fcc..b532483323070efbd51044028a16b510eb495920 100644 (file)
@@ -264,13 +264,13 @@ static fn_config* get_fnc2(config_node* node, Char* name)
   while(name[offset] && (!is_wild(name[offset]))) offset++;
 
   new_sub = new_config(name, offset);
-  new_sub->next = n->sub_node[ name[offset]%NODE_DEGREE ];
-  n->sub_node[ name[offset]%NODE_DEGREE ] = new_sub;   
+  new_sub->next = n->sub_node[ name[0]%NODE_DEGREE ];
+  n->sub_node[ name[0]%NODE_DEGREE ] = new_sub;
 
   return get_fnc2(new_sub, name+offset);
 }
 
-static void print_config_node(int s, config_node* node)
+static void print_config_node(int depth, int hash, config_node* node)
 {
   config_node* n;
   int i;
@@ -278,19 +278,22 @@ static void print_config_node(int s, config_node* node)
   if (node != fn_configs) {
     char sp[] = "                                        ";
 
-    if (s>40) s=40;
-    VG_(printf)("%s", sp+40-s);
-    VG_(printf)("'%s'/%d\n", node->name, node->length);
+    if (depth>40) depth=40;
+    VG_(printf)("%s", sp+40-depth);
+    if (hash >=0) VG_(printf)(" [hash %2d]", hash);
+    else if (hash == -2) VG_(printf)(" [wildc ?]");
+    else if (hash == -3) VG_(printf)(" [wildc *]");
+    VG_(printf)(" '%s' (len %d)\n", node->name, node->length);
   }
   for(i=0;i<NODE_DEGREE;i++) {
     n = node->sub_node[i];
     while(n) {
-      print_config_node(s+1, n);
+      print_config_node(depth+1, i, n);
       n = n->next;
     }
   }
-  if (node->wild_char) print_config_node(s+1, node->wild_char);
-  if (node->wild_star) print_config_node(s+1, node->wild_star);
+  if (node->wild_char) print_config_node(depth+1, -2, node->wild_char);
+  if (node->wild_star) print_config_node(depth+1, -3, node->wild_star);
 }
 
 /* get a function config for a name pattern (from command line) */
@@ -305,7 +308,7 @@ static fn_config* get_fnc(Char* name)
 
   CLG_DEBUGIF(3) {
     CLG_DEBUG(3, " -get_fnc(%s):\n", name);
-    print_config_node(3, fn_configs);
+    print_config_node(3, -1, fn_configs);
   }
   return fnc;
 }
@@ -358,7 +361,7 @@ static void update_fn_config2(fn_node* fn, Char* name, config_node* node)
     CLG_DEBUG(3, "  update_fn_config2('%s', node '%s'): \n",
             name, node->name);
     if ((*name == 0) && node->config) {
-      CLG_DEBUG(3, "Found!\n");
+      CLG_DEBUG(3, "   found!\n");
       update_fn_config1(fn, node->config);
       return;
     }
@@ -368,12 +371,19 @@ static void update_fn_config2(fn_node* fn, Char* name, config_node* node)
       if (VG_(strncmp)(name, n->name, n->length)==0) break;
       n = n->next;
     }
-    if (n) update_fn_config2(fn, name+n->length, n);
+    if (n) {
+       CLG_DEBUG(3, "   '%s' matching at hash %d\n",
+                 n->name, name[0]%NODE_DEGREE);
+       update_fn_config2(fn, name+n->length, n);
+    }
     
-    if (node->wild_char)
-      update_fn_config2(fn, name+1, node->wild_char);
+    if (node->wild_char) {
+       CLG_DEBUG(3, "   skip '%c' for wildcard '?'\n", *name);
+       update_fn_config2(fn, name+1, node->wild_char);
+    }
 
     if (node->wild_star) {
+      CLG_DEBUG(3, "   wildcard '*'\n");
       while(*name) {
        update_fn_config2(fn, name, node->wild_star);
        name++;