diff options
author | weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-29 15:30:08 +0000 |
---|---|---|
committer | weidendo <weidendo@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-05-29 15:30:08 +0000 |
commit | 141e76df1e812508ebbe820e710a3323891604c0 (patch) | |
tree | 95402d9fa4cd37bb7096239eacba12d4e3374f13 /callgrind | |
parent | 477924109e0fb8f9c95a08da08389fcba1b09ae7 (diff) | |
download | valgrind-141e76df1e812508ebbe820e710a3323891604c0.tar.gz |
Callgrind: fix (part of?) bug 191992.
Matching of function names was wrong.
Thanks to Timo Lindfors
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10169 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'callgrind')
-rw-r--r-- | callgrind/clo.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/callgrind/clo.c b/callgrind/clo.c index a15a5d5bc..b53248332 100644 --- a/callgrind/clo.c +++ b/callgrind/clo.c @@ -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++; |