almost done with update... some more to code but getting there...

merge-requests/5/head
_xeroxz 3 years ago
parent 5bf0732d7f
commit b5fb4da5bb

@ -180,5 +180,46 @@ bool qvm_inspector::serialize_vmp2( std::vector< rtn_data_t > &virt_rtns )
void qvm_inspector::update_virtual_instructions( std::uintptr_t rtn_addr, QTreeWidgetItem *parent ) void qvm_inspector::update_virtual_instructions( std::uintptr_t rtn_addr, QTreeWidgetItem *parent )
{ {
auto _rtn = std::find_if( virt_rtns.begin(), virt_rtns.end(),
[ & ]( rtn_data_t &rtn ) -> bool { return rtn.rtn_rva == rtn_addr; } );
if ( _rtn == virt_rtns.end() )
return;
for ( const auto &vinstr : _rtn->rtn_blks[ 0 ].vinstrs )
{
const auto profile = vm::handler::get_profile( vinstr.mnemonic_t );
auto virt_instr_entry = new QTreeWidgetItem();
// virtual instruction operand bytes... (column 2)...
QString operand_bytes;
operand_bytes.append( QString( "%1" ).arg( vinstr.opcode, 0, 16 ) );
// if virt instruction has an imm... grab its bytes...
if ( vinstr.operand.has_imm )
{
operand_bytes.append( " - " );
for ( auto _idx = 0u; _idx < vinstr.operand.imm.imm_size / 8; ++_idx )
operand_bytes.append( QString( "%1 " ).arg(
reinterpret_cast< const std::uint8_t * >( &vinstr.operand.imm.u )[ _idx ], 0, 16 ) );
}
virt_instr_entry->setText( 1, operand_bytes );
// virtual instruction string, includes imm... (colume 3)...
QString decoded_instr(
QString( "%1" ).arg( profile ? profile->name : QString( "UNK(%1)" ).arg( vinstr.opcode, 0, 16 ) ) );
if ( vinstr.operand.has_imm ) // if there is a second operand (imm) put its value...
decoded_instr.append( QString( " %1" ).arg( vinstr.operand.imm.u, 0, 16 ) );
virt_instr_entry->setText( 2, decoded_instr );
// add comments to the virtual instruction... (colume 4)...
if ( vinstr.mnemonic_t == vm::handler::LREGQ || vinstr.mnemonic_t == vm::handler::SREGQ )
virt_instr_entry->setText(
3, QString( "; vreg%1" ).arg( vinstr.operand.imm.u ? ( vinstr.operand.imm.u / 8 ) : 0u ) );
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
}
} }

@ -101,5 +101,5 @@ void qvm_virtual_routines::on_select()
update_vm_enter( g_main_window->g_vm_ctx ); update_vm_enter( g_main_window->g_vm_ctx );
update_calc_jmp( g_main_window->g_vm_ctx ); update_calc_jmp( g_main_window->g_vm_ctx );
update_vm_handlers( g_main_window->g_vm_ctx ); update_vm_handlers( g_main_window->g_vm_ctx );
g_main_window->update_virtual_instructions( g_main_window->img_base + entry_rva ); g_main_window->update_virtual_instructions( entry_rva );
} }
Loading…
Cancel
Save