|
|
@ -202,38 +202,41 @@ void qvminspector_t::add_branch_children( qtree_widget_item_t *item, std::uintpt
|
|
|
|
var.setValue( virt_instr );
|
|
|
|
var.setValue( virt_instr );
|
|
|
|
virt_instr_entry->setData( 3, Qt::UserRole, var );
|
|
|
|
virt_instr_entry->setData( 3, Qt::UserRole, var );
|
|
|
|
|
|
|
|
|
|
|
|
if ( virt_instr->mnemonic_t == vm::handler::JMP && code_block->jcc.has_jcc )
|
|
|
|
if ( virt_instr->mnemonic_t == vm::handler::JMP )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
|
|
|
|
if ( code_block->jcc.type == vm::instrs::jcc_type::branching )
|
|
|
|
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
|
|
|
|
{
|
|
|
|
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
|
|
|
|
|
|
|
|
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
|
|
|
|
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
|
|
|
|
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
|
|
|
|
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
|
|
|
|
|
|
|
|
const auto block2_addr = code_block->jcc.block_addr[ 1 ];
|
|
|
|
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
|
|
|
|
|
|
|
|
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
|
|
|
|
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
const auto block2_addr = code_block->jcc.block_addr[ 1 ];
|
|
|
|
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
|
|
|
|
|
|
|
|
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
|
|
|
|
|
|
|
|
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
|
|
|
|
|
|
|
|
|
|
|
|
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
|
|
|
|
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
|
|
|
|
// if its a JMP with branches we want to insert the next code block
|
|
|
|
|
|
|
|
// instructions into the child widget entries...
|
|
|
|
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
// if its a JMP with branches we want to insert the next code block
|
|
|
|
return;
|
|
|
|
// instructions into the child widget entries...
|
|
|
|
}
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
else if ( virt_instr->mnemonic_t == vm::handler::JMP )
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
// else if this jmp doesnt have two branches add the next code block to it...
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
|
|
|
|
add_branch_children( item, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
// else if this jmp doesnt have two branches add the next code block to it...
|
|
|
|
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
|
|
|
|
add_branch_children( item, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
item->addChild( virt_instr_entry );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -343,34 +346,36 @@ void qvminspector_t::update_ui()
|
|
|
|
var.setValue( virt_instr );
|
|
|
|
var.setValue( virt_instr );
|
|
|
|
virt_instr_entry->setData( 3, Qt::UserRole, var );
|
|
|
|
virt_instr_entry->setData( 3, Qt::UserRole, var );
|
|
|
|
|
|
|
|
|
|
|
|
if ( virt_instr->mnemonic_t == vm::handler::JMP && code_block->jcc.has_jcc )
|
|
|
|
if ( virt_instr->mnemonic_t == vm::handler::JMP )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
|
|
|
|
if ( code_block->jcc.type == vm::instrs::jcc_type::branching )
|
|
|
|
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
|
|
|
|
{
|
|
|
|
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1, %2 }" )
|
|
|
|
|
|
|
|
.arg( code_block->jcc.block_addr[ 0 ], 0, 16 )
|
|
|
|
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
|
|
|
|
.arg( code_block->jcc.block_addr[ 1 ], 0, 16 ) );
|
|
|
|
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
|
|
|
|
|
|
|
|
const auto block2_addr = code_block->jcc.block_addr[ 1 ];
|
|
|
|
auto branch_entry1 = new qtree_widget_item_t(), branch_entry2 = new qtree_widget_item_t();
|
|
|
|
|
|
|
|
const auto block1_addr = code_block->jcc.block_addr[ 0 ];
|
|
|
|
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
const auto block2_addr = code_block->jcc.block_addr[ 1 ];
|
|
|
|
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
|
|
|
|
|
|
|
|
branch_entry1->setText( 0, QString( "%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
branch_entry1->setText( 3, QString( "; block_%1" ).arg( block1_addr, 0, 16 ) );
|
|
|
|
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
|
|
|
|
|
|
|
|
branch_entry2->setText( 0, QString( "%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
branch_entry2->setText( 3, QString( "; block_%1" ).arg( block2_addr, 0, 16 ) );
|
|
|
|
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
|
|
|
|
|
|
|
|
|
|
|
|
add_branch_children( branch_entry1, code_block->jcc.block_addr[ 0 ] );
|
|
|
|
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
|
|
|
|
add_branch_children( branch_entry2, code_block->jcc.block_addr[ 1 ] );
|
|
|
|
// if its a JMP with branches we want to insert the next code block
|
|
|
|
|
|
|
|
// instructions into the child widget entries...
|
|
|
|
virt_instr_entry->addChildren( { branch_entry1, branch_entry2 } );
|
|
|
|
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
|
|
|
|
// if its a JMP with branches we want to insert the next code block
|
|
|
|
goto finish; // bad code...
|
|
|
|
// instructions into the child widget entries...
|
|
|
|
|
|
|
|
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
|
|
|
|
|
|
|
|
goto finish; // bad code...
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ( code_block->jcc.type == vm::instrs::jcc_type::absolute )
|
|
|
|
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( virt_instr->mnemonic_t == vm::handler::JMP )
|
|
|
|
|
|
|
|
virt_instr_entry->setText( 3, QString( "; { %1 }" ).arg( code_block->jcc.block_addr[ 0 ], 0, 16 ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
|
|
|
|
ui.virt_instrs->addTopLevelItem( virt_instr_entry );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|