forked from qt-creator/qt-creator
Debugger: Format addresses in tooltips.
Pad to 4 digit groups and insert colons for readability. Change-Id: Icdda754e1d5ac26fd5bb90b5434b0cfa1f7a2f4e Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
|
#include "watchutils.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -87,13 +88,9 @@ QString StackFrame::toToolTip() const
|
|||||||
QString res;
|
QString res;
|
||||||
QTextStream str(&res);
|
QTextStream str(&res);
|
||||||
str << "<html><body><table>";
|
str << "<html><body><table>";
|
||||||
if (address) {
|
if (address)
|
||||||
str << "<tr><td>" << tr("Address:") << "</td><td>0x";
|
str << "<tr><td>" << tr("Address:") << "</td><td>"
|
||||||
str.setIntegerBase(16);
|
<< formatToolTipAddress(address) << "</td></tr>";
|
||||||
str << address;
|
|
||||||
}
|
|
||||||
str.setIntegerBase(10);
|
|
||||||
str << "</td></tr>";
|
|
||||||
if (!function.isEmpty())
|
if (!function.isEmpty())
|
||||||
str << "<tr><td>" << tr("Function:") << "</td><td>" << function << "</td></tr>";
|
str << "<tr><td>" << tr("Function:") << "</td><td>" << function << "</td></tr>";
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include "threadshandler.h"
|
#include "threadshandler.h"
|
||||||
#include "gdb/gdbmi.h"
|
#include "gdb/gdbmi.h"
|
||||||
|
#include "watchutils.h"
|
||||||
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggercore.h"
|
#include "debuggercore.h"
|
||||||
@@ -75,9 +76,7 @@ static QString threadToolTip(const ThreadData &thread)
|
|||||||
str << thread.function << "<br>";
|
str << thread.function << "<br>";
|
||||||
if (!thread.fileName.isEmpty())
|
if (!thread.fileName.isEmpty())
|
||||||
str << thread.fileName << ':' << thread.lineNumber << "<br>";
|
str << thread.fileName << ':' << thread.lineNumber << "<br>";
|
||||||
str.setIntegerBase(16);
|
str << formatToolTipAddress(thread.address);
|
||||||
str << "0x" << thread.address;
|
|
||||||
str.setIntegerBase(10);
|
|
||||||
}
|
}
|
||||||
str << "</table></body></html>";
|
str << "</table></body></html>";
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "watchdata.h"
|
#include "watchdata.h"
|
||||||
|
#include "watchutils.h"
|
||||||
|
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -388,11 +389,9 @@ QString WatchData::toToolTip() const
|
|||||||
val += tr(" ... <cut off>");
|
val += tr(" ... <cut off>");
|
||||||
}
|
}
|
||||||
formatToolTipRow(str, tr("Value"), val);
|
formatToolTipRow(str, tr("Value"), val);
|
||||||
formatToolTipRow(str, tr("Object Address"),
|
formatToolTipRow(str, tr("Object Address"), formatToolTipAddress(address));
|
||||||
QString::fromLatin1(hexAddress()));
|
if (referencingAddress)
|
||||||
if (referencingAddress)
|
formatToolTipRow(str, tr("Referencing Address"), formatToolTipAddress(referencingAddress));
|
||||||
formatToolTipRow(str, tr("Referencing Address"),
|
|
||||||
QString::fromLatin1(hexReferencingAddress()));
|
|
||||||
if (size)
|
if (size)
|
||||||
formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", 0, size));
|
formatToolTipRow(str, tr("Static Object Size"), tr("%n bytes", 0, size));
|
||||||
formatToolTipRow(str, tr("Internal ID"), QLatin1String(iname));
|
formatToolTipRow(str, tr("Internal ID"), QLatin1String(iname));
|
||||||
|
@@ -308,6 +308,26 @@ QByteArray stripPointerType(QByteArray type)
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format a hex address with colons as in the memory editor.
|
||||||
|
QString formatToolTipAddress(quint64 a)
|
||||||
|
{
|
||||||
|
QString rc = QString::number(a, 16);
|
||||||
|
if (a) {
|
||||||
|
if (const int remainder = rc.size() % 4)
|
||||||
|
rc.prepend(QString(4 - remainder, QLatin1Char('0')));
|
||||||
|
const QChar colon = QLatin1Char(':');
|
||||||
|
switch (rc.size()) {
|
||||||
|
case 16:
|
||||||
|
rc.insert(12, colon);
|
||||||
|
case 12:
|
||||||
|
rc.insert(8, colon);
|
||||||
|
case 8:
|
||||||
|
rc.insert(4, colon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return QLatin1String("0x") + rc;
|
||||||
|
}
|
||||||
|
|
||||||
/* getUninitializedVariables(): Get variables that are not initialized
|
/* getUninitializedVariables(): Get variables that are not initialized
|
||||||
* at a certain line of a function from the code model to be able to
|
* at a certain line of a function from the code model to be able to
|
||||||
* indicate them as not in scope in the locals view.
|
* indicate them as not in scope in the locals view.
|
||||||
|
@@ -98,6 +98,8 @@ bool isIntOrFloatType(const QByteArray &type);
|
|||||||
bool isIntType(const QByteArray &type);
|
bool isIntType(const QByteArray &type);
|
||||||
bool isSymbianIntType(const QByteArray &type);
|
bool isSymbianIntType(const QByteArray &type);
|
||||||
|
|
||||||
|
QString formatToolTipAddress(quint64 a);
|
||||||
|
|
||||||
QString quoteUnprintableLatin1(const QByteArray &ba);
|
QString quoteUnprintableLatin1(const QByteArray &ba);
|
||||||
|
|
||||||
// Editor tooltip support
|
// Editor tooltip support
|
||||||
|
Reference in New Issue
Block a user