PDB & DBG 파일에 관한 이야기
In the current system, there are always two files: the executable file and a .pdb file. The .pdb file contains all the symbols. The executable file contains a pointer to the .pdb file.
In the old system, executable files and symbol files can be arranged in two different ways:
In the old symbol file system, both the two-file arrangement and the three-file arrangement contain the same executable code and the same symbols. The program can run and can be debugged in either arrangement. However, the three-file arrangement speeds up execution, because the executable file is smaller.
Symbols | Public | Private |
---|---|---|
The names and addresses of all functions | O | O |
All data type, structure, and class definitions | X | O |
The names, data types, and addresses of global variables | O | O |
The names, data types, addresses, and scopes of local variables | X | O |
The line numbers in the source code that correspond to each binary instruction | X | O |
기본 심볼 파일에서 public symbol만을 남겨놓은 심볼 파일을 stripped symbol 파일이라고 부르는데, 보다시피 함수 이름 및 전역 변수의 이름 정도만이 들어간다. 즉 stripped symbol 파일을 이용해서 콜스택을 출력하는 경우, 소스 라인 정보는 출력할 수 없다.
심볼 파일이 stripped인지 아닌지의 여부는 Debugging Tools for Windows 내에 딸려오는 symchk 유틸리티를 이용하면 알 수 있다.
>symchk /v d:\project\test.exe /s d:\project\ /pf [SYMCHK] Using search path "D:\Project\" SYMCHK: test.exe FAILED - test.pdb is stripped. SYMCHK: FAILED files = 1 SYMCHK: PASSED + IGNORED files = 0