mirror of
https://github.com/libretro/Mu.git
synced 2026-02-04 05:35:13 +00:00
Decompiling now supported directly in the emu, cleanups
This commit is contained in:
@@ -22,6 +22,7 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
# OS 5 support is mandatory for the QT port
|
||||
CONFIG += support_palm_os5
|
||||
|
||||
windows{
|
||||
@@ -158,6 +159,7 @@ support_palm_os5{
|
||||
../../src/armv5te/arm_interpreter.cpp \
|
||||
../../src/armv5te/cpu.cpp \
|
||||
../../src/armv5te/coproc.cpp \
|
||||
../../src/armv5te/disasm.c \
|
||||
../../src/armv5te/emuVarPool.c \
|
||||
../../src/armv5te/thumb_interpreter.cpp \
|
||||
../../src/armv5te/mem.c \
|
||||
@@ -190,6 +192,7 @@ support_palm_os5{
|
||||
../../src/armv5te/asmcode.h \
|
||||
../../src/armv5te/bitfield.h \
|
||||
../../src/armv5te/cpu.h \
|
||||
../../src/armv5te/disasm.h \
|
||||
../../src/armv5te/emu.h \
|
||||
../../src/armv5te/mem.h \
|
||||
../../src/armv5te/translate.h \
|
||||
|
||||
@@ -94,6 +94,19 @@ void DebugViewer::on_debugGetHexValues_clicked(){
|
||||
}
|
||||
}
|
||||
|
||||
void DebugViewer::on_debugDecompile_clicked(){
|
||||
EmuWrapper& emu = ((MainWindow*)parentWidget())->emu;
|
||||
int64_t address = numberFromString(ui->debugAddress->text(), true/*negative not allowed*/);
|
||||
int64_t length = numberFromString(ui->debugLength->text(), true/*negative not allowed*/);
|
||||
|
||||
ui->debugValueList->clear();
|
||||
|
||||
if(address != INT64_MIN && length != INT64_MIN && length != 0)
|
||||
ui->debugValueList->addItems(emu.debugDisassemble(address, length).split('\n'));
|
||||
else
|
||||
ui->debugValueList->addItem("Invalid Parameters");
|
||||
}
|
||||
|
||||
void DebugViewer::on_debug8Bit_clicked(){
|
||||
bitsPerEntry = 8;
|
||||
debugRadioButtonHandler();
|
||||
|
||||
@@ -23,6 +23,7 @@ private slots:
|
||||
void debugRadioButtonHandler();
|
||||
|
||||
void on_debugGetHexValues_clicked();
|
||||
void on_debugDecompile_clicked();
|
||||
|
||||
void on_debug8Bit_clicked();
|
||||
void on_debug16Bit_clicked();
|
||||
|
||||
@@ -45,51 +45,19 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="debug8Bit">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDumpToFile">
|
||||
<property name="text">
|
||||
<string>8bit</string>
|
||||
<string>Dump To File</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="11">
|
||||
<item row="0" column="0" rowspan="12">
|
||||
<widget class="QListWidget" name="debugValueList"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="debug16Bit">
|
||||
<property name="text">
|
||||
<string>16bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugFilePath">
|
||||
<property name="placeholderText">
|
||||
<string>File Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugAddress">
|
||||
<property name="placeholderText">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugLength">
|
||||
<property name="placeholderText">
|
||||
<string>Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QRadioButton" name="debug32Bit">
|
||||
<property name="text">
|
||||
<string>32bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugGetHexValues">
|
||||
<property name="text">
|
||||
@@ -100,34 +68,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowRegisters">
|
||||
<item row="2" column="3">
|
||||
<widget class="QRadioButton" name="debug32Bit">
|
||||
<property name="text">
|
||||
<string>Show Registers</string>
|
||||
<string>32bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowDebugLogs">
|
||||
<item row="2" column="1">
|
||||
<widget class="QRadioButton" name="debug8Bit">
|
||||
<property name="text">
|
||||
<string>Show Debug Logs</string>
|
||||
<string>8bit</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugLength">
|
||||
<property name="placeholderText">
|
||||
<string>Length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDumpToFile">
|
||||
<property name="text">
|
||||
<string>Dump To File</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugEraseDebugLogs">
|
||||
<property name="text">
|
||||
<string>Erase Debug Logs</string>
|
||||
@@ -137,7 +99,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowDebugLogs">
|
||||
<property name="text">
|
||||
<string>Show Debug Logs</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QRadioButton" name="debug16Bit">
|
||||
<property name="text">
|
||||
<string>16bit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDumpToTerminal">
|
||||
<property name="text">
|
||||
<string>Dump To Terminal</string>
|
||||
@@ -147,6 +126,34 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugAddress">
|
||||
<property name="placeholderText">
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLineEdit" name="debugFilePath">
|
||||
<property name="placeholderText">
|
||||
<string>File Path</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugShowRegisters">
|
||||
<property name="text">
|
||||
<string>Show Registers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QPushButton" name="debugDecompile">
|
||||
<property name="text">
|
||||
<string>Decompile</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
|
||||
extern "C"{
|
||||
#include "../../src/flx68000.h"
|
||||
#include "../../src/m68k/m68k.h"
|
||||
#include "../../src/pxa260/pxa260.h"
|
||||
#include "../../src/armv5te/disasm.h"
|
||||
#include "../../src/debug/sandbox.h"
|
||||
}
|
||||
|
||||
@@ -528,3 +530,32 @@ uint64_t EmuWrapper::debugGetEmulatorMemory(uint32_t address, uint8_t size){
|
||||
return pxa260ReadArbitraryMemory(address, size);
|
||||
return flx68000ReadArbitraryMemory(address, size);
|
||||
}
|
||||
|
||||
QString EmuWrapper::debugDisassemble(uint32_t address, uint32_t opcodes){
|
||||
QString output = "";
|
||||
|
||||
if(palmEmulatingTungstenT3){
|
||||
for(uint32_t index = 0; index < opcodes; index++){
|
||||
address += disasm_arm_insn(address);
|
||||
output += disasmReturnBuf;
|
||||
output += '\n';
|
||||
}
|
||||
}
|
||||
else{
|
||||
char temp[100];
|
||||
|
||||
for(uint32_t index = 0; index < opcodes; index++){
|
||||
uint8_t opcodeSize = m68k_disassemble(temp, address, M68K_CPU_TYPE_DBVZ);
|
||||
QString opcodeHex = "";
|
||||
|
||||
for(uint8_t opcodeByteIndex = 0; opcodeByteIndex < opcodeSize; opcodeByteIndex++)
|
||||
opcodeHex += QString::asprintf("%02X", flx68000ReadArbitraryMemory(address + opcodeByteIndex, 8));
|
||||
|
||||
output += QString::asprintf("0x%08X: 0x%s\t%s \n", address, opcodeHex.toStdString().c_str(), temp);
|
||||
|
||||
address += opcodeSize;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -81,4 +81,5 @@ public:
|
||||
QVector<uint64_t>& debugGetDuplicateLogEntryCount();
|
||||
QString debugGetCpuRegisterString();
|
||||
uint64_t debugGetEmulatorMemory(uint32_t address, uint8_t size);
|
||||
QString debugDisassemble(uint32_t address, uint32_t opcodes);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user