|
From: Stefan K. <en...@ho...> - 2010-01-03 21:52:55
|
hi,
One aspect of the vcov annotated output is kind of weird. In the announcement
mail ("Experimental Valgrind coverage tool") Nicholas wrote:
"It's pretty simple. It just records, for each line of source code, how many
instructions that were derived from that line were executed."
So is that number in the first column (e.g. 7 for int main()) the number of
instruction that were executed for that line? In the coverage reports I know,
one would see the how often that line was executed.
7: 54:int main(int argc, char **argv) {
-: 55: gboolean res=FALSE;
1: 56: gboolean arg_version=FALSE;
1: 57: gboolean arg_quiet=FALSE;
How can it be that the first gboolean res=FALSE does not get executed?
3: 58: gchar *command=NULL,*input_file_name=NULL,*output_file_name=NULL;
-: 59: BtCmdApplication *app;
-: 60: GOptionContext *ctx;
-: 61: GOptionGroup *group;
1: 62: GError *err=NULL;
-: 63:
-: 64:#ifdef ENABLE_NLS
3: 65: setlocale(LC_ALL, "");
3: 66: bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
3: 67: bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
2: 68: textdomain(GETTEXT_PACKAGE);
-: 69:#endif /* ENABLE_NLS */
-: 70:
-: 71: GOptionEntry options[] = {
-: 72: {"version", '\0', G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_NONE, &arg_version, N_("Print application version"),
NULL },
-: 73: {"quiet", 'q', G_OPTION_FLAG_NO_ARG,
G_OPTION_ARG_NONE, &arg_quiet, N_("Be quiet"), NULL },
-: 74: {"command", '\0', 0,
G_OPTION_ARG_STRING, &command, N_("Command name"), "{info, play,
convert, encode}" },
-: 75: {"input-file", '\0', 0,
G_OPTION_ARG_FILENAME, &input_file_name, N_("Input file name"),
N_("<songfile>") },
-: 76: {"output-file", '\0', 0,
G_OPTION_ARG_FILENAME, &output_file_name, N_("Output file name"),
N_("<songfile>") },
-: 77: {NULL}
76: 78: };
-: 79:
-: 80: // initialize as soon as possible
3: 81: if(!g_thread_supported()) {
4: 82: g_thread_init(NULL);
-: 83: }
Stefan
|
|
From: Nicholas N. <n.n...@gm...> - 2010-01-04 03:31:55
|
On Mon, Jan 4, 2010 at 8:52 AM, Stefan Kost <en...@ho...> wrote:
>
> One aspect of the vcov annotated output is kind of weird. In the announcement
> mail ("Experimental Valgrind coverage tool") Nicholas wrote:
> "It's pretty simple. It just records, for each line of source code, how many
> instructions that were derived from that line were executed."
>
> So is that number in the first column (e.g. 7 for int main()) the number of
> instruction that were executed for that line? In the coverage reports I know,
> one would see the how often that line was executed.
>
>
> 7: 54:int main(int argc, char **argv) {
> -: 55: gboolean res=FALSE;
> 1: 56: gboolean arg_version=FALSE;
> 1: 57: gboolean arg_quiet=FALSE;
>
> How can it be that the first gboolean res=FALSE does not get executed?
VCov relies entirely on the debugging info added by the compiler. In
this instance, the compiler wrote the debugging info in such a way
that no code is associated with the res=FALSE line. The higher you
set the optimisation level, the more such strange things you'll see.
Nick
|