summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2010-06-09 21:05:05 +0200
committerSlávek Banko <slavek.banko@axis.cz>2019-05-31 13:51:31 +0200
commita57f5f7c68c0eaaf687952b4338012f1fbb51841 (patch)
tree5c714a0a356f7f43e1bd405d75b10bda4cb7ce96
parent50d3d7881eee76283e171d9dc280538cccc46baf (diff)
downloadkdbg-a57f5f7c68c0eaaf687952b4338012f1fbb51841.tar.gz
kdbg-a57f5f7c68c0eaaf687952b4338012f1fbb51841.zip
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)
-rw-r--r--kdbg/gdbdriver.cpp32
1 files changed, 32 insertions, 0 deletions
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);