ff12323

Results 5 comments of ff12323

create a cmd batch file on desk, click it multi times, then can open multi windows at single path. ` "C:\Program Files\Typora\Typora.exe" C:\Users\Administrator\Desktop\\notes `

use g++ -E , u will see its a simple Preprocessing Seams, just define a function the same name, then link call it. the reset just memset value 0. Cannot...

你要mock系统调用可还行。。。 这个不是mock框架的事。 建议查看如下回答: https://stackoverflow.com/questions/71088486/how-to-mock-system-call-in-c-unit-testing-during-runtime-using-googlemock https://stackoverflow.com/questions/28392277/mocking-free-function

这个mockcpp的实现方式,叫做 inline hook。大概是这样的: 1、给定函数的地址,其在内存中属于代码段 `.text`;属于只读 =====> 需要通过系统调用: `mprotect`,将其设置为可写,而修改汇编代码; 2、x86-64位机器实现:通过修改text段,函数代码的开头14个字节。变为 ===> `jmp mock_func`( 14字节 == jmp指令(6字节) + 函数地址(8字节)) 一般函数修改代码段还好,能够起到mock的效果。 你这样会乱修改关键地方、或者动态库的,框架不支持。出现core,自己分析定位。