Commit d3a97147 authored by hjk's avatar hjk

make tooltip use while debugging configurable

parent 502bc0df
......@@ -352,6 +352,15 @@ void DebuggerManager::init()
m_useFastStartAction->setCheckable(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
m_useFastStartAction->setChecked(false);
m_useFastStartAction->setEnabled(false);
......@@ -943,6 +952,8 @@ void DebuggerManager::loadSessionData()
QVariant value;
querySessionValue(QLatin1String("UseFastStart"), &value);
m_useFastStartAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseToolTips"), &value);
m_useToolTipsAction->setChecked(value.toBool());
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
......@@ -956,6 +967,8 @@ void DebuggerManager::saveSessionData()
setSessionValue(QLatin1String("UseFastStart"),
m_useFastStartAction->isChecked());
setSessionValue(QLatin1String("UseToolTips"),
m_useToolTipsAction->isChecked());
setSessionValue(QLatin1String("UseCustomDumpers"),
m_useCustomDumpersAction->isChecked());
setSessionValue(QLatin1String("SkipKnownFrames"),
......
......@@ -308,6 +308,7 @@ private:
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; }
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
QAction *useToolTipsAction() const { return m_useToolTipsAction; }
QAction *debugDumpersAction() const { return m_debugDumpersAction; }
bool skipKnownFrames() const;
bool debugDumpers() const;
......@@ -431,6 +432,7 @@ private:
QAction *m_debugDumpersAction;
QAction *m_useCustomDumpersAction;
QAction *m_useFastStartAction;
QAction *m_useToolTipsAction;
QAction *m_dumpLogAction;
QWidget *m_breakWindow;
......
......@@ -91,6 +91,7 @@ const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers";
const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
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 DUMP_LOG = "Debugger.DumpLog";
......@@ -374,13 +375,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
Constants::USE_FAST_START, globalcontext);
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,
Constants::DUMP_LOG, globalcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
mdebug->addAction(cmd);
#ifdef QT_DEBUG
cmd = actionManager->registerAction(m_manager->m_debugDumpersAction,
Constants::DEBUG_DUMPERS, debuggercontext);
mdebug->addAction(cmd);
......@@ -549,6 +554,9 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
const QPoint &point, int pos)
{
if (!m_manager->useToolTipsAction()->isChecked())
return;
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
if (!plaintext)
return;
......
......@@ -278,25 +278,8 @@ void GdbEngine::init()
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
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)),
this, SLOT(setDebugDumpers(bool)));
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
this, SLOT(setCustomDumpersWanted(bool)));
......@@ -442,8 +425,7 @@ void GdbEngine::handleResponse()
break;
}
if (token == -1 && *from != '&' && *from != '~' && *from != '*'
&& *from != '=') {
if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
// FIXME: On Linux the application's std::out is merged in here.
// High risk of falsely interpreting this as MI output.
// We assume that we _always_ use tokens, so not finding a token
......@@ -452,7 +434,7 @@ void GdbEngine::handleResponse()
while (from != to && *from != '\n')
s += *from++;
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
s += '\n';
//s += '\n';
m_inbuffer = QByteArray(from, to - from);
emit applicationOutputAvailable("app-stdout: ", s);
......@@ -3660,10 +3642,20 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals)
QHash<QString, int> seen;
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
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
QString name = item.findChild("name").data();
QString name = item.findChild("name").data();
#endif
int n = seen.value(name);
if (n) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment