/** * Example: * (Preferred) load address is 00400000 */ void parseLoadAddress() { parse("load"); parse("address"); parse("is"); loadAddr = m_file.readHex(); }
/** * Example: * (Start) Length Name Class * 0001:00000000 00002c05H .text CODE */ void parseSegments() { parse("Length"); parse("Name"); parse("Class"); m_file.skipWhitespace(); while(!error()) { int seg = m_file.readHex(); parse(':'); int offs = m_file.readHex(); int len = m_file.readHex(); parse('H'); char buf[256]; m_file.readString(buf, sizeof(buf)); segments.add(MapFileEntry(seg, offs, len, buf)); // break at empty line if(nextLineEmpty()) break; } }
/** * Example: * (Address) Publics by Value Rva+Base Lib:Object * 0001:000001a0 ?stackTrace@@YAXXZ 004011a0 f main.obj */ void parseEntries() { parse("Publics"); parse("by"); parse("Value"); parse("Rva+Base"); parse("Lib:Object"); m_file.skipWhitespace(); while(!error()) { int seg = m_file.readHex(); parse(':'); int offs = m_file.readHex(); char buf[256]; m_file.readString(buf, sizeof(buf)); char* entryname = buf; // chop entry name at @@ char* end = strstr(entryname, "@@"); if(end) *end = 0; // skip preceding ?01.. while(isdigit(*entryname) || *entryname == '?' || *entryname == '$') ++entryname; // conv @ -> . for(char* str = entryname ; *str ; ++str) if(*str == '@') *str = '.'; entries.add(MapFileEntry(seg, offs, 0, entryname)); // break at empty line if(nextLineEmpty()) break; } }