Skip to content
Permalink
Browse files

Sync LibREDasm

  • Loading branch information...
Dax89 committed May 4, 2019
1 parent 05d2268 commit ce2f76c170882a9c31ffe828f3e5f6de4f2c5a4e
Submodule LibREDasm updated 46 files
+1 −4 CMakeLists.txt
+3 −3 redasm/analyzer/analyzer.cpp
+34 −34 redasm/assemblers/avr8/avr8.cpp
+12 −12 redasm/assemblers/chip8/chip8.cpp
+61 −61 redasm/assemblers/dalvik/dalvik.cpp
+6 −6 redasm/assemblers/dalvik/dalvik.h
+2 −2 redasm/assemblers/dalvik/dalvik_algorithm.cpp
+15 −15 redasm/assemblers/metaarm/arm_common.cpp
+2 −2 redasm/assemblers/metaarm/arm_common.h
+1 −1 redasm/assemblers/metaarm/metaarm_emulator.cpp
+2 −2 redasm/assemblers/metaarm/metaarm_isa.cpp
+50 −50 redasm/assemblers/mips/mips.cpp
+1 −1 redasm/assemblers/mips/mips_algorithm.cpp
+46 −46 redasm/assemblers/x86/x86.cpp
+1 −1 redasm/assemblers/x86/x86.h
+2 −2 redasm/assemblers/x86/x86_printer.cpp
+5 −5 redasm/disassembler/disassemblerbase.cpp
+3 −3 redasm/disassembler/listing/listingdocument.cpp
+2 −2 redasm/disassembler/listing/listingdocument.h
+11 −11 redasm/disassembler/listing/listingrenderer.cpp
+10 −10 redasm/emulator/emulator_alu.cpp
+7 −7 redasm/emulator/emulator_base.cpp
+7 −7 redasm/graph/functiongraph.cpp
+1 −1 redasm/loaders/binary/binary.cpp
+1 −1 redasm/loaders/chip8/chip8.cpp
+2 −2 redasm/loaders/dex/dex.cpp
+5 −5 redasm/loaders/elf/elf.cpp
+3 −3 redasm/loaders/elf/elf_analyzer.cpp
+7 −7 redasm/loaders/gba/gba.cpp
+1 −1 redasm/loaders/mscoff/mscoff.cpp
+1 −1 redasm/loaders/n64/n64.cpp
+6 −6 redasm/loaders/pe/pe.cpp
+5 −5 redasm/loaders/pe/pe_analyzer.cpp
+5 −5 redasm/loaders/pe/vb/vb_analyzer.cpp
+3 −3 redasm/loaders/psxexe/psxexe.cpp
+6 −6 redasm/loaders/xbe/xbe.cpp
+18 −18 redasm/plugins/assembler/algorithm/algorithm.cpp
+3 −3 redasm/plugins/assembler/algorithm/controlflow.cpp
+5 −5 redasm/plugins/assembler/assembler.h
+9 −9 redasm/plugins/assembler/printer.cpp
+3 −3 redasm/plugins/emulator.cpp
+1 −1 redasm/plugins/loader.cpp
+0 −21 redasm/redasm_api.cpp
+81 −93 redasm/redasm_api.h
+22 −0 redasm/redasm_macros.h
+2 −2 redasm/support/rtti/msvc/rtti_msvc_impl.h
@@ -37,7 +37,7 @@ void DisassemblerActions::adjustActions()
if(symbol)
m_actions[DisassemblerActions::CallGraph]->setText(QString("Callgraph %1").arg(QString::fromStdString(symbol->name)));

m_actions[DisassemblerActions::CallGraph]->setVisible(symbol && symbolsegment && symbolsegment->is(REDasm::SegmentTypes::Code));
m_actions[DisassemblerActions::CallGraph]->setVisible(symbol && symbolsegment && symbolsegment->is(REDasm::SegmentType::Code));
m_actions[DisassemblerActions::HexDumpFunction]->setVisible((symbol != nullptr));
m_actions[DisassemblerActions::HexDump]->setVisible(true);
return;
@@ -62,8 +62,8 @@ void DisassemblerActions::adjustActions()

m_actions[DisassemblerActions::Comment]->setVisible(!m_renderer->disassembler()->busy() && item->is(REDasm::ListingItem::InstructionItem));

m_actions[DisassemblerActions::HexDump]->setVisible(symbolsegment && !symbolsegment->is(REDasm::SegmentTypes::Bss));
m_actions[DisassemblerActions::HexDumpFunction]->setVisible(itemsegment && !itemsegment->is(REDasm::SegmentTypes::Bss) && itemsegment->is(REDasm::SegmentTypes::Code));
m_actions[DisassemblerActions::HexDump]->setVisible(symbolsegment && !symbolsegment->is(REDasm::SegmentType::Bss));
m_actions[DisassemblerActions::HexDumpFunction]->setVisible(itemsegment && !itemsegment->is(REDasm::SegmentType::Bss) && itemsegment->is(REDasm::SegmentType::Code));
}

void DisassemblerActions::goTo(address_t address) { m_renderer->document()->goTo(address); }
@@ -76,11 +76,11 @@ QVariant ReferencesModel::data(const QModelIndex &index, int role) const
{
REDasm::InstructionPtr instruction = document->instruction((*it)->address);

if(!instruction->is(REDasm::InstructionTypes::Conditional))
if(!instruction->is(REDasm::InstructionType::Conditional))
return THEME_VALUE("instruction_jmp_c");
else if(instruction->is(REDasm::InstructionTypes::Jump))
else if(instruction->is(REDasm::InstructionType::Jump))
return THEME_VALUE("instruction_jmp");
else if(instruction->is(REDasm::InstructionTypes::Call))
else if(instruction->is(REDasm::InstructionType::Call))
return THEME_VALUE("instruction_call");
}
else if((*it)->is(REDasm::ListingItem::SymbolItem))
@@ -85,13 +85,13 @@ QString SegmentsModel::segmentFlags(const REDasm::Segment *segment)
{
QString s;

if(segment->is(REDasm::SegmentTypes::Code))
if(segment->is(REDasm::SegmentType::Code))
ADD_SEGMENT_TYPE(s, "CODE")

if(segment->is(REDasm::SegmentTypes::Data))
if(segment->is(REDasm::SegmentType::Data))
ADD_SEGMENT_TYPE(s, "DATA")

if(segment->is(REDasm::SegmentTypes::Bss))
if(segment->is(REDasm::SegmentType::Bss))
ADD_SEGMENT_TYPE(s, "BSS")

return s;
@@ -192,7 +192,7 @@ void DisassemblerTest::testOllyDump()
if(!instruction)
return;

TEST("Validating CALL @ 0x00403BEA target", instruction->is(InstructionTypes::Call) && m_disassembler->getTargetsCount(instruction->address));
TEST("Validating CALL @ 0x00403BEA target", instruction->is(InstructionType::Call) && m_disassembler->getTargetsCount(instruction->address));

symbol = m_document->symbol(0x00407730);
TEST_SYMBOL("Checking if target is pointer", symbol, symbol->is(SymbolTypes::Pointer));
@@ -281,7 +281,7 @@ void DisassemblerTest::testIoliARM()
TEST("Checking LDR's operands count", (instruction->mnemonic == "ldr") && (instruction->operands.size() >= 2));

Operand op = instruction->operands[1];
TEST("Checking LDR's operand 2", op.is(OperandTypes::Memory));
TEST("Checking LDR's operand 2", op.is(OperandType::Memory));

const Symbol* symbol = m_document->symbol(op.u_value);
TEST_SYMBOL("Checking LDR's operand 2 symbol", symbol, symbol->is(SymbolTypes::Data) && symbol->is(SymbolTypes::Pointer));
@@ -298,7 +298,7 @@ void DisassemblerTest::testIoliARM()
TEST("Checking LDR's operands count", (instruction->mnemonic == "ldr") && (instruction->operands.size() >= 2));

op = instruction->operands[1];
TEST("Checking LDR's operand 2", op.is(OperandTypes::Memory));
TEST("Checking LDR's operand 2", op.is(OperandType::Memory));

u64 value = 0;
symbol = m_document->symbol(op.u_value);
@@ -31,7 +31,7 @@ void DisassemblerColumnView::renderArrows(size_t start, size_t count)
{
REDasm::InstructionPtr instruction = document->instruction(item->address);

if(!instruction->is(REDasm::InstructionTypes::Jump))
if(!instruction->is(REDasm::InstructionType::Jump))
continue;

for(address_t target : m_disassembler->getTargets(instruction->address))
@@ -146,22 +146,22 @@ void DisassemblerColumnView::insertPath(REDasm::ListingItem* fromitem, u64 fromi
auto pair = qMakePair(fromidx, toidx);
REDasm::InstructionPtr frominstruction = document->instruction(fromitem->address);

if(!frominstruction || !frominstruction->is(REDasm::InstructionTypes::Jump) || m_done.contains(pair))
if(!frominstruction || !frominstruction->is(REDasm::InstructionType::Jump) || m_done.contains(pair))
return;

m_done.insert(pair);

if(fromidx > toidx) // Loop
{
if(frominstruction->is(REDasm::InstructionTypes::Conditional))
if(frominstruction->is(REDasm::InstructionType::Conditional))
m_paths.append({ fromidx, toidx, THEME_VALUE("graph_edge_loop_c") });
else
m_paths.append({ fromidx, toidx, THEME_VALUE("graph_edge_loop") });

return;
}

if(frominstruction->is(REDasm::InstructionTypes::Conditional))
if(frominstruction->is(REDasm::InstructionType::Conditional))
m_paths.append({ fromidx, toidx, THEME_VALUE("graph_edge_false") });
else
m_paths.append({ fromidx, toidx, THEME_VALUE("graph_edge") });
@@ -174,7 +174,7 @@ std::string DisassemblerGraphView::getEdgeLabel(const REDasm::Graphing::Edge &e)
REDasm::InstructionPtr instruction = document->instruction(fromitem->address);
std::string label;

if(instruction && instruction->is(REDasm::InstructionTypes::Conditional))
if(instruction && instruction->is(REDasm::InstructionType::Conditional))
{
const REDasm::ListingItem* toitem = document->itemAt(tofbb->startidx);

@@ -65,7 +65,7 @@ void ListingMap::drawLabels(QPainter* painter)

for(const REDasm::Segment& segment : lock->segments())
{
if(segment.is(REDasm::SegmentTypes::Bss))
if(segment.is(REDasm::SegmentType::Bss))
continue;

int pos = this->calculatePosition(segment.offset);
@@ -95,13 +95,13 @@ void ListingMap::renderSegments(QPainter* painter)

for(const REDasm::Segment& segment : lock->segments())
{
if(segment.is(REDasm::SegmentTypes::Bss))
if(segment.is(REDasm::SegmentType::Bss))
continue;

QRect r = this->buildRect(this->calculatePosition(segment.offset),
this->calculateSize(segment.size()));

if(segment.is(REDasm::SegmentTypes::Code))
if(segment.is(REDasm::SegmentType::Code))
painter->fillRect(r, THEME_VALUE("label_fg"));
else
painter->fillRect(r, THEME_VALUE("data_fg"));

0 comments on commit ce2f76c

Please sign in to comment.
You can’t perform that action at this time.