Metadata format Program database
1 metadata format
1.1 header
1.1.1 version 2
1.2 version 7
1.3 root stream
1.3.1 version 2
1.4 version 7
1.5 stream contents
metadata format
the function of pdb metadata identify of component streams, giving length, , sequence of pages each stream. streams numbered consecutively starting 0. there root stream, unnumbered, contains of metadata.
header
the pdb begins header, consisting of:
signature, used identify , validate specific format. length of signature varies specific format.
the remainder of header varies format identified signature.
the header may longer single page.
microsoft tools use 2 pdb formats:
version 2
signature microsoft c/c++ program database 2.00\r\n\032jg\0\0 (44 bytes).
remainder of header consists of:
page size, 4 bytes.
start page, 2 bytes.
number of file pages, 2 bytes.
root stream size, 4 bytes.
reserved, 4 bytes.
root stream page number list, 2 bytes per page, enough cover above root stream size.
version 7
signature microsoft c/c++ msf 7.00\r\n\x1ads\0\0\0 (32 bytes).
remainder of header consists of:
page size, 4 bytes.
allocation table pointer, 4 bytes. meaning of unknown. there appears allocation table, array of 65,536 bits (8,192 bytes), located @ end of pdb, , 1-bit means page not being used.
number of file pages, 4 bytes.
root stream size, 4 bytes.
reserved, 4 bytes.
root stream page number list, 4 bytes per page, enough cover above root stream size.
root stream
the root stream describes of pdb streams starting stream 0. contents vary pdb format version.
version 2
the root stream consists of:
number of streams, 2 bytes.
reserved, 2 bytes.
for each stream:
stream size, 4 bytes.
reserved, 4 bytes.
for each stream:
stream page number list, 2 bytes per page, enough cover above stream size.
version 7
the root stream consists of:
number of streams, 4 bytes.
for each stream:
stream size, 4 bytes.
for each stream:
stream page number list, 4 bytes per page, enough cover above stream size.
stream contents
microsoft tools store different sorts of information in different numbered streams. stream numbers have fixed information type associated them, , other streams identified in aforementioned fixed type streams.
stream 1 used verify pdb same file referred in executable or object file stream.
version, 4 bytes.
time date stamp, 4 bytes.
age, 4 bytes. number of times pdb has been modified since creation.
guid, 16 bytes.
total length of following names, 4 bytes. followed null-terminated character strings.
stream 2 , stream 4 hold types information. actual type records define types used in program. structure of these records can found in file cvinfo.h provided microsoft. there 2 flavors of records, each own set of index numbers: type ids , types; types stored in stream 2 , type ids stored in stream 4. indices used refer these records within symbol records , other type records.
a header:
version, 4 bytes.
header size, 4 bytes.
minimum , maximum (last + 1) index type records (4 bytes each).
size of following data, 4 bytes, end of stream.
hash information:
stream number, 2 bytes 2 bytes padding.
hash key, 4 bytes.
buckets, 4 bytes.
hashvals, tioff, , hashadj, each composed of offset , length, each 4 bytes.
type records, variable length, count = (maximum - minimum) above header.
stream 3 directory other streams. note, not present in version 2, nor in pdb produced compiler.
header.
magic number, 4 bytes, = hex ffffffff.
version, 4 bytes.
age, 4 bytes.
???, public , global symbols, each stream number , format version (2 bytes each).
total size of module headers, section contributions, section headers, file info, , ts map, 4 bytes each.
mfc index, 4 bytes.
sizes of debug header, ec info, 4 bytes each.
flags, 2 bytes.
machine identifier, same used in coff object format, e.g., hex 8664 intel x86 64-bit.
reserved, 4 bytes.
module information, variable length. total size in above header. there 1 of these each object module used linker
opened, 4 bytes.
symbol info.
section number, 2 bytes + 2 bytes padding.
offset , size, 4 bytes each.
flags, 4 bytes.
module number, 2 bytes + 2 bytes padding.
crcs section data , relocations data, 4 bytes each.
flags, 2 bytes.
stream number, 2 bytes.
symbols size, 4 bytes.
old , new line number info sizes, 4 bytes each.
number of source files, 2 bytes + 2 bytes padding.
offsets, 4 bytes.
nisource , nicompiler, 4 bytes each.
module name, null terminated byte string.
object name, null terminated byte string.
padding multiple of 4 bytes.
section contributions, section headers, file info, ts map, , ec info. sizes found in above header.
debug header,
stream numbers old frame pointer omission, exceptions, fixups, object maps , source, section headers, token ring ids, xdata, pdata, new frame pointer omission, , section header origin. 2 bytes each.
Comments
Post a Comment