本文整理汇总了C#中Microsoft.Cci.Pdb.BitAccess类的典型用法代码示例。如果您正苦于以下问题:C# BitAccess类的具体用法?C# BitAccess怎么用?C# BitAccess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BitAccess类属于Microsoft.Cci.Pdb命名空间,在下文中一共展示了BitAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DbiModuleInfo
internal DbiModuleInfo(BitAccess bits, bool readStrings) {
bits.ReadInt32(out opened);
section = new DbiSecCon(bits);
bits.ReadUInt16(out flags);
bits.ReadInt16(out stream);
bits.ReadInt32(out cbSyms);
bits.ReadInt32(out cbOldLines);
bits.ReadInt32(out cbLines);
bits.ReadInt16(out files);
bits.ReadInt16(out pad1);
bits.ReadUInt32(out offsets);
bits.ReadInt32(out niSource);
bits.ReadInt32(out niCompiler);
if (readStrings) {
bits.ReadCString(out moduleName);
bits.ReadCString(out objectName);
} else {
bits.SkipCString(out moduleName);
bits.SkipCString(out objectName);
}
bits.Align(4);
//if (opened != 0 || pad1 != 0) {
// throw new PdbException("Invalid DBI module. "+
// "(opened={0}, pad={1})", opened, pad1);
//}
}
示例2: LoadNameIndex
static Dictionary<string, int> LoadNameIndex(BitAccess bits) {
Dictionary<string, int> result = new Dictionary<string, int>();
int ver;
int sig;
int age;
Guid guid;
bits.ReadInt32(out ver); // 0..3 Version
bits.ReadInt32(out sig); // 4..7 Signature
bits.ReadInt32(out age); // 8..11 Age
bits.ReadGuid(out guid); // 12..27 GUID
//if (ver != 20000404) {
// throw new PdbDebugException("Unsupported PDB Stream version {0}", ver);
//}
// Read string buffer.
int buf;
bits.ReadInt32(out buf); // 28..31 Bytes of Strings
int beg = bits.Position;
int nxt = bits.Position + buf;
bits.Position = nxt;
// Read map index.
int cnt; // n+0..3 hash size.
int max; // n+4..7 maximum ni.
bits.ReadInt32(out cnt);
bits.ReadInt32(out max);
BitSet present = new BitSet(bits);
BitSet deleted = new BitSet(bits);
if (!deleted.IsEmpty) {
throw new PdbDebugException("Unsupported PDB deleted bitset is not empty.");
}
int j = 0;
for (int i = 0; i < max; i++) {
if (present.IsSet(i)) {
int ns;
int ni;
bits.ReadInt32(out ns);
bits.ReadInt32(out ni);
string name;
int saved = bits.Position;
bits.Position = beg + ns;
bits.ReadCString(out name);
bits.Position = saved;
result.Add(name.ToUpperInvariant(), ni);
j++;
}
}
if (j != cnt) {
throw new PdbDebugException("Count mismatch. ({0} != {1})", j, cnt);
}
return result;
}
示例3: DataStream
internal DataStream(int contentSize, BitAccess bits, int count) {
this.contentSize = contentSize;
if (count > 0) {
this.pages = new int[count];
bits.ReadInt32(this.pages);
}
}
示例4: MsfDirectory
internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits) {
bits.MinCapacity(head.directorySize);
int pages = reader.PagesFromSize(head.directorySize);
// 0..n in page of directory pages.
reader.Seek(head.directoryRoot, 0);
bits.FillBuffer(reader.reader, pages * 4);
DataStream stream = new DataStream(head.directorySize, bits, pages);
bits.MinCapacity(head.directorySize);
stream.Read(reader, bits);
// 0..3 in directory pages
int count;
bits.ReadInt32(out count);
// 4..n
int[] sizes = new int[count];
bits.ReadInt32(sizes);
// n..m
streams = new DataStream[count];
for (int i = 0; i < count; i++) {
if (sizes[i] <= 0) {
streams[i] = new DataStream();
} else {
streams[i] = new DataStream(sizes[i], bits,
reader.PagesFromSize(sizes[i]));
}
}
}
示例5: LoadFunctions
internal static PdbFunction[] LoadFunctions(Stream read, out Dictionary<uint, PdbTokenLine> tokenToSourceMapping)
{
tokenToSourceMapping = new Dictionary<uint, PdbTokenLine>();
BitAccess bits = new BitAccess(512 * 1024);
PdbFileHeader head = new PdbFileHeader(read, bits);
PdbReader reader = new PdbReader(read, head.pageSize);
MsfDirectory dir = new MsfDirectory(reader, head, bits);
DbiModuleInfo[] modules = null;
DbiDbgHdr header;
dir.streams[1].Read(reader, bits);
Dictionary<string, int> nameIndex = LoadNameIndex(bits);
int nameStream;
if (!nameIndex.TryGetValue("/NAMES", out nameStream)) {
throw new PdbException("No `name' stream");
}
dir.streams[nameStream].Read(reader, bits);
IntHashTable names = LoadNameStream(bits);
dir.streams[3].Read(reader, bits);
LoadDbiStream(bits, out modules, out header, true);
ArrayList funcList = new ArrayList();
if (modules != null) {
for (int m = 0; m < modules.Length; m++) {
var module = modules[m];
if (module.stream > 0) {
dir.streams[module.stream].Read(reader, bits);
if (module.moduleName == "TokenSourceLineInfo") {
LoadTokenToSourceInfo(bits, module, names, dir, nameIndex, reader, tokenToSourceMapping);
continue;
}
LoadFuncsFromDbiModule(bits, module, names, funcList, true, dir, nameIndex, reader);
}
}
}
PdbFunction[] funcs = (PdbFunction[])funcList.ToArray(typeof(PdbFunction));
// After reading the functions, apply the token remapping table if it exists.
if (header.snTokenRidMap != 0 && header.snTokenRidMap != 0xffff) {
dir.streams[header.snTokenRidMap].Read(reader, bits);
uint[] ridMap = new uint[dir.streams[header.snTokenRidMap].Length / 4];
bits.ReadUInt32(ridMap);
foreach (PdbFunction func in funcs) {
func.token = 0x06000000 | ridMap[func.token & 0xffffff];
}
}
//
Array.Sort(funcs, PdbFunction.byAddressAndToken);
//Array.Sort(funcs, PdbFunction.byToken);
return funcs;
}
示例6: Write
internal void Write(Stream writer, BitAccess bits) {
bits.MinCapacity(56);
bits.WriteBytes(magic); // 0..31
bits.WriteInt32(pageSize); // 32..35
bits.WriteInt32(freePageMap); // 36..39
bits.WriteInt32(pagesUsed); // 40..43
bits.WriteInt32(directorySize); // 44..47
bits.WriteInt32(zero); // 48..51
bits.WriteInt32(directoryRoot); // 52..55
writer.Seek(0, SeekOrigin.Begin);
bits.WriteBuffer(writer, 56);
}
示例7: DbiDbgHdr
internal DbiDbgHdr(BitAccess bits) {
bits.ReadUInt16(out snFPO);
bits.ReadUInt16(out snException);
bits.ReadUInt16(out snFixup);
bits.ReadUInt16(out snOmapToSrc);
bits.ReadUInt16(out snOmapFromSrc);
bits.ReadUInt16(out snSectionHdr);
bits.ReadUInt16(out snTokenRidMap);
bits.ReadUInt16(out snXdata);
bits.ReadUInt16(out snPdata);
bits.ReadUInt16(out snNewFPO);
bits.ReadUInt16(out snSectionHdrOrig);
}
示例8: LoadFunctions
internal static PdbFunction[] LoadFunctions(Stream read, BitAccess bits, bool readAllStrings)
{
PdbFileHeader head = new PdbFileHeader(read, bits);
PdbReader reader = new PdbReader(read, head.PageSize);
MsfDirectory dir = new MsfDirectory(reader, head, bits);
DbiModuleInfo[] modules;
DbiDbgHdr header;
dir.streams[1].Read(reader, bits);
Dictionary<string, int> nameIndex = LoadNameIndex(bits);
int nameStream;
if (!nameIndex.TryGetValue("/names", out nameStream)) {
throw new PdbException("No `name' stream");
}
dir.streams[nameStream].Read(reader, bits);
IntHashTable names = LoadNameStream(bits);
dir.streams[3].Read(reader, bits);
LoadDbiStream(bits, out modules, out header, readAllStrings);
ArrayList funcList = new ArrayList();
if (modules != null) {
for (int m = 0; m < modules.Length; m++) {
if (modules[m].stream > 0) {
dir.streams[modules[m].stream].Read(reader, bits);
LoadFuncsFromDbiModule(bits, modules[m], names, funcList,
readAllStrings, dir, nameIndex, reader);
}
}
}
PdbFunction[] funcs = (PdbFunction[])funcList.ToArray(typeof(PdbFunction));
// After reading the functions, apply the token remapping table if it exists.
if (header.snTokenRidMap != 0 && header.snTokenRidMap != 0xffff) {
dir.streams[header.snTokenRidMap].Read(reader, bits);
uint[] ridMap = new uint[dir.streams[header.snTokenRidMap].Length / 4];
bits.ReadUInt32(ridMap);
foreach (PdbFunction func in funcs) {
func.Token = 0x06000000 | ridMap[func.Token & 0xffffff];
}
}
//
Array.Sort(funcs, PdbFunction.ByAddress);
//Array.Sort(funcs, PdbFunction.byToken);
return funcs;
}
示例9: PdbFileHeader
internal PdbFileHeader(Stream reader, BitAccess bits) {
bits.MinCapacity(56);
reader.Seek(0, SeekOrigin.Begin);
bits.FillBuffer(reader, 56);
this.magic = new byte[32];
bits.ReadBytes(this.magic); // 0..31
bits.ReadInt32(out this.pageSize); // 32..35
bits.ReadInt32(out this.freePageMap); // 36..39
bits.ReadInt32(out this.pagesUsed); // 40..43
bits.ReadInt32(out this.directorySize); // 44..47
bits.ReadInt32(out this.zero); // 48..51
bits.ReadInt32(out this.directoryRoot); // 52..55
}
示例10: WriteMeta
internal void WriteMeta(DataStream[] streams, BitAccess bits) {
PdbFileHeader head = new PdbFileHeader(pageSize);
WriteDirectory(streams,
out head.directoryRoot,
out head.directorySize,
bits);
WriteFreeMap();
head.freePageMap = 2;
head.pagesUsed = usedBytes / pageSize;
writer.Seek(0, SeekOrigin.Begin);
head.Write(writer, bits);
}
示例11: DbiSecCon
internal DbiSecCon(BitAccess bits) {
bits.ReadInt16(out section);
bits.ReadInt16(out pad1);
bits.ReadInt32(out offset);
bits.ReadInt32(out size);
bits.ReadUInt32(out flags);
bits.ReadInt16(out module);
bits.ReadInt16(out pad2);
bits.ReadUInt32(out dataCrc);
bits.ReadUInt32(out relocCrc);
//if (pad1 != 0 || pad2 != 0) {
// throw new PdbException("Invalid DBI section. "+
// "(pad1={0}, pad2={1})",
// pad1, pad2);
//}
}
示例12: LoadInjectedSourceInformation
static void LoadInjectedSourceInformation(BitAccess bits, out Guid doctype, out Guid language, out Guid vendor, out Guid checksumAlgo, out byte[] checksum) {
int checksumSize;
int injectedSourceSize;
checksum = null;
bits.ReadGuid(out language);
bits.ReadGuid(out vendor);
bits.ReadGuid(out doctype);
bits.ReadGuid(out checksumAlgo);
bits.ReadInt32(out checksumSize);
bits.ReadInt32(out injectedSourceSize);
if (checksumSize > 0) {
checksum = new byte[checksumSize];
bits.ReadBytes(checksum);
}
}
示例13: LoadNameStream
static IntHashTable LoadNameStream(BitAccess bits) {
IntHashTable ht = new IntHashTable();
uint sig;
int ver;
bits.ReadUInt32(out sig); // 0..3 Signature
bits.ReadInt32(out ver); // 4..7 Version
// Read (or skip) string buffer.
int buf;
bits.ReadInt32(out buf); // 8..11 Bytes of Strings
if (sig != 0xeffeeffe || ver != 1) {
throw new PdbDebugException("Unsupported Name Stream version. "+
"(sig={0:x8}, ver={1})",
sig, ver);
}
int beg = bits.Position;
int nxt = bits.Position + buf;
bits.Position = nxt;
// Read hash table.
int siz;
bits.ReadInt32(out siz); // n+0..3 Number of hash buckets.
nxt = bits.Position;
for (int i = 0; i < siz; i++) {
int ni;
string name;
bits.ReadInt32(out ni);
if (ni != 0) {
int saved = bits.Position;
bits.Position = beg + ni;
bits.ReadCString(out name);
bits.Position = saved;
ht.Add(ni, name);
}
}
bits.Position = nxt;
return ht;
}
示例14: MsfDirectory
internal MsfDirectory(PdbReader reader, PdbFileHeader head, BitAccess bits)
{
int pages = reader.PagesFromSize(head.directorySize);
// 0..n in page of directory pages.
bits.MinCapacity(head.directorySize);
int directoryRootPages = head.directoryRoot.Length;
int pagesPerPage = head.pageSize / 4;
int pagesToGo = pages;
for (int i = 0; i < directoryRootPages; i++)
{
int pagesInThisPage = pagesToGo <= pagesPerPage ? pagesToGo : pagesPerPage;
reader.Seek(head.directoryRoot[i], 0);
bits.Append(reader.reader, pagesInThisPage * 4);
pagesToGo -= pagesInThisPage;
}
bits.Position = 0;
DataStream stream = new DataStream(head.directorySize, bits, pages);
bits.MinCapacity(head.directorySize);
stream.Read(reader, bits);
// 0..3 in directory pages
int count;
bits.ReadInt32(out count);
// 4..n
int[] sizes = new int[count];
bits.ReadInt32(sizes);
// n..m
streams = new DataStream[count];
for (int i = 0; i < count; i++)
{
if (sizes[i] <= 0)
{
streams[i] = new DataStream();
}
else
{
streams[i] = new DataStream(sizes[i], bits,
reader.PagesFromSize(sizes[i]));
}
}
}
示例15: PdbSlot
//internal uint segment;
//internal uint address;
internal PdbSlot(BitAccess bits) {
AttrSlotSym slot;
bits.ReadUInt32(out slot.index);
bits.ReadUInt32(out slot.typind);
bits.ReadUInt32(out slot.offCod);
bits.ReadUInt16(out slot.segCod);
bits.ReadUInt16(out slot.flags);
bits.ReadCString(out slot.name);
this.slot = slot.index;
this.typeToken = slot.typind;
this.name = slot.name;
this.flags = slot.flags;
//this.segment = slot.segCod;
//this.address = slot.offCod;
}