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.

程序插桩

定义:往被测试程序中插入测试代码以达到测试目的的方法,插入的测试代码被称为探针。

方法:(测试代码插入的时间)

  1. 目标代码插桩
  2. 源代码插桩
public class MYFirst {
/* 第一个Java程序
* 打印Hello World
*/
public static void main(String []args) {
System.out.println("Hello World");// 打印Hello world
}
}

目标代码插桩(动态程序分析方法)

定义:向目标代码(二进制)插入测试代码。

功能:监控程序运行时的内存监控、指令追踪、错误检测等。

特点:不需要代码重新编译或者链接程序,并且目标代码的格式和具体的编程语言无关,主要和操作系统相关。

原理

在程序运行平台和底层操作系统之间建立中间层