For my software testers friends I added two features to my tracer.
PAUSE:number: Make a pause in milliseconds. 1000 - one second. It is convinient for testing, for creating artifical delays. For example, it is important to know program's behaviour in very slow network environment:
tracer.exe -l:test1.exe bpf=WS2_32.dll!WSARecv,pause:1000
... or if it will read from some very slow storage:
tracer.exe -l:test1.exe bpf=kernel32.dll!ReadFile,pause:1000
RT_PROBABILITY:number: Used with RT: option in pair, defines probability of RT triggering. For example, if RT:0 and RT_PROBABILITY:30% were set, 0 will be set instead of function's return value in 30% of cases. It's convenient for testing - good written program should handle errors correctly. For example, that's how we can simulate memory allocation errors, 1 malloc() call of 100 will return NULL:
tracer.exe -l:test1.exe bpf=msvcrt.dll!malloc,rt:0,rt_probability:1%
... in 10% of cases, the file will fail to open:
tracer.exe -l:test1.exe bpf=kernel32.dll!CreateFile,rt:0,rt_probability:10%
Probability may be set in usual manner, as a number in 0 (never) to 1 (always) interval. 10% is 0.1, 3% is 0.03, etc.
About ideas on errors also may be simulated, read here: Oracle RDBMS internal self-testing features.
This open sourced site and this page in particular is hosted on GitHub. Patches, suggestions and comments are welcome.
→ [list of blog posts]Please drop me email about any bug(s) and suggestion(s): dennis(@)yurichev.com.