Debugger: Recognize source data within disassembler view

... and use it to toggle breakpoints by file and line,
and for jumping to file and line.

Task-number: QTCREATORBUG-14278
Change-Id: I799d085eb53339905ea3608022aeae5a9aef1fda
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-07-20 09:37:54 +02:00
parent e3c2236c26
commit d765cd73a2
8 changed files with 114 additions and 103 deletions

View File

@@ -48,6 +48,8 @@
#include <utils/qtcassert.h>
#include <QDebug>
#include <QTextDocument>
#include <QTextBlock>
#include <string.h>
#include <ctype.h>
@@ -340,11 +342,29 @@ ContextData getLocationContext(TextDocument *document, int lineNumber)
{
ContextData data;
QTC_ASSERT(document, return data);
data.fileName = document->filePath().toString();
if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) {
QString line = document->plainText().section(QLatin1Char('\n'), lineNumber - 1, lineNumber - 1);
data.address = DisassemblerLine::addressFromDisassemblyLine(line);
QString line = document->document()->findBlockByNumber(lineNumber - 1).text();
DisassemblerLine l;
l.fromString(line);
if (l.address) {
data.type = LocationByAddress;
data.address = l.address;
} else {
QString fileName = document->property(Constants::DISASSEMBLER_SOURCE_FILE).toString();
if (!fileName.isEmpty()) {
// Possibly one of the "27 [1] foo = x" lines
int pos = line.indexOf(QLatin1Char('['));
int ln = line.left(pos - 1).toInt();
if (ln > 0) {
data.type = LocationByFile;
data.fileName = fileName;
data.lineNumber = ln;
}
}
}
} else {
data.type = LocationByFile;
data.fileName = document->filePath().toString();
data.lineNumber = lineNumber;
}
return data;