| 408 | /***************************************************************************/ |
| 409 | |
| 410 | void DisassembleWidget::disassembleMemoryHandler(const ResultRecord& r) |
| 411 | { |
| 412 | const Value& content = r[QStringLiteral("asm_insns")]; |
| 413 | QString currentFunction; |
| 414 | |
| 415 | m_regionDisassemblyFlavorUpToDate = true; |
| 416 | |
| 417 | m_disassembleWindow->clear(); |
| 418 | |
| 419 | for(int i = 0; i < content.size(); ++i) |
| 420 | { |
| 421 | const Value& line = content[i]; |
| 422 | |
| 423 | QString addr, fct, offs, inst; |
| 424 | |
| 425 | if( line.hasField(QStringLiteral("address")) ) addr = line[QStringLiteral("address")].literal(); |
| 426 | if( line.hasField(QStringLiteral("func-name")) ) fct = line[QStringLiteral("func-name")].literal(); |
| 427 | if( line.hasField(QStringLiteral("offset")) ) offs = line[QStringLiteral("offset")].literal(); |
| 428 | if( line.hasField(QStringLiteral("inst")) ) inst = line[QStringLiteral("inst")].literal(); |
| 429 | |
| 430 | //We use offset at the same column where function is. |
| 431 | if(currentFunction == fct){ |
| 432 | if(!fct.isEmpty()){ |
| 433 | fct = QLatin1Char('+') + offs; |
| 434 | } |
| 435 | }else { currentFunction = fct; } |
| 436 | |
| 437 | m_disassembleWindow->addTopLevelItem(new QTreeWidgetItem(m_disassembleWindow, |
| 438 | QStringList{QString(), addr, fct, inst})); |
| 439 | |
| 440 | if (i == 0) { |
| 441 | m_regionFirst = addr; |
| 442 | } else if (i == content.size()-1) { |
| 443 | m_regionLast = addr; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | displayCurrent(); |
| 448 | |
| 449 | m_disassembleWindow->resizeColumnToContents(Icon); // make Icon always visible |
| 450 | m_disassembleWindow->resizeColumnToContents(Address); // make entire address always visible |
| 451 | } |
| 452 | |
| 453 | |
| 454 | void DisassembleWidget::showEvent(QShowEvent*) |