程序插桩
程序插桩定义:往被测试程序中插入测试代码以达到测试目的的方法,插入的测试代码被称为探针。 方法:(测试代码插入的时间) 目标代码插桩 源代码插桩 目标代码插桩(动态程序分析方法)特点:不需要代码重新编译或者链接程序,并且目标代码的格式和具体的编程语言无关,主要和操作系统相关。 原理:直接修改二进制程序(无需源码),在程序运行平台和底层操作系统之间建立中间层,通过动态中间层(如Pin、DynamoRIO)插入探针代码,监控内存、指令执行等 工具示例 Pin(Intel开发):用于动态二进制分析,支持指令跟踪、缓存模拟等,常用于大型软件(如Office)测试。 DynamoRIO:支持实时代码转换,适用于内存调试和性能分析。 源代码插桩原理:在源代码编译前,通过词法、语法分析确定插桩位置,直接插入探针代码。例如在条件分支、循环或函数入口/出口处插入日志或断言。 示例:C代码在第13行插入宏ASSERT(y),用于检测除数是否为0: #include <stdio.h>#define ASSERT(y) if(y){...
AFL
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. 程序插桩定义:往被测试程序中插入测试代码以达到测试目的的方法,插入的测试代码被称为探针。 方法:(测试代码插入的时间) 目标代码插桩 源代码插桩 public class MYFirst { /* 第一个Java程序 * 打印Hello World */ public static void main(String []args) { System.out.println("Hello World");// 打印Hello world ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick StartCreate a new post$ hexo new "My New Post" More info: Writing Run server$ hexo server More info: Server Generate static files$ hexo generate More info: Generating Deploy to remote sites$ hexo deploy More info: Deployment