文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页技术开发PHP 学院 → gcov-dump原理分析_Linux平台代码覆盖率测试

gcov-dump原理分析_Linux平台代码覆盖率测试

时间:2011/7/12 8:18:44来源:本站原创作者:清晨我要评论(0)

9 页 ARCS tag: tag_arcs() 函数


3.3 ARCS tag: tag_arcs() 函数

static void

tag_arcs ( const char * filename ATTRIBUTE_UNUSED ,

unsigned tag ATTRIBUTE_UNUSED , unsigned length ATTRIBUTE_UNUSED )

{

unsigned n_arcs = GCOV_TAG_ARCS_NUM ( length );

printf ( " %u arcs" , n_arcs ); // 输出提示信息,几个 arcs



if ( flag_dump_contents )

{

unsigned ix ;

unsigned blockno = gcov_read_unsigned ();



for ( ix = 0 ; ix != n_arcs ; ix ++ )

{

unsigned dst , flags ;

if ( ! ( ix & 3 )) // 如果 arcs 较多,则每 4 个为 1 行输出,且每行前面输出 blockno

{

printf ( "/n" );

print_prefix ( filename , 0 , gcov_position ());

printf ( "/tblock %u:" , blockno );

}



dst = gcov_read_unsigned (); // 读取目的 blockno

flags = gcov_read_unsigned ();

printf ( " %u:%04x" , dst , flags );

}

}

}

输出格式:

n arcs //n 个 arcs ,每 4 个为 1 行输出

blockno: dst0:flags0 dst1:flags1 dst2:flags2 dst3:flags3

blockno: dst4:flags4 dst5:flags5 dst6:flags6 dst7:flags7

...

同上,需要注意前导符或者输出位置。 dst0, ..., 表示目的 block 的 blockno 。



3.4 LINES tag: tag_lines() 函数

static void

tag_lines ( const char * filename ATTRIBUTE_UNUSED ,

unsigned tag ATTRIBUTE_UNUSED , unsigned length ATTRIBUTE_UNUSED )

{

if ( flag_dump_contents )

{

unsigned blockno = gcov_read_unsigned ();

char const * sep = NULL ;



while ( 1 )

{

gcov_position_t position = gcov_position ();

const char * source = NULL ;

unsigned lineno = gcov_read_unsigned ();



if ( ! lineno ) //lineno=0 时才会执行该 clause ,因此 lineno=0 即为以后的新的文件的标志

{

source = gcov_read_string (); // 该函数读取 length(4 字节 ) 和 length 个 words(4*length 字节 )

if ( ! source ) //source 即为文件名,没有源文件了,就退出

break ;

sep = NULL ;

}



if ( ! sep ) //sep=NULL 才会执行该 clause ,那么什么时候会为 NULL 呢?——就是新的文件开始,实际上就是 lineno=0

{

printf ( "/n" );

print_prefix ( filename , 0 , position );

printf ( "/tblock %u:" , blockno );

sep = "" ;

}



if ( lineno )

{

printf ( "%s%u" , sep , lineno );

sep = ", " ;

}

else

{

printf ( "%s`%s'" , sep , source ); //lineno=0 时,输出该文件名,之后 sep= " : "

sep = ":" ;

}

}

}

}

输出格式:

block blockno:'filename':lineno1, lineno2, ...



例如: block 1:'test.c':4, 7, 9

其中,前面的 block 为提示信息。同上,需要注意前导符或者输出位置。

相关视频

    没有数据

相关阅读 盘古越狱原理分析(看清它如何越狱的!)茄子快传原理是什么 茄子快传的原理分析硬盘保护卡的原理分析更改IE标题栏和注册表的原理分析VBS脚本病毒原理分析与防范 (1)VBS脚本病毒原理分析与防范QQ尾巴病毒的发送原理分析Mac虚拟机安装Linux Ubuntu教程 Parallels desktop安装linux教程

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 nginx-1.0.4的容器源码如何在xp系统用IIS搭建 nginx-1.0.4的容器源码分析—数组结构ngx_aPHP编程技巧提高PHP开发效率php站内全文搜索代码如何在xp系统用IIS搭建php环境

人气排行 如何在xp系统用IIS搭建php环境php输出内容乱码解决方法php站内全文搜索代码gcov-dump原理分析_Linux平台代码覆盖率测试如何架设PHP服务器nginx-1.0.4的容器源码分析—数组结构ngx_a用PHP实现文件管理系统PHP编程技巧提高PHP开发效率