mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
SPU Debugger: Implement viewing block hash on request
This commit is contained in:
parent
3c46388be5
commit
33eeee0ff2
3 changed files with 35 additions and 0 deletions
|
@ -5199,3 +5199,25 @@ std::unique_ptr<spu_recompiler_base> spu_recompiler_base::make_fast_llvm_recompi
|
||||||
{
|
{
|
||||||
return std::make_unique<spu_fast>();
|
return std::make_unique<spu_fast>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern std::string format_spu_func_info(u32 addr, cpu_thread* spu)
|
||||||
|
{
|
||||||
|
spu_thread* _spu = static_cast<spu_thread*>(spu);
|
||||||
|
|
||||||
|
std::unique_ptr<spu_recompiler_base> compiler = spu_recompiler_base::make_asmjit_recompiler();
|
||||||
|
compiler->init();
|
||||||
|
auto func = compiler->analyse(reinterpret_cast<const be_t<u32>*>(_spu->ls), addr);
|
||||||
|
|
||||||
|
std::string info;
|
||||||
|
{
|
||||||
|
sha1_context ctx;
|
||||||
|
u8 output[20];
|
||||||
|
|
||||||
|
sha1_starts(&ctx);
|
||||||
|
sha1_update(&ctx, reinterpret_cast<const u8*>(func.data.data()), func.data.size() * 4);
|
||||||
|
sha1_finish(&ctx, output);
|
||||||
|
fmt::append(info, "size=%d, end=0x%x, hash=%s", func.data.size(), addr + func.data.size() * 4, fmt::base57(output));
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ constexpr auto qstr = QString::fromStdString;
|
||||||
|
|
||||||
extern bool ppu_patch(u32 addr, u32 value);
|
extern bool ppu_patch(u32 addr, u32 value);
|
||||||
|
|
||||||
|
extern std::string format_spu_func_info(u32 addr, cpu_thread* spu);
|
||||||
|
|
||||||
instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, CPUDisAsm* _disasm, std::function<cpu_thread*()> func)
|
instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, CPUDisAsm* _disasm, std::function<cpu_thread*()> func)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_pc(_pc)
|
, m_pc(_pc)
|
||||||
|
@ -58,6 +60,16 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C
|
||||||
vbox_right_panel->addWidget(m_instr);
|
vbox_right_panel->addWidget(m_instr);
|
||||||
vbox_right_panel->addWidget(m_preview);
|
vbox_right_panel->addWidget(m_preview);
|
||||||
|
|
||||||
|
if (cpu && cpu->id_type() == 2)
|
||||||
|
{
|
||||||
|
// Print block information as if this instruction is its beginning
|
||||||
|
vbox_left_panel->addWidget(new QLabel(tr("Block Info: ")));
|
||||||
|
m_func_info = new QLabel("", this);
|
||||||
|
vbox_right_panel->addWidget(m_func_info);
|
||||||
|
|
||||||
|
m_func_info->setText(qstr(format_spu_func_info(m_pc, cpu)));
|
||||||
|
}
|
||||||
|
|
||||||
if (cpu && cpu->id_type() == 2)
|
if (cpu && cpu->id_type() == 2)
|
||||||
{
|
{
|
||||||
const auto& spu = static_cast<spu_thread&>(*cpu);
|
const auto& spu = static_cast<spu_thread&>(*cpu);
|
||||||
|
|
|
@ -20,6 +20,7 @@ private:
|
||||||
std::shared_ptr<CPUDisAsm> m_disasm; // shared in order to allow an incomplete type
|
std::shared_ptr<CPUDisAsm> m_disasm; // shared in order to allow an incomplete type
|
||||||
QLineEdit* m_instr;
|
QLineEdit* m_instr;
|
||||||
QLabel* m_preview;
|
QLabel* m_preview;
|
||||||
|
QLabel* m_func_info = nullptr;
|
||||||
QCheckBox* m_apply_for_spu_group = nullptr;
|
QCheckBox* m_apply_for_spu_group = nullptr;
|
||||||
|
|
||||||
const std::function<cpu_thread*()> m_get_cpu;
|
const std::function<cpu_thread*()> m_get_cpu;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue