From 2aff5fd486936982a6c0174bb477ede3832b0453 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 18 Aug 2000 15:24:51 +0000 Subject: [PATCH] Added single-stepping by assembler instruction. --- kdbg/commandids.h | 2 ++ kdbg/dbgdriver.h | 2 ++ kdbg/dbgmainwnd.cpp | 11 +++++++++++ kdbg/debugger.cpp | 10 ++++++---- kdbg/debugger.h | 6 ++++-- kdbg/gdbdriver.cpp | 4 ++++ kdbg/mainwndbase.cpp | 12 ++++++++++-- kdbg/pics/Makefile.am | 2 ++ kdbg/pics/pgmnexti.xpm | 29 +++++++++++++++++++++++++++++ kdbg/pics/pgmstepi.xpm | 29 +++++++++++++++++++++++++++++ 10 files changed, 99 insertions(+), 8 deletions(-) create mode 100644 kdbg/pics/pgmnexti.xpm create mode 100644 kdbg/pics/pgmstepi.xpm diff --git a/kdbg/commandids.h b/kdbg/commandids.h index 307c218..90ff7dd 100644 --- a/kdbg/commandids.h +++ b/kdbg/commandids.h @@ -29,6 +29,8 @@ #define ID_PROGRAM_ATTACH 28 #define ID_PROGRAM_DETACH 29 #define ID_PROGRAM_KILL 30 +#define ID_PROGRAM_STEPI 31 +#define ID_PROGRAM_NEXTI 32 #define ID_BRKPT_SET 40 #define ID_BRKPT_TEMP 41 diff --git a/kdbg/dbgdriver.h b/kdbg/dbgdriver.h index 23c596d..4d90048 100644 --- a/kdbg/dbgdriver.h +++ b/kdbg/dbgdriver.h @@ -59,7 +59,9 @@ enum DbgCommand { DCrun, DCcont, DCstep, + DCstepi, DCnext, + DCnexti, DCfinish, DCuntil, /* line number is zero-based! */ DCkill, diff --git a/kdbg/dbgmainwnd.cpp b/kdbg/dbgmainwnd.cpp index ba6205c..c068eac 100644 --- a/kdbg/dbgmainwnd.cpp +++ b/kdbg/dbgmainwnd.cpp @@ -224,6 +224,8 @@ void DebuggerMainWnd::initMenu() m_menuProgram->insertItem(i18n("Step &over"), ID_PROGRAM_NEXT); m_menuProgram->insertItem(i18n("Step o&ut"), ID_PROGRAM_FINISH); m_menuProgram->insertItem(i18n("Run to &cursor"), ID_PROGRAM_UNTIL); + m_menuProgram->insertItem(i18n("Step i&nto by instruction"), ID_PROGRAM_STEPI); + m_menuProgram->insertItem(i18n("Step o&ver by instruction"), ID_PROGRAM_NEXTI); m_menuProgram->insertSeparator(); m_menuProgram->insertItem(i18n("&Break"), ID_PROGRAM_BREAK); m_menuProgram->insertItem(i18n("&Kill"), ID_PROGRAM_KILL); @@ -233,7 +235,9 @@ void DebuggerMainWnd::initMenu() m_menuProgram->insertItem(i18n("&Arguments..."), ID_PROGRAM_ARGS); m_menuProgram->setAccel(Key_F5, ID_PROGRAM_RUN); m_menuProgram->setAccel(Key_F8, ID_PROGRAM_STEP); + m_menuProgram->setAccel(SHIFT+Key_F8, ID_PROGRAM_STEPI); m_menuProgram->setAccel(Key_F10, ID_PROGRAM_NEXT); + m_menuProgram->setAccel(SHIFT+Key_F10, ID_PROGRAM_NEXTI); m_menuProgram->setAccel(Key_F6, ID_PROGRAM_FINISH); m_menuProgram->setAccel(Key_F7, ID_PROGRAM_UNTIL); @@ -287,6 +291,10 @@ void DebuggerMainWnd::initToolbar() i18n("Step over")); toolbar->insertButton(BarIcon("pgmfinish.xpm"),ID_PROGRAM_FINISH, true, i18n("Step out")); + toolbar->insertButton(BarIcon("pgmstepi.xpm"),ID_PROGRAM_STEPI, true, + i18n("Step into by instruction")); + toolbar->insertButton(BarIcon("pgmnexti.xpm"),ID_PROGRAM_NEXTI, true, + i18n("Step over by instruction")); toolbar->insertSeparator(); toolbar->insertButton(BarIcon("brkpt.xpm"),ID_BRKPT_SET, true, i18n("Breakpoint")); @@ -450,7 +458,9 @@ void DebuggerMainWnd::menuCallback(int item) // start timer to move window into background switch (item) { case ID_PROGRAM_STEP: + case ID_PROGRAM_STEPI: case ID_PROGRAM_NEXT: + case ID_PROGRAM_NEXTI: case ID_PROGRAM_FINISH: case ID_PROGRAM_UNTIL: case ID_PROGRAM_RUN: @@ -500,6 +510,7 @@ void DebuggerMainWnd::updateUI() // toolbar static const int toolIds[] = { ID_PROGRAM_RUN, ID_PROGRAM_STEP, ID_PROGRAM_NEXT, ID_PROGRAM_FINISH, + ID_PROGRAM_STEPI, ID_PROGRAM_NEXTI, ID_BRKPT_SET }; UpdateToolbarUI updateToolbar(toolBar(), this, SLOT(updateUIItem(UpdateUI*)), diff --git a/kdbg/debugger.cpp b/kdbg/debugger.cpp index c36c176..6c19de3 100644 --- a/kdbg/debugger.cpp +++ b/kdbg/debugger.cpp @@ -229,18 +229,18 @@ void KDebugger::programRunAgain() } } -void KDebugger::programStep() +void KDebugger::programStep(bool byInsn) { if (canSingleStep()) { - m_d->executeCmd(DCstep, true); + m_d->executeCmd(byInsn ? DCstepi : DCstep, true); m_programRunning = true; } } -void KDebugger::programNext() +void KDebugger::programNext(bool byInsn) { if (canSingleStep()) { - m_d->executeCmd(DCnext, true); + m_d->executeCmd(byInsn ? DCnexti : DCnext, true); m_programRunning = true; } } @@ -893,7 +893,9 @@ void KDebugger::parse(CmdQueueItem* cmd, const char* output) case DCrun: case DCcont: case DCstep: + case DCstepi: case DCnext: + case DCnexti: case DCfinish: case DCuntil: case DCthread: diff --git a/kdbg/debugger.h b/kdbg/debugger.h index 8676d17..dc85bf4 100644 --- a/kdbg/debugger.h +++ b/kdbg/debugger.h @@ -77,13 +77,15 @@ public: /** * Performs a single-step, possibly stepping into a function call. + * If byInsn is true, a step by instruction is performed. */ - void programStep(); + void programStep(bool byInsn); /** * Performs a single-step, stepping over a function call. + * If byInsn is true, a step by instruction is performed. */ - void programNext(); + void programNext(bool byInsn); /** * Runs the program until it returns from the current function. diff --git a/kdbg/gdbdriver.cpp b/kdbg/gdbdriver.cpp index 9c15e10..08aa4c6 100644 --- a/kdbg/gdbdriver.cpp +++ b/kdbg/gdbdriver.cpp @@ -93,7 +93,9 @@ static GdbCmdInfo cmds[] = { { DCrun, "run\n", GdbCmdInfo::argNone }, { DCcont, "cont\n", GdbCmdInfo::argNone }, { DCstep, "step\n", GdbCmdInfo::argNone }, + { DCstepi, "stepi\n", GdbCmdInfo::argNone }, { DCnext, "next\n", GdbCmdInfo::argNone }, + { DCnexti, "nexti\n", GdbCmdInfo::argNone }, { DCfinish, "finish\n", GdbCmdInfo::argNone }, { DCuntil, "until %s:%d\n", GdbCmdInfo::argStringNum }, { DCkill, "kill\n", GdbCmdInfo::argNone }, @@ -300,7 +302,9 @@ void GdbDriver::commandFinished(CmdQueueItem* cmd) case DCrun: case DCcont: case DCstep: + case DCstepi: case DCnext: + case DCnexti: case DCfinish: case DCuntil: parseMarker(); diff --git a/kdbg/mainwndbase.cpp b/kdbg/mainwndbase.cpp index bb96b5b..dc327de 100644 --- a/kdbg/mainwndbase.cpp +++ b/kdbg/mainwndbase.cpp @@ -349,10 +349,16 @@ bool DebuggerMainWndBase::handleCommand(int item) m_debugger->programRunAgain(); return true; case ID_PROGRAM_STEP: - m_debugger->programStep(); + m_debugger->programStep(false); + return true; + case ID_PROGRAM_STEPI: + m_debugger->programStep(true); return true; case ID_PROGRAM_NEXT: - m_debugger->programNext(); + m_debugger->programNext(false); + return true; + case ID_PROGRAM_NEXTI: + m_debugger->programNext(true); return true; case ID_PROGRAM_FINISH: m_debugger->programFinish(); @@ -383,7 +389,9 @@ void DebuggerMainWndBase::updateUIItem(UpdateUI* item) item->enable(m_debugger->canUseCoreFile()); break; case ID_PROGRAM_STEP: + case ID_PROGRAM_STEPI: case ID_PROGRAM_NEXT: + case ID_PROGRAM_NEXTI: case ID_PROGRAM_FINISH: case ID_PROGRAM_UNTIL: case ID_PROGRAM_RUN_AGAIN: diff --git a/kdbg/pics/Makefile.am b/kdbg/pics/Makefile.am index 66886a8..6ec14aa 100644 --- a/kdbg/pics/Makefile.am +++ b/kdbg/pics/Makefile.am @@ -5,8 +5,10 @@ TOOLBAR = \ brkpt.xpm \ pgmfinish.xpm \ pgmnext.xpm \ + pgmnexti.xpm \ pgmrun.xpm \ pgmstep.xpm \ + pgmstepi.xpm \ execopen.xpm \ search.xpm diff --git a/kdbg/pics/pgmnexti.xpm b/kdbg/pics/pgmnexti.xpm new file mode 100644 index 0000000..b2477e4 --- /dev/null +++ b/kdbg/pics/pgmnexti.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * pgmnexti_xpm[] = { +"22 22 4 1", +" c None", +". c #8B0000", +"+ c #000000", +"@ c #000080", +" ", +" ", +" ....... ", +" ........... ", +" .... .... ", +" ... ... . ", +" . .... ", +" ... ", +" ++ ++ .... ", +" ++ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ", +" ", +" "}; diff --git a/kdbg/pics/pgmstepi.xpm b/kdbg/pics/pgmstepi.xpm new file mode 100644 index 0000000..71563a8 --- /dev/null +++ b/kdbg/pics/pgmstepi.xpm @@ -0,0 +1,29 @@ +/* XPM */ +static char * pgmstepi_xpm[] = { +"22 22 4 1", +" c None", +". c #8B0000", +"+ c #000000", +"@ c #000080", +" ", +" ", +" ....... ", +" ........ ", +" ... ", +" .. ", +" ...... ", +" .... ", +" ++ .. ++ ", +" ++ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ++ @@ ++ ", +" ", +" ", +" "}; -- 2.11.4.GIT