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 15:32:08 +0200
commit147a454872687ca0e5438cc2a0deff7b8a60e744 (patch)
treeff3e2f5c6b7a08adbc9695d60264df37be88dda5
parentd4eb6e99e21729153d9aa3fbeca4d95ed5188732 (diff)
downloadkdbg-147a454872687ca0e5438cc2a0deff7b8a60e744.tar.gz
kdbg-147a454872687ca0e5438cc2a0deff7b8a60e744.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) (cherry picked from commit a57f5f7c68c0eaaf687952b4338012f1fbb51841)
-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);