티스토리 뷰
Application Verifier를 사용해 프로그램의 리소스 점검이 가능한가 보다
특히, 시나리오에 따라 2분뒤 메모리 할당 실패를 지정하는 시으로 테스트 가능하다고 한다
https://stackoverflow.com/questions/192876/set-windows-process-or-user-memory-limit
오는데,
https://ezbeat.tistory.com/472
https://greenfishblog.tistory.com/133
Application Verifier 로 프로그램 체크
#어떠한 모듈을 개발하다보면 올바르게 동기화 관련 함수를 사용했는지, 유효하지 않은 핸들에 접근 한다던지, 메모리 커럽션이 발생할 수 있는 상황이 있는지 등등을 체크가 필요할 때가 있다.
고 한다.
https://www.sysnet.pe.kr/2/0/328
시스템 폴더에 exe 파일이 있는데 GUI는 안뜨고,
WinSDK를 설치하니, GUI 프로그램이 실행된다
#include <cstdio>
#include <Windows.h>
int main()
{
using namespace std;
void* p = malloc(100);
free(p);
free(p);
return 0;
}
프로그램을 등록하고 Save를 누르면 활성화가 되고,
Log를 볼수 있다.
x86 / x64 선택이 맞았을 때 error가 잡힌다
(매뉴얼에는, 상관 없는 것 처럼 나와있는데; 멀까)
Using Application Verifier with WOW64
In Windows 7, you can use either the 32-bit or the 64-bit version of Application Verifier to verify a 32-bit application running under WOW64.
In Windows Vista and earlier operating systems, you should use the 32-bit version of Application Verifier to verify 32-bit applications, and you should use the 64-bit version of Application Verifier to verify 64-bit applications.
In Windows Vista and earlier operating systems, be sure that 32-bit applications are enabled only in the 32-bit version of Application Verifier. That is, do not enable a given 32-bit application in both the 32-bit and 64-bit versions of Application Verifier.
이번에 관심이 있는건, Low Resource Simulation
특정 dll에만 수행할 수도 있다고 한다
appverif /verify mytest.exe /faults 50000 1000 d3d9.dll
Timeout – Give a time slot (in millisecond) when there is no fault at process initialization.
Wait – A number [0 – 1000000] that indicates the fault probability for the WaitForXXXX API.
Heap_Alloc - A number [0 – 1000000] that indicates the fault probability for the Heap Allocation API.
Virtual_Alloc - A number [0 – 1000000] that indicates the fault probability for the Virtual Memory allocation API.
아래 세팅으론, 2초뒤 부터 50% 확률로 alloc 실패가 발생한다
#define _CRT_SECURE_NO_WARNINGS
#include <exception>
#include <iostream>
#include <Windows.h>
#include <Psapi.h>
#include <sstream>
void* alloc() {
return HeapAlloc(GetProcessHeap(), 0, 1024*1024);
}
void run()
{
getchar();
int c = 0, i = 0;
while(true) {
void* p = alloc();
if (!p)
c++;
printf("0x%p %f%%\n", p, (float)c * 100 /(++i));
}
}
int main(int argc, char* argv[])
{
run();
return FALSE;
}
0x00000000 48.590603%
0x52305020 48.568874%
0x00000000 48.591866%
0x52417020 48.570152%
JIT debugger는
https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/enabling-postmortem-debugging
- Total
- Today
- Yesterday