1
0
Fork 0

GUI: improve InfoBox for bigger memory sizes

This commit is contained in:
Duncan Ogilvie 2017-12-03 22:19:43 +01:00
parent d780df76df
commit e11701d7c3
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 36 additions and 25 deletions

View File

@ -8,22 +8,6 @@
#include "memory.h"
#include "datainst_helper.h"
static MEMORY_SIZE argsize2memsize(int argsize)
{
switch(argsize)
{
case 8:
return size_byte;
case 16:
return size_word;
case 32:
return size_dword;
case 64:
return size_qword;
}
return size_byte;
}
void fillbasicinfo(Zydis* cp, BASIC_INSTRUCTION_INFO* basicinfo, bool instrText)
{
//zero basicinfo

View File

@ -134,23 +134,25 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
valText = valTextSym;
argMnemonic = !ok ? QString("%1]=[%2").arg(argMnemonic).arg(valText) : valText;
QString sizeName = "";
int memsize = basicinfo.memory.size;
switch(memsize)
bool knownsize = true;
switch(basicinfo.memory.size)
{
case size_byte:
sizeName = "byte ptr";
sizeName = "byte ptr ";
break;
case size_word:
sizeName = "word ptr";
sizeName = "word ptr ";
break;
case size_dword:
sizeName = "dword ptr";
sizeName = "dword ptr ";
break;
case size_qword:
sizeName = "qword ptr";
sizeName = "qword ptr ";
break;
default:
knownsize = false;
break;
}
sizeName.append(' ');
sizeName += [](SEGMENTREG seg)
{
@ -177,12 +179,38 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
sizeName = sizeName.toUpper();
if(!DbgMemIsValidReadPtr(arg.value))
{
setInfoLine(j, sizeName + "[" + argMnemonic + "]=???");
else
}
else if(knownsize)
{
QString addrText = getSymbolicNameStr(arg.memvalue);
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + addrText);
}
else
{
//TODO: properly support XMM constants
QVector<unsigned char> data;
data.resize(basicinfo.memory.size);
memset(data.data(), 0, data.size());
if(DbgMemRead(arg.value, data.data(), data.size()))
{
QString hex;
hex.reserve(data.size() * 3);
for(int k = 0; k < data.size(); k++)
{
if(k)
hex.append(' ');
hex.append(ToByteString(data[k]));
}
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + hex);
}
else
{
setInfoLine(j, sizeName + "[" + argMnemonic + "]=???");
}
}
j++;
}
else

View File

@ -4,7 +4,6 @@
#include "MiscUtil.h"
#include "ldconvert.h"
QString ToLongDoubleString(void* buffer)
{
char str[32];