make tooltip use while debugging configurable

This commit is contained in:
hjk
2008-12-08 19:26:00 +01:00
parent 502bc0df63
commit d3a97147dd
4 changed files with 38 additions and 23 deletions

View File

@@ -352,6 +352,15 @@ void DebuggerManager::init()
m_useFastStartAction->setCheckable(true); m_useFastStartAction->setCheckable(true);
m_useFastStartAction->setChecked(true); m_useFastStartAction->setChecked(true);
m_useToolTipsAction = new QAction(this);
m_useToolTipsAction->setText(tr("Use Tooltips While Debugging"));
m_useToolTipsAction->setToolTip(tr("Checking this will make enable "
"tooltips for variable values during debugging. Since this can slow "
"down debugging and does not provide reliable information as it does "
"not use scope information, it is switched off by default."));
m_useToolTipsAction->setCheckable(true);
m_useToolTipsAction->setChecked(false);
// FIXME // FIXME
m_useFastStartAction->setChecked(false); m_useFastStartAction->setChecked(false);
m_useFastStartAction->setEnabled(false); m_useFastStartAction->setEnabled(false);
@@ -943,6 +952,8 @@ void DebuggerManager::loadSessionData()
QVariant value; QVariant value;
querySessionValue(QLatin1String("UseFastStart"), &value); querySessionValue(QLatin1String("UseFastStart"), &value);
m_useFastStartAction->setChecked(value.toBool()); m_useFastStartAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseToolTips"), &value);
m_useToolTipsAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseCustomDumpers"), &value); querySessionValue(QLatin1String("UseCustomDumpers"), &value);
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool()); m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
querySessionValue(QLatin1String("SkipKnownFrames"), &value); querySessionValue(QLatin1String("SkipKnownFrames"), &value);
@@ -956,6 +967,8 @@ void DebuggerManager::saveSessionData()
setSessionValue(QLatin1String("UseFastStart"), setSessionValue(QLatin1String("UseFastStart"),
m_useFastStartAction->isChecked()); m_useFastStartAction->isChecked());
setSessionValue(QLatin1String("UseToolTips"),
m_useToolTipsAction->isChecked());
setSessionValue(QLatin1String("UseCustomDumpers"), setSessionValue(QLatin1String("UseCustomDumpers"),
m_useCustomDumpersAction->isChecked()); m_useCustomDumpersAction->isChecked());
setSessionValue(QLatin1String("SkipKnownFrames"), setSessionValue(QLatin1String("SkipKnownFrames"),

View File

@@ -308,6 +308,7 @@ private:
ThreadsHandler *threadsHandler() { return m_threadsHandler; } ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; } WatchHandler *watchHandler() { return m_watchHandler; }
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; } QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
QAction *useToolTipsAction() const { return m_useToolTipsAction; }
QAction *debugDumpersAction() const { return m_debugDumpersAction; } QAction *debugDumpersAction() const { return m_debugDumpersAction; }
bool skipKnownFrames() const; bool skipKnownFrames() const;
bool debugDumpers() const; bool debugDumpers() const;
@@ -431,6 +432,7 @@ private:
QAction *m_debugDumpersAction; QAction *m_debugDumpersAction;
QAction *m_useCustomDumpersAction; QAction *m_useCustomDumpersAction;
QAction *m_useFastStartAction; QAction *m_useFastStartAction;
QAction *m_useToolTipsAction;
QAction *m_dumpLogAction; QAction *m_dumpLogAction;
QWidget *m_breakWindow; QWidget *m_breakWindow;

View File

@@ -91,6 +91,7 @@ const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers";
const char * const ADD_TO_WATCH = "Debugger.AddToWatch"; const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers"; const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
const char * const USE_FAST_START = "Debugger.UseFastStart"; const char * const USE_FAST_START = "Debugger.UseFastStart";
const char * const USE_TOOL_TIPS = "Debugger.UseToolTips";
const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames"; const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames";
const char * const DUMP_LOG = "Debugger.DumpLog"; const char * const DUMP_LOG = "Debugger.DumpLog";
@@ -374,13 +375,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
Constants::USE_FAST_START, globalcontext); Constants::USE_FAST_START, globalcontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
cmd = actionManager->registerAction(m_manager->m_useToolTipsAction,
Constants::USE_TOOL_TIPS, globalcontext);
mdebug->addAction(cmd);
#ifdef QT_DEBUG
cmd = actionManager->registerAction(m_manager->m_dumpLogAction, cmd = actionManager->registerAction(m_manager->m_dumpLogAction,
Constants::DUMP_LOG, globalcontext); Constants::DUMP_LOG, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L"))); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
mdebug->addAction(cmd); mdebug->addAction(cmd);
#ifdef QT_DEBUG
cmd = actionManager->registerAction(m_manager->m_debugDumpersAction, cmd = actionManager->registerAction(m_manager->m_debugDumpersAction,
Constants::DEBUG_DUMPERS, debuggercontext); Constants::DEBUG_DUMPERS, debuggercontext);
mdebug->addAction(cmd); mdebug->addAction(cmd);
@@ -549,6 +554,9 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor, void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
const QPoint &point, int pos) const QPoint &point, int pos)
{ {
if (!m_manager->useToolTipsAction()->isChecked())
return;
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget()); QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
if (!plaintext) if (!plaintext)
return; return;

View File

@@ -278,25 +278,8 @@ void GdbEngine::init()
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q, connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
SLOT(exitDebugger())); SLOT(exitDebugger()));
// Custom dumpers
//m_dumperServerConnection = 0;
//m_dumperServer = new DumperServer(this);
//QString name = "gdb-" +
// QDateTime::currentDateTime().toString("yyyy_MM_dd-hh_mm_ss_zzz");
//m_dumperServer->listen(name);
//connect(m_dumperServer, SIGNAL(newConnection()),
// this, SLOT(acceptConnection()));
//if (!m_dumperServer->isListening()) {
// QMessageBox::critical(q->mainWindow(), tr("Dumper Server Setup Failed"),
// tr("Unable to create server listening for data: %1.\n"
// "Server name: %2").arg(m_dumperServer->errorString(), name),
// QMessageBox::Retry | QMessageBox::Cancel);
// }
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)), connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setDebugDumpers(bool))); this, SLOT(setDebugDumpers(bool)));
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)), connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setCustomDumpersWanted(bool))); this, SLOT(setCustomDumpersWanted(bool)));
@@ -442,8 +425,7 @@ void GdbEngine::handleResponse()
break; break;
} }
if (token == -1 && *from != '&' && *from != '~' && *from != '*' if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
&& *from != '=') {
// FIXME: On Linux the application's std::out is merged in here. // FIXME: On Linux the application's std::out is merged in here.
// High risk of falsely interpreting this as MI output. // High risk of falsely interpreting this as MI output.
// We assume that we _always_ use tokens, so not finding a token // We assume that we _always_ use tokens, so not finding a token
@@ -452,7 +434,7 @@ void GdbEngine::handleResponse()
while (from != to && *from != '\n') while (from != to && *from != '\n')
s += *from++; s += *from++;
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT"; //qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
s += '\n'; //s += '\n';
m_inbuffer = QByteArray(from, to - from); m_inbuffer = QByteArray(from, to - from);
emit applicationOutputAvailable("app-stdout: ", s); emit applicationOutputAvailable("app-stdout: ", s);
@@ -3660,10 +3642,20 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals)
QHash<QString, int> seen; QHash<QString, int> seen;
foreach (const GdbMi &item, locals) { foreach (const GdbMi &item, locals) {
// Local variables of inlined code are reported as
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
// We do not want these at all. Current hypotheses is that those
// "spurious" locals have _two_ "exp" field. Try to filter them:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
QString name = item.findChild("exp").data(); int numExps = 0;
foreach (const GdbMi &child, item.children())
numExps += int(child.name() == "exp");
if (numExps > 1)
continue;
QString name = item.findChild("exp").data();
#else #else
QString name = item.findChild("name").data(); QString name = item.findChild("name").data();
#endif #endif
int n = seen.value(name); int n = seen.value(name);
if (n) { if (n) {