DBG: various improvements with types #1305
This commit is contained in:
parent
87b029c732
commit
6f51d06d88
|
@ -331,6 +331,12 @@ struct PrintVisitor : TypeManager::Visitor
|
||||||
return StringUtils::sprintf(format, *(T*)data);
|
return StringUtils::sprintf(format, *(T*)data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T, typename U>
|
||||||
|
static String basicPrint(void* data, const char* format)
|
||||||
|
{
|
||||||
|
return StringUtils::sprintf(format, *(T*)data, *(U*)data);
|
||||||
|
}
|
||||||
|
|
||||||
static bool cbPrintPrimitive(const TYPEDESCRIPTOR* type, char* dest, size_t* destCount)
|
static bool cbPrintPrimitive(const TYPEDESCRIPTOR* type, char* dest, size_t* destCount)
|
||||||
{
|
{
|
||||||
if(!type->addr)
|
if(!type->addr)
|
||||||
|
@ -350,41 +356,41 @@ struct PrintVisitor : TypeManager::Visitor
|
||||||
valueStr.clear();
|
valueStr.clear();
|
||||||
break;
|
break;
|
||||||
case Int8:
|
case Int8:
|
||||||
valueStr += basicPrint<char>(data(), "%c");
|
valueStr += StringUtils::sprintf("0x%02X, '%s'", *(unsigned char*)data(), StringUtils::Escape(*(char*)data()).c_str());
|
||||||
break;
|
break;
|
||||||
case Uint8:
|
case Uint8:
|
||||||
valueStr += basicPrint<unsigned char>(data(), "0x%02X");
|
valueStr += basicPrint<unsigned char, unsigned char>(data(), "0x%02X, %d");
|
||||||
break;
|
break;
|
||||||
case Int16:
|
case Int16:
|
||||||
valueStr += basicPrint<short>(data(), "%d");
|
valueStr += basicPrint<unsigned short, short>(data(), "0x%04X, %d");
|
||||||
break;
|
break;
|
||||||
case Uint16:
|
case Uint16:
|
||||||
valueStr += basicPrint<short>(data(), "%u");
|
valueStr += basicPrint<unsigned short, unsigned short>(data(), "0x%04X, %u");
|
||||||
break;
|
break;
|
||||||
case Int32:
|
case Int32:
|
||||||
valueStr += basicPrint<int>(data(), "%d");
|
valueStr += basicPrint<unsigned int, int>(data(), "0x%08X, %d");
|
||||||
break;
|
break;
|
||||||
case Uint32:
|
case Uint32:
|
||||||
valueStr += basicPrint<unsigned int>(data(), "%u");
|
valueStr += basicPrint<unsigned int, unsigned int>(data(), "0x%08X, %u");
|
||||||
break;
|
break;
|
||||||
case Int64:
|
case Int64:
|
||||||
valueStr += basicPrint<long long>(data(), "%lld");
|
valueStr += basicPrint<unsigned long long, long long>(data(), "0x%016llX, %lld");
|
||||||
break;
|
break;
|
||||||
case Uint64:
|
case Uint64:
|
||||||
valueStr += basicPrint<unsigned long long>(data(), "%llu");
|
valueStr += basicPrint<unsigned long long, unsigned long long>(data(), "0x%016llX, %llu");
|
||||||
break;
|
break;
|
||||||
case Dsint:
|
case Dsint:
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
valueStr += basicPrint<dsint>(data(), "%lld");
|
valueStr += basicPrint<duint, dsint>(data(), "0x%016llX, %lld");
|
||||||
#else
|
#else
|
||||||
valueStr += basicPrint<dsint>(data(), "%d");
|
valueStr += basicPrint<duint, dsint>(data(), "0x%08X, %d");
|
||||||
#endif //_WIN64
|
#endif //_WIN64
|
||||||
break;
|
break;
|
||||||
case Duint:
|
case Duint:
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
valueStr += basicPrint<duint>(data(), "%llu");
|
valueStr += basicPrint<duint, duint>(data(), "0x%016llX, %llu");
|
||||||
#else
|
#else
|
||||||
valueStr += basicPrint<duint>(data(), "%u");
|
valueStr += basicPrint<duint, duint>(data(), "0x%08X, %u");
|
||||||
#endif //_WIN64
|
#endif //_WIN64
|
||||||
break;
|
break;
|
||||||
case Float:
|
case Float:
|
||||||
|
@ -403,7 +409,7 @@ struct PrintVisitor : TypeManager::Visitor
|
||||||
if(MemRead(*(duint*)data(), strdata(), strdata.size() - 1))
|
if(MemRead(*(duint*)data(), strdata(), strdata.size() - 1))
|
||||||
{
|
{
|
||||||
valueStr += "\"";
|
valueStr += "\"";
|
||||||
valueStr += strdata();
|
valueStr += StringUtils::Escape(strdata());
|
||||||
valueStr.push_back('\"');
|
valueStr.push_back('\"');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue