| 126 | } |
| 127 | |
| 128 | void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem) |
| 129 | { |
| 130 | bool no_vtables = getenv("DFHACK_NO_VTABLES"); |
| 131 | bool no_globals = getenv("DFHACK_NO_GLOBALS"); |
| 132 | TiXmlElement* pMemEntry; |
| 133 | const char *cstr_name = entry->Attribute("name"); |
| 134 | if (!cstr_name) |
| 135 | throw Error::SymbolsXmlBadAttribute("name"); |
| 136 | |
| 137 | const char *cstr_os = entry->Attribute("os-type"); |
| 138 | if (!cstr_os) |
| 139 | throw Error::SymbolsXmlBadAttribute("os-type"); |
| 140 | |
| 141 | string os = cstr_os; |
| 142 | mem->setVersion(cstr_name); |
| 143 | |
| 144 | if(os == "windows") |
| 145 | { |
| 146 | mem->setOS(OS_WINDOWS); |
| 147 | } |
| 148 | else if(os == "linux") |
| 149 | { |
| 150 | mem->setOS(OS_LINUX); |
| 151 | } |
| 152 | else if(os == "darwin") |
| 153 | { |
| 154 | mem->setOS(OS_APPLE); |
| 155 | } |
| 156 | else |
| 157 | { |
| 158 | return; // ignore it if it's invalid |
| 159 | } |
| 160 | mem->setBase(DEFAULT_BASE_ADDR); // Memory.h |
| 161 | |
| 162 | // process additional entries |
| 163 | //cout << "Entry " << cstr_version << " " << cstr_os << endl; |
| 164 | if (!entry->FirstChildElement()) { |
| 165 | cerr << "Empty symbol table: " << entry->Attribute("name") << endl; |
| 166 | return; |
| 167 | } |
| 168 | std::vector<DFHack::t_memrange> ranges; |
| 169 | Core::getInstance().p->getMemRanges(ranges); |
| 170 | pMemEntry = entry->FirstChildElement()->ToElement(); |
| 171 | for(;pMemEntry;pMemEntry=pMemEntry->NextSiblingElement()) |
| 172 | { |
| 173 | string type, name, value; |
| 174 | const char *cstr_type = pMemEntry->Value(); |
| 175 | type = cstr_type; |
| 176 | bool is_vtable = (type == "vtable-address"); |
| 177 | if(is_vtable || type == "global-address") |
| 178 | { |
| 179 | const char *cstr_key = pMemEntry->Attribute("name"); |
| 180 | if(!cstr_key) |
| 181 | throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name); |
| 182 | const char *cstr_value = pMemEntry->Attribute("value"); |
| 183 | const char *cstr_base = pMemEntry->Attribute("base"); |
| 184 | const char *cstr_mangled = pMemEntry->Attribute("mangled"); |
| 185 | if(!cstr_value && !cstr_mangled) |
nothing calls this directly
no test coverage detected