사용자 도구

사이트 도구


kb:symbolfile

Symbol File System

PDB & DBG 파일에 관한 이야기

분류

Old vs Current

Current Symbol File System

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.

Old Symbol File System

In the old system, executable files and symbol files can be arranged in two different ways:

  • The executable file and a .pdb file. In this arrangement, most symbol information is in the .pdb file. The remainder of the symbol information is included in the executable file. The executable file also contains a pointer to the .pdb file.
  • The executable file, a .pdb file, and a .dbg file. The .pdb file is the same as in the two-file arrangement: it holds most of the symbols. The remainder of the symbol information is in the .dbg file. No symbol information is in the executable file. The executable file contains a pointer to the .dbg file, and the .dbg file contains a pointer to the .pdb file.

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.

Public vs Private

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

관련 페이지

링크

kb/symbolfile.txt · 마지막으로 수정됨: 2014/11/12 12:40 저자 excel96