diff --git a/notes/README.asm_hello b/notes/README.asm_hello new file mode 100644 index 0000000..af1024a --- /dev/null +++ b/notes/README.asm_hello @@ -0,0 +1,14 @@ + +-data-disassemble -a $pc -- 2 + +^done,asm_insns=[ + {address="0x08048080",func-name="_start",offset="0",opcodes="ba 0e 00 00 00",inst="mov edx,0xe"}, + {address="0x08048085",func-name="_start",offset="5",opcodes="b9 a4 90 04 08",inst="mov ecx,0x80490a4"}, + {address="0x0804808a",func-name="_start",offset="10",opcodes="bb 01 00 00 00",inst="mov ebx,0x1"}, + {address="0x0804808f",func-name="_start",offset="15",opcodes="b8 04 00 00 00",inst="mov eax,0x4"}, + {address="0x08048094",func-name="_start",offset="20",opcodes="cd 80",inst="int 0x80"}, + {address="0x08048096",func-name="_start",offset="22",opcodes="bb 00 00 00 00",inst="mov ebx,0x0"}, + {address="0x0804809b",func-name="_start",offset="27",opcodes="b8 01 00 00 00",inst="mov eax,0x1"}, + {address="0x080480a0",func-name="_start",offset="32",opcodes="cd 80",inst="int 0x80"} + ] + diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index 507ae12..9df8e09 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -117,7 +117,7 @@ void SeerEditorManagerWidget::showAssembly () { createAssemblyWidgetTab(); } - assemblyWidgetTab()->assemblyArea()->requestAssembly("$pc"); + assemblyWidgetTab()->assemblyArea()->setAddress("$pc"); } SeerEditorWidgetAssembly* SeerEditorManagerWidget::assemblyWidgetTab () { @@ -1024,3 +1024,12 @@ void SeerEditorManagerWidget::handleRequestAssembly (QString address) { emit refreshStackFrames(); } +void SeerEditorManagerWidget::handleAssemblyConfigChanged () { + + // Tell the assembly tab to refresh. + if (assemblyWidgetTab() != 0) { + assemblyWidgetTab()->reloadAssembly(); + } +} + + diff --git a/src/SeerEditorManagerWidget.h b/src/SeerEditorManagerWidget.h index d0780b6..4aa2081 100644 --- a/src/SeerEditorManagerWidget.h +++ b/src/SeerEditorManagerWidget.h @@ -68,6 +68,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW void handleAddMemoryVisualizer (QString expression); void handleAddArrayVisualizer (QString expression); void handleRequestAssembly (QString address); + void handleAssemblyConfigChanged (); private slots: void handleFileOpenToolButtonClicked (); diff --git a/src/SeerEditorWidgetAssembly.cpp b/src/SeerEditorWidgetAssembly.cpp index 8a63642..ec66525 100644 --- a/src/SeerEditorWidgetAssembly.cpp +++ b/src/SeerEditorWidgetAssembly.cpp @@ -42,6 +42,7 @@ SeerEditorWidgetAssembly::SeerEditorWidgetAssembly(QWidget* parent) : QWidget(pa QObject::connect(searchUpToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::handleSearchUpToolButton); QObject::connect(searchLineNumberLineEdit, &QLineEdit::returnPressed, this, &SeerEditorWidgetAssembly::handleSearchLineNumberLineEdit); QObject::connect(searchCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::handleSearchCloseToolButton); + QObject::connect(refreshToolButton, &QToolButton::clicked, this, &SeerEditorWidgetAssembly::reloadAssembly); QObject::connect(assemblyWidget, &SeerEditorWidgetAssemblyArea::showSearchBar, this, &SeerEditorWidgetAssembly::showSearchBar); QObject::connect(_textSearchShortcut, &QShortcut::activated, this, &SeerEditorWidgetAssembly::handleTextSearchShortcut); @@ -100,6 +101,13 @@ const SeerKeySettings& SeerEditorWidgetAssembly::keySettings () const { return _keySettings; } +void SeerEditorWidgetAssembly::reloadAssembly () { + + QString addr = assemblyArea()->address(); + + assemblyArea()->setAddress(addr, true); +} + void SeerEditorWidgetAssembly::showSearchBar (bool flag) { // Go through the widgets in the search bar and hide/show them. diff --git a/src/SeerEditorWidgetAssembly.h b/src/SeerEditorWidgetAssembly.h index 8a98402..01f6894 100644 --- a/src/SeerEditorWidgetAssembly.h +++ b/src/SeerEditorWidgetAssembly.h @@ -45,7 +45,8 @@ class SeerEditorWidgetAssemblyArea : public SeerPlainTextEdit { void miniMapAreaPaintEvent (QPaintEvent* event); int miniMapAreaWidth (); - void setAddress (const QString& address); + void setAddress (const QString& address, bool force=false); + const QString& address () const; bool setCurrentLine (const QString& address); void scrollToLine (const QString& address); @@ -195,22 +196,23 @@ class SeerEditorWidgetAssembly : public QWidget, protected Ui::SeerEditorWidgetA SeerEditorWidgetAssemblyArea* assemblyArea (); - bool isSearchBarShown () const; - bool searchMatchCase () const; - void setKeySettings (const SeerKeySettings& settings); - const SeerKeySettings& keySettings () const; + bool isSearchBarShown () const; + bool searchMatchCase () const; + void setKeySettings (const SeerKeySettings& settings); + const SeerKeySettings& keySettings () const; public slots: - void showSearchBar (bool flag); - void setSearchMatchCase (bool flag); + void reloadAssembly (); + void showSearchBar (bool flag); + void setSearchMatchCase (bool flag); private slots: - void handleSearchLineNumberLineEdit (); - void handleSearchTextLineEdit (); - void handleSearchDownToolButton (); - void handleSearchUpToolButton (); - void handleSearchCloseToolButton (); - void handleTextSearchShortcut (); + void handleSearchLineNumberLineEdit (); + void handleSearchTextLineEdit (); + void handleSearchDownToolButton (); + void handleSearchUpToolButton (); + void handleSearchCloseToolButton (); + void handleTextSearchShortcut (); signals: private: diff --git a/src/SeerEditorWidgetAssembly.ui b/src/SeerEditorWidgetAssembly.ui index 9e68729..427a338 100644 --- a/src/SeerEditorWidgetAssembly.ui +++ b/src/SeerEditorWidgetAssembly.ui @@ -131,6 +131,20 @@ + + + + Refresh the Assembly view. + + + ... + + + + :/seer/resources/RelaxLightIcons/view-refresh.svg:/seer/resources/RelaxLightIcons/view-refresh.svg + + + diff --git a/src/SeerEditorWidgetAssemblyAreas.cpp b/src/SeerEditorWidgetAssemblyAreas.cpp index 45b1afc..44cf8e9 100644 --- a/src/SeerEditorWidgetAssemblyAreas.cpp +++ b/src/SeerEditorWidgetAssemblyAreas.cpp @@ -482,11 +482,11 @@ void SeerEditorWidgetAssemblyArea::refreshExtraSelections () { setExtraSelections(extraSelections); } -void SeerEditorWidgetAssemblyArea::setAddress (const QString& address) { +void SeerEditorWidgetAssemblyArea::setAddress (const QString& address, bool force) { // Emit the signal to load the assembly for address 'address' if // it's not already loaded. - if (_addressLineMap.contains(address.toULongLong(0,0)) == false) { + if (_addressLineMap.contains(address.toULongLong(0,0)) == false || force == true) { // Hack to keep track of address when the assembly hasn't been loaded yet. _currentAddress = address; @@ -495,6 +495,11 @@ void SeerEditorWidgetAssemblyArea::setAddress (const QString& address) { } } +const QString& SeerEditorWidgetAssemblyArea::address () const { + + return _currentAddress; +} + bool SeerEditorWidgetAssemblyArea::setCurrentLine (const QString& address) { //qDebug() << address; @@ -1119,7 +1124,7 @@ void SeerEditorWidgetAssemblyArea::handleText (const QString& text) { // Move to the line that has our address. setCurrentLine(_currentAddress); - _currentAddress = ""; + // _currentAddress = ""; // Do we need to reset this? } } diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 3f37780..643b7be 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -232,6 +232,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(this, &SeerGdbWidget::stoppingPointReached, _catchpointsBrowserWidget, &SeerCatchpointsBrowserWidget::handleStoppingPointReached); QObject::connect(this, &SeerGdbWidget::stoppingPointReached, _printpointsBrowserWidget, &SeerPrintpointsBrowserWidget::handleStoppingPointReached); QObject::connect(this, &SeerGdbWidget::stoppingPointReached, stackManagerWidget, &SeerStackManagerWidget::handleStoppingPointReached); + QObject::connect(this, &SeerGdbWidget::assemblyConfigChanged, editorManagerWidget, &SeerEditorManagerWidget::handleAssemblyConfigChanged); QObject::connect(leftCenterRightSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved); QObject::connect(sourceLibraryVariableManagerSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved); @@ -2242,6 +2243,8 @@ void SeerGdbWidget::setAssemblyDisassembyFlavor (const QString& flavor) { if (isGdbRuning()) { handleGdbAssemblyDisassemblyFlavor(); + + emit assemblyConfigChanged(); } } @@ -2256,6 +2259,8 @@ void SeerGdbWidget::setAssemblySymbolDemagling (const QString& onoff) { if (isGdbRuning()) { handleGdbAssemblySymbolDemangling(); + + emit assemblyConfigChanged(); } } diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index 6bae177..27e0a8f 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -222,6 +222,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { signals: void stoppingPointReached (); void changeWindowTitle (QString title); + void assemblyConfigChanged (); protected: