Skip to content

Commit

Permalink
Merge pull request #258 from epasveer/255-go-to-address-in-the-assemb…
Browse files Browse the repository at this point in the history
…ly-window-doesnt-work

255 go to address in the assembly window doesnt work
  • Loading branch information
epasveer authored Oct 29, 2024
2 parents 3a0aecd + 46a18be commit 3251446
Show file tree
Hide file tree
Showing 11 changed files with 104 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
* Show breakpoint info as a tooltip if the breakpoint icon is clicked with
LMB and held down.
* Show stack as a hex dump, with options to view as short, int, long, ascii, ...
* The "go to address" in the Assembly view now works if address it outside
current assembly view.

## [2.4] - 2024-03-18
* Changed main icon to a more license friendly one.
Expand Down
11 changes: 11 additions & 0 deletions src/SeerEditorManagerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,17 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
assemblyWidget->handleText(text);
}

}else if (text.startsWith("^error,msg=\"-data-disassemble:")) {

// Get the AssemblyWidget.
SeerEditorWidgetAssembly* assemblyWidget = assemblyWidgetTab();

if (assemblyWidget) {
assemblyWidget->assemblyArea()->handleText(text);
assemblyWidget->handleText(text);
}


}else if (text.startsWith("^error,msg=\"No registers.\"")) {

//qDebug() << text;
Expand Down
4 changes: 3 additions & 1 deletion src/SeerEditorWidgetAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ void SeerEditorWidgetAssembly::handleSearchLineNumberLineEdit () {

searchLineNumberLineEdit->clear();

assemblyArea()->scrollToLine(address);
// Will emit the load signal, if 'address' is not already loaded.
assemblyArea()->setAddress(address);
assemblyArea()->setCurrentLine(address);
}

void SeerEditorWidgetAssembly::handleSearchTextLineEdit () {
Expand Down
5 changes: 4 additions & 1 deletion src/SeerEditorWidgetAssembly.ui
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,10 @@
<string>Scroll to a specific 0xAddress, +Offset, or line#.</string>
</property>
<property name="placeholderText">
<string>Go to a 0xAddress, +Offset, or line#.</string>
<string>Go to 0xAddress, +Offset, or line#.</string>
</property>
<property name="clearButtonEnabled">
<bool>true</bool>
</property>
</widget>
</item>
Expand Down
10 changes: 9 additions & 1 deletion src/SeerEditorWidgetAssemblyAreas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,8 @@ bool SeerEditorWidgetAssemblyArea::setCurrentLine (const QString& address) {
}

// Stop if no valid lineno.
if (lineno < 1) {
if (ok == false || lineno < 1) {
//qDebug() << "address is not in current assembly: '" << address << "'";
return false;
}

Expand Down Expand Up @@ -1628,7 +1629,14 @@ void SeerEditorWidgetAssemblyArea::handleText (const QString& text) {
_asm_insns_text = text;

updateTextArea(); // This function does all the work on _asm_insns_text.

}else if (text.startsWith("^error,msg=\"-data-disassemble:")) {

QString error_text = Seer::parseFirst(text, "msg=", '"', '"', false);

QMessageBox::warning(this, "Warning.", error_text);
}

}

void SeerEditorWidgetAssemblyArea::handleHighlighterSettingsChanged () {
Expand Down
6 changes: 3 additions & 3 deletions src/seergdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ int main (int argc, char* argv[]) {
QCommandLineOption breaksourceOption(QStringList() << "bs" << "break-source", "", "breakpointsource");
parser.addOption(breaksourceOption);

QCommandLineOption showAssemblyTabOption(QStringList() << "sat" << "show-assembly-tab");
QCommandLineOption showAssemblyTabOption(QStringList() << "sat" << "show-assembly-tab", "", "showassemblytab");
parser.addOption(showAssemblyTabOption);

QCommandLineOption startAddressRandomizeOption(QStringList() << "sar" << "start-address-randomize");
QCommandLineOption startAddressRandomizeOption(QStringList() << "sar" << "start-address-randomize", "", "startaddressrandomize");
parser.addOption(startAddressRandomizeOption);

QCommandLineOption nonStopModeOption(QStringList() << "nsm" << "non-stop-mode");
QCommandLineOption nonStopModeOption(QStringList() << "nsm" << "non-stop-mode", "", "nonstopmode");
parser.addOption(nonStopModeOption);

QCommandLineOption gdbProgramOption(QStringList() << "gdb-program", "", "gdbprogram");
Expand Down
4 changes: 4 additions & 0 deletions tests/helloasm2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
square_test
square_test.o
isolated_square.o
*.seer
16 changes: 16 additions & 0 deletions tests/helloasm2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY: all
all: square_test

square_test.o: square_test.s
as --32 -g square_test.s -o square_test.o

isolated_square.o: isolated_square.s
as --32 -g isolated_square.s -o isolated_square.o

square_test: square_test.o isolated_square.o
ld -m elf_i386 -g -o square_test square_test.o isolated_square.o

.PHONY: clean
clean:
rm -f square_test square_test.o isolated_square.o

14 changes: 14 additions & 0 deletions tests/helloasm2/README.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

$ objdump -t square_test

square_test: file format elf32-i386

SYMBOL TABLE:
00000000 l df *ABS* 00000000 isolated_square.o
08048070 l .text 00000000 end_square
08048067 g F .text 00000000 square
08048054 g .text 00000000 _start
08049074 g .text 00000000 __bss_start
08049074 g .text 00000000 _edata
08049074 g .text 00000000 _end

22 changes: 22 additions & 0 deletions tests/helloasm2/isolated_square.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# file name: isolated_square.s

.section .data

.section .text

.globl square

.type square,@function

square:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax

imull %eax, %eax

end_square:
movl %ebp, %esp
popl %ebp
ret

16 changes: 16 additions & 0 deletions tests/helloasm2/square_test.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file name: square_test.s
.section .data

.section .text

.globl _start

_start:
pushl $12
call square
addl $4, %esp

movl %eax, %ebx
movl $1, %eax
int $0x80

0 comments on commit 3251446

Please sign in to comment.