Ejemplo n.º 1
0
		/**
		 * Parses specified string.
		 * Sets error if parsed string doesnt match.
		 */
		void parse(const char* str)
		{
			char buf[256];
			m_file.readString(buf, sizeof(buf));
			if(strcmp(str, buf))
			{
				m_err = MapFile::ERROR_PARSE;
				m_errLine = m_file.line();
			}
		}
Ejemplo n.º 2
0
		/**
		 * 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;
			}
		}
Ejemplo n.º 3
0
		/**
		 * 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;
			}
		}