Skip to content

Commit e11701d

Browse files
committed
GUI: improve InfoBox for bigger memory sizes
1 parent d780df7 commit e11701d

File tree

3 files changed

+36
-25
lines changed

3 files changed

+36
-25
lines changed

src/dbg/disasm_fast.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@
88
#include "memory.h"
99
#include "datainst_helper.h"
1010

11-
static MEMORY_SIZE argsize2memsize(int argsize)
12-
{
13-
switch(argsize)
14-
{
15-
case 8:
16-
return size_byte;
17-
case 16:
18-
return size_word;
19-
case 32:
20-
return size_dword;
21-
case 64:
22-
return size_qword;
23-
}
24-
return size_byte;
25-
}
26-
2711
void fillbasicinfo(Zydis* cp, BASIC_INSTRUCTION_INFO* basicinfo, bool instrText)
2812
{
2913
//zero basicinfo

src/gui/Src/Gui/CPUInfoBox.cpp

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,25 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
134134
valText = valTextSym;
135135
argMnemonic = !ok ? QString("%1]=[%2").arg(argMnemonic).arg(valText) : valText;
136136
QString sizeName = "";
137-
int memsize = basicinfo.memory.size;
138-
switch(memsize)
137+
bool knownsize = true;
138+
switch(basicinfo.memory.size)
139139
{
140140
case size_byte:
141-
sizeName = "byte ptr";
141+
sizeName = "byte ptr ";
142142
break;
143143
case size_word:
144-
sizeName = "word ptr";
144+
sizeName = "word ptr ";
145145
break;
146146
case size_dword:
147-
sizeName = "dword ptr";
147+
sizeName = "dword ptr ";
148148
break;
149149
case size_qword:
150-
sizeName = "qword ptr";
150+
sizeName = "qword ptr ";
151+
break;
152+
default:
153+
knownsize = false;
151154
break;
152155
}
153-
sizeName.append(' ');
154156

155157
sizeName += [](SEGMENTREG seg)
156158
{
@@ -177,12 +179,38 @@ void CPUInfoBox::disasmSelectionChanged(dsint parVA)
177179
sizeName = sizeName.toUpper();
178180

179181
if(!DbgMemIsValidReadPtr(arg.value))
182+
{
180183
setInfoLine(j, sizeName + "[" + argMnemonic + "]=???");
181-
else
184+
}
185+
else if(knownsize)
182186
{
183187
QString addrText = getSymbolicNameStr(arg.memvalue);
184188
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + addrText);
185189
}
190+
else
191+
{
192+
//TODO: properly support XMM constants
193+
QVector<unsigned char> data;
194+
data.resize(basicinfo.memory.size);
195+
memset(data.data(), 0, data.size());
196+
if(DbgMemRead(arg.value, data.data(), data.size()))
197+
{
198+
QString hex;
199+
hex.reserve(data.size() * 3);
200+
for(int k = 0; k < data.size(); k++)
201+
{
202+
if(k)
203+
hex.append(' ');
204+
hex.append(ToByteString(data[k]));
205+
}
206+
setInfoLine(j, sizeName + "[" + argMnemonic + "]=" + hex);
207+
}
208+
else
209+
{
210+
setInfoLine(j, sizeName + "[" + argMnemonic + "]=???");
211+
}
212+
}
213+
186214
j++;
187215
}
188216
else

src/gui/Src/Utils/StringUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "MiscUtil.h"
55
#include "ldconvert.h"
66

7-
87
QString ToLongDoubleString(void* buffer)
98
{
109
char str[32];

0 commit comments

Comments
 (0)