Add dump support for half float
This commit is contained in:
parent
66ddb4198e
commit
f2ee27b732
|
@ -3,6 +3,7 @@
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include "StringUtil.h"
|
#include "StringUtil.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QFloat16>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
#include <QStringDecoder>
|
#include <QStringDecoder>
|
||||||
|
@ -1083,6 +1084,12 @@ void HexDump::wordToString(duint rva, uint16_t word, WordViewMode mode, RichText
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HalfFloatWord:
|
||||||
|
{
|
||||||
|
str = ToFloatingString<qfloat16>(&word, 3);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1319,6 +1326,12 @@ static int wordStringMaxLength(HexDump::WordViewMode mode)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case HexDump::HalfFloatWord:
|
||||||
|
{
|
||||||
|
length = 9;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ public:
|
||||||
HexWord,
|
HexWord,
|
||||||
UnicodeWord,
|
UnicodeWord,
|
||||||
SignedDecWord,
|
SignedDecWord,
|
||||||
UnsignedDecWord
|
UnsignedDecWord,
|
||||||
|
HalfFloatWord //half precision floatint point
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DwordViewMode
|
enum DwordViewMode
|
||||||
|
|
|
@ -239,6 +239,7 @@ void CPUDump::setupContextMenu()
|
||||||
floatMenu->addAction(makeAction(DIcon("32bit-float"), tr("&Float (32-bit)"), SLOT(floatFloatSlot())));
|
floatMenu->addAction(makeAction(DIcon("32bit-float"), tr("&Float (32-bit)"), SLOT(floatFloatSlot())));
|
||||||
floatMenu->addAction(makeAction(DIcon("64bit-float"), tr("&Double (64-bit)"), SLOT(floatDoubleSlot())));
|
floatMenu->addAction(makeAction(DIcon("64bit-float"), tr("&Double (64-bit)"), SLOT(floatDoubleSlot())));
|
||||||
floatMenu->addAction(makeAction(DIcon("80bit-float"), tr("&Long double (80-bit)"), SLOT(floatLongDoubleSlot())));
|
floatMenu->addAction(makeAction(DIcon("80bit-float"), tr("&Long double (80-bit)"), SLOT(floatLongDoubleSlot())));
|
||||||
|
floatMenu->addAction(makeAction(DIcon("word"), tr("&Half float (16-bit)"), SLOT(floatHalfSlot())));
|
||||||
mMenuBuilder->addMenu(makeMenu(DIcon("float"), tr("&Float")), floatMenu);
|
mMenuBuilder->addMenu(makeMenu(DIcon("float"), tr("&Float")), floatMenu);
|
||||||
|
|
||||||
mMenuBuilder->addAction(makeAction(DIcon("address"), tr("&Address"), SLOT(addressAsciiSlot())));
|
mMenuBuilder->addAction(makeAction(DIcon("address"), tr("&Address"), SLOT(addressAsciiSlot())));
|
||||||
|
@ -1208,6 +1209,31 @@ void CPUDump::floatLongDoubleSlot()
|
||||||
reloadData();
|
reloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPUDump::floatHalfSlot()
|
||||||
|
{
|
||||||
|
Config()->setUint("HexDump", "DefaultView", (duint)ViewFloatHalf);
|
||||||
|
int charwidth = getCharWidth();
|
||||||
|
ColumnDescriptor colDesc;
|
||||||
|
DataDescriptor dDesc;
|
||||||
|
|
||||||
|
colDesc.isData = true; //float half
|
||||||
|
colDesc.itemCount = 4;
|
||||||
|
colDesc.separator = 0;
|
||||||
|
colDesc.data.itemSize = Word;
|
||||||
|
colDesc.data.wordMode = HalfFloatWord;
|
||||||
|
appendResetDescriptor(8 + charwidth * 40, tr("Half float (16-bit)"), false, colDesc);
|
||||||
|
|
||||||
|
colDesc.isData = false; //empty column
|
||||||
|
colDesc.itemCount = 0;
|
||||||
|
colDesc.separator = 0;
|
||||||
|
dDesc.itemSize = Byte;
|
||||||
|
dDesc.byteMode = AsciiByte;
|
||||||
|
colDesc.data = dDesc;
|
||||||
|
appendDescriptor(0, "", false, colDesc);
|
||||||
|
|
||||||
|
reloadData();
|
||||||
|
}
|
||||||
|
|
||||||
void CPUDump::addressAsciiSlot()
|
void CPUDump::addressAsciiSlot()
|
||||||
{
|
{
|
||||||
Config()->setUint("HexDump", "DefaultView", (duint)ViewAddressAscii);
|
Config()->setUint("HexDump", "DefaultView", (duint)ViewAddressAscii);
|
||||||
|
|
|
@ -59,6 +59,7 @@ public slots:
|
||||||
void floatFloatSlot();
|
void floatFloatSlot();
|
||||||
void floatDoubleSlot();
|
void floatDoubleSlot();
|
||||||
void floatLongDoubleSlot();
|
void floatLongDoubleSlot();
|
||||||
|
void floatHalfSlot();
|
||||||
|
|
||||||
void addressUnicodeSlot();
|
void addressUnicodeSlot();
|
||||||
void addressAsciiSlot();
|
void addressAsciiSlot();
|
||||||
|
@ -122,7 +123,8 @@ private:
|
||||||
ViewAddressAscii,
|
ViewAddressAscii,
|
||||||
ViewAddressUnicode,
|
ViewAddressUnicode,
|
||||||
ViewHexCodepage,
|
ViewHexCodepage,
|
||||||
ViewTextCodepage
|
ViewTextCodepage,
|
||||||
|
ViewFloatHalf
|
||||||
};
|
};
|
||||||
|
|
||||||
void setView(ViewEnum_t view);
|
void setView(ViewEnum_t view);
|
||||||
|
|
|
@ -159,6 +159,7 @@ void TraceDump::setupContextMenu()
|
||||||
wFloatMenu->addAction(makeAction(DIcon("32bit-float"), tr("&Float (32-bit)"), SLOT(floatFloatSlot())));
|
wFloatMenu->addAction(makeAction(DIcon("32bit-float"), tr("&Float (32-bit)"), SLOT(floatFloatSlot())));
|
||||||
wFloatMenu->addAction(makeAction(DIcon("64bit-float"), tr("&Double (64-bit)"), SLOT(floatDoubleSlot())));
|
wFloatMenu->addAction(makeAction(DIcon("64bit-float"), tr("&Double (64-bit)"), SLOT(floatDoubleSlot())));
|
||||||
wFloatMenu->addAction(makeAction(DIcon("80bit-float"), tr("&Long double (80-bit)"), SLOT(floatLongDoubleSlot())));
|
wFloatMenu->addAction(makeAction(DIcon("80bit-float"), tr("&Long double (80-bit)"), SLOT(floatLongDoubleSlot())));
|
||||||
|
wFloatMenu->addAction(makeAction(DIcon("word"), tr("&Half float (16-bit)"), SLOT(floatHalfSlot())));
|
||||||
mMenuBuilder->addMenu(makeMenu(DIcon("float"), tr("&Float")), wFloatMenu);
|
mMenuBuilder->addMenu(makeMenu(DIcon("float"), tr("&Float")), wFloatMenu);
|
||||||
|
|
||||||
mMenuBuilder->addAction(makeAction(DIcon("address"), tr("&Address"), SLOT(addressAsciiSlot())));
|
mMenuBuilder->addAction(makeAction(DIcon("address"), tr("&Address"), SLOT(addressAsciiSlot())));
|
||||||
|
@ -992,6 +993,31 @@ void TraceDump::floatLongDoubleSlot()
|
||||||
reloadData();
|
reloadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TraceDump::floatHalfSlot()
|
||||||
|
{
|
||||||
|
Config()->setUint("HexDump", "DefaultView", (duint)ViewFloatHalf);
|
||||||
|
int charwidth = getCharWidth();
|
||||||
|
ColumnDescriptor colDesc;
|
||||||
|
DataDescriptor dDesc;
|
||||||
|
|
||||||
|
colDesc.isData = true; //float half
|
||||||
|
colDesc.itemCount = 4;
|
||||||
|
colDesc.separator = 0;
|
||||||
|
colDesc.data.itemSize = Word;
|
||||||
|
colDesc.data.wordMode = HalfFloatWord;
|
||||||
|
appendResetDescriptor(8 + charwidth * 40, tr("Half float (16-bit)"), false, colDesc);
|
||||||
|
|
||||||
|
colDesc.isData = false; //empty column
|
||||||
|
colDesc.itemCount = 0;
|
||||||
|
colDesc.separator = 0;
|
||||||
|
dDesc.itemSize = Byte;
|
||||||
|
dDesc.byteMode = AsciiByte;
|
||||||
|
colDesc.data = dDesc;
|
||||||
|
appendDescriptor(0, "", false, colDesc);
|
||||||
|
|
||||||
|
reloadData();
|
||||||
|
}
|
||||||
|
|
||||||
void TraceDump::addressAsciiSlot()
|
void TraceDump::addressAsciiSlot()
|
||||||
{
|
{
|
||||||
Config()->setUint("HexDump", "DefaultView", (duint)ViewAddressAscii);
|
Config()->setUint("HexDump", "DefaultView", (duint)ViewAddressAscii);
|
||||||
|
|
|
@ -63,6 +63,7 @@ public slots:
|
||||||
void floatFloatSlot();
|
void floatFloatSlot();
|
||||||
void floatDoubleSlot();
|
void floatDoubleSlot();
|
||||||
void floatLongDoubleSlot();
|
void floatLongDoubleSlot();
|
||||||
|
void floatHalfSlot();
|
||||||
|
|
||||||
void addressUnicodeSlot();
|
void addressUnicodeSlot();
|
||||||
void addressAsciiSlot();
|
void addressAsciiSlot();
|
||||||
|
@ -123,7 +124,8 @@ private:
|
||||||
ViewAddressAscii,
|
ViewAddressAscii,
|
||||||
ViewAddressUnicode,
|
ViewAddressUnicode,
|
||||||
ViewHexCodepage,
|
ViewHexCodepage,
|
||||||
ViewTextCodepage
|
ViewTextCodepage,
|
||||||
|
ViewFloatHalf
|
||||||
};
|
};
|
||||||
|
|
||||||
void setView(ViewEnum_t view);
|
void setView(ViewEnum_t view);
|
||||||
|
|
Loading…
Reference in New Issue