Skip to content

Commit 01e58e4

Browse files
committed
Allow first push ebp/rbp statement when debugging
1 parent e3f8939 commit 01e58e4

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ void Debugger::run()
624624
//put \n after commands!
625625
//b main and run before others!
626626
if (dbgSymbols)
627-
doInput(QString("b main\n"), none);
627+
doInput(QString("b *main\n"), none);
628628
else {
629629
doInput("b *0x" + QString::number(entryPoint, 16) + "\n", none);
630630
}

fasm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,15 @@ void FASM::putDebugString(CodeEditor *code)
176176
index = code->toPlainText().indexOf(QChar(':'), index);
177177
if (isx86()) {
178178
if (code->toPlainText().indexOf(
179-
QRegExp("\\s+[Mm][Oo][Vv] +[Ee][Bb][Pp] *, *[Ee][Ss][Pp]"), index + 1) != index + 1) {
179+
QRegExp("\\s+([Pp][Uu][Ss][Hh] +[Ee][Bb][Pp]\\s+)?[Mm][Oo][Vv] +[Ee][Bb][Pp] *, *[Ee][Ss][Pp]"), index + 1) != index + 1) {
180180
QTextCursor cursor = code->textCursor();
181181
cursor.movePosition(QTextCursor::Start);
182182
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);
183183
cursor.insertText(QString("\n mov ebp, esp; for correct debugging"));
184184
}
185185
} else {
186186
if (code->toPlainText().indexOf(
187-
QRegExp("\\s+[Mm][Oo][Vv] +[Rr][Bb][Pp] *, *[Rr][Ss][Pp]"), index + 1) != index + 1) {
187+
QRegExp("\\s+([Pp][Uu][Ss][Hh] +[Rr][Bb][Pp]\\s+)?[Mm][Oo][Vv] +[Rr][Bb][Pp] *, *[Rr][Ss][Pp]"), index + 1) != index + 1) {
188188
QTextCursor cursor = code->textCursor();
189189
cursor.movePosition(QTextCursor::Start);
190190
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);

gas.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ void GAS::putDebugString(CodeEditor *code)
152152
if (intelIndex == -1 || attIndex > intelIndex) { //AT&T syntax
153153
if (isx86()) {
154154
if (code->toPlainText().indexOf(
155-
QRegExp("\\s+[Mm][Oo][Vv][Ll] +%?[Ee][Ss][Pp] *, *%?[Ee][Bb][Pp]"), index + 1) != index + 1) {
155+
QRegExp("\\s+([Pp][Uu][Ss][Hh][Ll]? +%?[Ee][Bb][Pp]\\s+)?[Mm][Oo][Vv][Ll] +%?[Ee][Ss][Pp] *, *%?[Ee][Bb][Pp]"), index + 1) != index + 1) {
156156
QTextCursor cursor = code->textCursor();
157157
cursor.movePosition(QTextCursor::Start);
158158
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);
159159
cursor.insertText(QString("\n movl %esp, %ebp #for correct debugging"));
160160
}
161161
} else {
162162
if (code->toPlainText().indexOf(
163-
QRegExp("\\s+[Mm][Oo][Vv][Qq] +%?[Rr][Ss][Pp] *, *%?[Rr][Bb][Pp]"), index + 1) != index + 1) {
163+
QRegExp("\\s+([Pp][Uu][Ss][Hh][Qq]? +%?[Rr][Bb][Pp]\\s+)?[Mm][Oo][Vv][Qq] +%?[Rr][Ss][Pp] *, *%?[Rr][Bb][Pp]"), index + 1) != index + 1) {
164164
QTextCursor cursor = code->textCursor();
165165
cursor.movePosition(QTextCursor::Start);
166166
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);
@@ -170,15 +170,15 @@ void GAS::putDebugString(CodeEditor *code)
170170
} else { //Intel syntax
171171
if (isx86()) {
172172
if (code->toPlainText().indexOf(
173-
QRegExp("\\s+[Mm][Oo][Vv] +%?[Ee][Bb][Pp] *, *%?[Ee][Ss][Pp]"), index + 1) != index + 1) {
173+
QRegExp("\\s+([Pp][Uu][Ss][Hh][Ll]? +%?[Ee][Bb][Pp]\\s+)?[Mm][Oo][Vv] +%?[Ee][Bb][Pp] *, *%?[Ee][Ss][Pp]"), index + 1) != index + 1) {
174174
QTextCursor cursor = code->textCursor();
175175
cursor.movePosition(QTextCursor::Start);
176176
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);
177177
cursor.insertText(QString("\n mov %ebp, %esp #for correct debugging"));
178178
}
179179
} else {
180180
if (code->toPlainText().indexOf(
181-
QRegExp("\\s+[Mm][Oo][Vv] +%?[Rr][Bb][Pp] *, *%?[Rr][Ss][Pp]"), index + 1) != index + 1) {
181+
QRegExp("\\s+([Pp][Uu][Ss][Hh][Qq]? +%?[Rr][Bb][Pp]\\s+)?[Mm][Oo][Vv] +%?[Rr][Bb][Pp] *, *%?[Rr][Ss][Pp]"), index + 1) != index + 1) {
182182
QTextCursor cursor = code->textCursor();
183183
cursor.movePosition(QTextCursor::Start);
184184
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);

nasm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,15 @@ void NASM::putDebugString(CodeEditor *code)
175175
index = code->toPlainText().indexOf(QChar(':'), index);
176176
if (isx86()) {
177177
if (code->toPlainText().indexOf(
178-
QRegExp("\\s+[Mm][Oo][Vv] +[Ee][Bb][Pp] *, *[Ee][Ss][Pp]"), index + 1) != index + 1) {
178+
QRegExp("\\s+([Pp][Uu][Ss][Hh] +[Ee][Bb][Pp]\\s+)?[Mm][Oo][Vv] +[Ee][Bb][Pp] *, *[Ee][Ss][Pp]"), index + 1) != index + 1) {
179179
QTextCursor cursor = code->textCursor();
180180
cursor.movePosition(QTextCursor::Start);
181181
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);
182182
cursor.insertText(QString("\n mov ebp, esp; for correct debugging"));
183183
}
184184
} else {
185185
if (code->toPlainText().indexOf(
186-
QRegExp("\\s+[Mm][Oo][Vv] +[Rr][Bb][Pp] *, *[Rr][Ss][Pp]"), index + 1) != index + 1) {
186+
QRegExp("\\s+([Pp][Uu][Ss][Hh] +[Rr][Bb][Pp]\\s+)?[Mm][Oo][Vv] +[Rr][Bb][Pp] *, *[Rr][Ss][Pp]"), index + 1) != index + 1) {
187187
QTextCursor cursor = code->textCursor();
188188
cursor.movePosition(QTextCursor::Start);
189189
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, index + 1);

0 commit comments

Comments
 (0)