From a57f5f7c68c0eaaf687952b4338012f1fbb51841 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 9 Jun 2010 21:05:05 +0200 Subject: [PATCH] Fix assembler code display with gdb 7.1 and later. The syntax of the 'disassemble' command changed in gdb 7.1: it now requires a comma between the two address expressions. Previously, KDbg showed an error message instead of assembler code when a plus in front of a source code line was clicked. Reported by Gerfried Essler. This reverts part of the previous commit. (cherry picked from upstream commit b6ee6a035abe41f7c0d59fbd830e895b6edeb748) --- kdbg/gdbdriver.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/kdbg/gdbdriver.cpp b/kdbg/gdbdriver.cpp index f76f753..ac86016 100644 --- a/kdbg/gdbdriver.cpp +++ b/kdbg/gdbdriver.cpp @@ -282,6 +282,38 @@ void GdbDriver::commandFinished(CmdQueueItem* cmd) return; } + switch (cmd->m_cmd) { + case DCinitialize: + { + /* + * Check for GDB 7.1 or later; the syntax for the disassemble + * command has changed. + * This RE picks the last version number in the first line, + * because at least OpenSUSE writes its own version number + * in the first line (but before GDB's version number). + */ + TQRegExp re( + " " // must be preceded by space + "[(]?" // SLES 10 embeds in parentheses + "(\\d+)\\.(\\d+)" // major, minor + "[^ ]*\\n" // no space until end of line + ); + int pos = re.search(m_output); + const char* disass = "disassemble %s %s\n"; + if (pos >= 0) { + int major = re.cap(1).toInt(); + int minor = re.cap(2).toInt(); + if (major > 7 || (major == 7 && minor >= 1)) + { + disass = "disassemble %s, %s\n"; + } + } + cmds[DCdisassemble].fmt = disass; + } + break; + default:; + } + /* ok, the command is ready */ emit commandReceived(cmd, m_output);