Bug 54287 - -finstrument-functions-exclude-function-list ignores class/namespace scope
Summary: -finstrument-functions-exclude-function-list ignores class/namespace scope
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.7.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-16 16:17 UTC by Markus Geimer
Modified: 2012-08-16 16:17 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Geimer 2012-08-16 16:17:43 UTC
In it's current implementation, the symbol matching of -finstrument-functions-exclude-function-list performs a strstr() on the function name only, ignoring the class/namespace scope. That is, with sym=func, both foo::func() and bar::func() with foo and bar being either classes or namespaces will be matched and excluded from instrumentation.

To allow for a more fine-grained specification, the function name used for matching should include the class/namespace scope. This can easily be achived using the patch given below (against the 4.7.1 release). A matching based on regular expressions would be even more convenient, but the proposed change would already help a lot.


diff -Nrup gcc-4.7.1.orig/gcc/gimplify.c gcc-4.7.1/gcc/gimplify.c
--- gcc-4.7.1.orig/gcc/gimplify.c	2012-05-10 17:00:11.000000000 +0200
+++ gcc-4.7.1/gcc/gimplify.c	2012-08-16 18:12:45.793020996 +0200
@@ -8079,7 +8079,7 @@ flag_instrument_functions_exclude_p (tre
       int i;
       char *s;
 
-      name = lang_hooks.decl_printable_name (fndecl, 0);
+      name = lang_hooks.decl_printable_name (fndecl, 1);
       FOR_EACH_VEC_ELT (char_p, vec, i, s)
 	if (strstr (name, s) != NULL)
 	  return true;