除preT gcov输出,以确定基本块 [英] interpret gcov output to identify basic blocks

查看:121
本文介绍了除preT gcov输出,以确定基本块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用gcov的使用选项-a(--all块),它从手动:

I am using gcov with the option -a (--all-blocks) which from the manual:

When you use the -a option, you will get individual block counts

原始文件:

#include <stdio.h>
#include "file1.h"

int max(int a , int b)
{
  int k = 0;
  if (a > b)
    return a;
  else
    return b;
}

该文件的gcov是以下内容:

The gcov file is the following:

    -:    0:Source:file1.c
    -:    0:Graph:file1.gcno
    -:    0:Data:file1.gcda
    -:    0:Runs:1
    -:    0:Programs:1
    -:    1:#include <stdio.h>
    -:    2:#include "file1.h"
    -:    3:
    -:    4:int max(int a , int b)
    1:    5:{
    1:    6:  int k = 0;
    1:    7:  if (a > b)
    1:    7-block  0
    1:    8:    return a;
    1:    8-block  0
    -:    9:  else
    1:   10:    return b;
$$$$$:   10-block  0
    1:   10-block  1
    -:   11:}
    -:   12:
    -:   13:

我找不到关于对gcov输出格式的任何信息。从原来的code口可以识别3个基本块,但gcov一个只有数字两个也符合10它确定了两个街区。

I couldn't find any information about the format of the output of the gcov. From the original code I can identify 3 basic blocks but gcov only numbers two and also in line 10 it identifies two blocks.

推荐答案

模块号是当地的一条线。 0块第7行手段等。7号线的0号块你有块1 只有当行有两个以上的块中,与线10的情况下

Block numbers are local to a line. block 0 on line 7 means "block 0 of line 7" etc. You have block 1 only when a line has two or more blocks, as is the case with line 10.

的块数示于该块的最后一行仅

The block number is shown on the last line of that block only.

这样,你的程序有4块,其中两个在第10行。

Thus, your program has 4 blocks, two of them on line 10.

这篇关于除preT gcov输出,以确定基本块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆