diff options
author | Teresa Johnson <tejohnson@google.com> | 2013-03-31 16:41:17 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2013-03-31 16:41:17 +0000 |
commit | 6eabd3fe354e694c8af80886eb0995fb7a338a35 (patch) | |
tree | dbfd30e04c5746b10112fa926ff8e57308825cd0 | |
parent | 65f8d7333fba0a25a3b7393a7030dc5e754bf709 (diff) |
This patch restores part of r196176, which was subsequently reverted
due to issues with the other part of that patch that dealt with
module info updates. This patch restores the option -femit-function-names
to emit to stderr the mapping from module name/function id to function
assembler name. This enables mapping the function ids in the gcda
dump files to the symbolic function name. This will work for LIPO builds
without the other part of that patch, which was needed for FDO builds,
and which needs to be revisited and fixed.
2013-03-31 Teresa Johnson <tejohnson@google.com>
* tree-profile.c (tree_profiling): Optionally call
new function emit_function_name.
* common.opt (flag_emit_function_names): New flag.
* coverage.c (emit_function_name): New function.
* coverage.h: Ditto.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7@197289 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/common.opt | 7 | ||||
-rw-r--r-- | gcc/coverage.c | 13 | ||||
-rw-r--r-- | gcc/coverage.h | 2 | ||||
-rw-r--r-- | gcc/tree-profile.c | 3 |
4 files changed, 25 insertions, 0 deletions
diff --git a/gcc/common.opt b/gcc/common.opt index e4e53a94917..fc5a509047e 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1775,6 +1775,13 @@ fprofile-generate-sampling Common Var(flag_profile_generate_sampling) Turn on instrumentation sampling with -fprofile-generate with rate set by --param profile-generate-sampling-rate or environment variable GCOV_SAMPLING_RATE +femit-function-names +Common Var(flag_emit_function_names) +Print to stderr the mapping from module name and function id to assembler +function name when -ftest-coverage, -fprofile-generate or -fprofile-use are +active, for use in correlating function ids in gcda files with the function +name. + fprofile-strip= Common Joined RejectNegative Var(profile_base_name_suffix_to_strip) Specify a substring to be stripped from the profile base file name diff --git a/gcc/coverage.c b/gcc/coverage.c index 0eb11d1af2d..8bbb7df9357 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -2085,6 +2085,19 @@ build_cl_args_array_value (tree string_type, VEC(constructor_elt, gc) **v) return; } +/* Emit mapping between module name and function id to the function's + assembler name, for use in correlating function idents in the gcda file + with the function name. */ + +void +emit_function_name (void) +{ + fprintf (stderr, "Module %s FuncId %u Name %s\n", + main_input_file_name, + FUNC_DECL_FUNC_ID (cfun), + IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl))); +} + /* Returns the type of the module info associated with the current source module being compiled. */ diff --git a/gcc/coverage.h b/gcc/coverage.h index 176cbdb2768..2ceec40a9d9 100644 --- a/gcc/coverage.h +++ b/gcc/coverage.h @@ -75,6 +75,8 @@ extern void coverage_dc_end_function (void); is present in the coverage internal data structures. */ extern bool coverage_function_present (unsigned fn_ident); +extern void emit_function_name (void); + /* True if there is PMU data present in this compilation. */ extern bool pmu_data_present (void); diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 18d8d59e022..8f9c6a125a4 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -1557,6 +1557,9 @@ tree_profiling (void) /* Re-set global shared temporary variable for edge-counters. */ gcov_type_tmp_var = NULL_TREE; + if (flag_emit_function_names) + emit_function_name (); + /* Local pure-const may imply need to fixup the cfg. */ if (execute_fixup_cfg () & TODO_cleanup_cfg) cleanup_tree_cfg (); |