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 a57f5f7c68)
r14.0.x
Johannes Sixt 14 years ago committed by Slávek Banko
parent d4eb6e99e2
commit 147a454872
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -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);

Loading…
Cancel
Save