diff options
author | con <qtc-committer@nokia.com> | 2009-11-09 11:36:19 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-11-09 11:36:19 +0100 |
commit | 36d0d8500e7daf8d8da29bebf6b5527f483b44ab (patch) | |
tree | cd3d0b13139fd0def1b733254e1b7b62f614cd72 /src | |
parent | 040ab7a93fbff6d387e895304f8c5aaa3d6e22f0 (diff) | |
parent | a253a6998055b33fedb72943101f94342cfb55a7 (diff) | |
download | qt-creator-36d0d8500e7daf8d8da29bebf6b5527f483b44ab.tar.gz |
Merge commit 'origin/1.3'
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/cpptools/cppcodecompletion.cpp | 32 | ||||
-rw-r--r-- | src/plugins/cpptools/cppcodecompletion.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/gdb/gdbengine.cpp | 5 | ||||
-rw-r--r-- | src/tools/qtcdebugger/main.cpp | 50 |
4 files changed, 60 insertions, 29 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 9a895bb97d..bb2d26780d 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -874,7 +874,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) if (! resolvedTypes.isEmpty()) { if (m_completionOperator == T_LPAREN && - completeConstructorOrFunction(resolvedTypes, context, endOfExpression)) { + completeConstructorOrFunction(resolvedTypes, context, endOfExpression, false)) { return m_startPosition; } else if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) && @@ -913,7 +913,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) // If it's a class, add completions for the constructors foreach (const TypeOfExpression::Result &result, results) { if (result.first->isClassType()) { - if (completeConstructorOrFunction(results, context, endOfExpression)) + if (completeConstructorOrFunction(results, context, endOfExpression, true)) return m_startPosition; break; } @@ -927,7 +927,7 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpression::Result> &results, const LookupContext &context, - int endOfExpression) + int endOfExpression, bool toolTipOnly) { QList<Function *> functions; @@ -1016,15 +1016,17 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpressi } } - if (! functions.isEmpty()) { - // There are two options: - // 1. If this is a function call, we want to pop up a tooltip that shows the user - // the possible overloads with their argument types and names. - // 2. If this is a function definition, we want to offer autocompletion of - // the function signature. + // There are two different kinds of completion we want to provide: + // 1. If this is a function call, we want to pop up a tooltip that shows the user + // the possible overloads with their argument types and names. + // 2. If this is a function definition, we want to offer autocompletion of + // the function signature. - // Here we evaluate a first criterion: function definitions will only - // happen in class or namespace scope. + // check if function signature autocompletion is appropriate + if (! functions.isEmpty() && ! toolTipOnly) { + + // function definitions will only happen in class or namespace scope, + // so get the current location's enclosing scope. // get current line and column TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(m_editor->widget()); @@ -1046,16 +1048,16 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpressi unsigned endLine, endColumn; context.thisDocument()->translationUnit()->getPosition(sc->owner()->endOffset(), &endLine, &endColumn); - if (startLine <= line && line <= endLine) + if (startLine <= line && line <= endLine) { if ((startLine != line || startColumn <= column) && (endLine != line || column <= endColumn)) break; + } sc = sc->enclosingScope(); } - if (sc && (sc->isClassScope() || sc->isNamespaceScope())) - { + if (sc && (sc->isClassScope() || sc->isNamespaceScope())) { // It may still be a function call. If the whole line parses as a function // declaration, we should be certain that it isn't. bool autocompleteSignature = false; @@ -1094,7 +1096,9 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<TypeOfExpressi return true; } } + } + if (! functions.empty()) { // set up function call tooltip // Recreate if necessary diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h index 7f710d0e32..cbf9322059 100644 --- a/src/plugins/cpptools/cppcodecompletion.h +++ b/src/plugins/cpptools/cppcodecompletion.h @@ -118,7 +118,7 @@ private: bool completeConstructorOrFunction(const QList<CPlusPlus::TypeOfExpression::Result> &, const CPlusPlus::LookupContext &, - int endOfExpression); + int endOfExpression, bool toolTipOnly); bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &, const CPlusPlus::LookupContext &context); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 72fc1f30ca..b3328cb6a1 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1270,6 +1270,11 @@ void GdbEngine::handleStop1(const GdbMi &data) if (m_sourcesListOutdated) reloadSourceFilesInternal(); // This needs to be done before fullName() may need it + // Older gdb versions do not produce "library loaded" messages + // so the breakpoint update is not triggered. + if (m_gdbVersion < 70000 && !m_isMacGdb) + postCommand(_("-break-list"), CB(handleBreakList)); + QByteArray reason = data.findChild("reason").data(); if (reason == "breakpoint-hit") { showStatusMessage(tr("Stopped at breakpoint.")); diff --git a/src/tools/qtcdebugger/main.cpp b/src/tools/qtcdebugger/main.cpp index 36a276a700..8be595a0ce 100644 --- a/src/tools/qtcdebugger/main.cpp +++ b/src/tools/qtcdebugger/main.cpp @@ -363,19 +363,25 @@ bool startCreatorAsDebugger(QString *errorMessage) return true; } -bool startDefaultDebugger(QString *errorMessage) +bool readDefaultDebugger(QString *defaultDebugger, + QString *errorMessage) { - // Read out default value + bool success = false; HKEY handle; - if (!openRegistryKey(HKEY_LOCAL_MACHINE, optIsWow ? debuggerWow32RegistryKeyC : debuggerRegistryKeyC, - false, &handle, errorMessage)) - return false; - QString defaultDebugger; - if (!registryReadStringKey(handle, debuggerRegistryDefaultValueNameC, &defaultDebugger, errorMessage)) { + if (openRegistryKey(HKEY_LOCAL_MACHINE, optIsWow ? debuggerWow32RegistryKeyC : debuggerRegistryKeyC, + false, &handle, errorMessage)) { + success = registryReadStringKey(handle, debuggerRegistryDefaultValueNameC, + defaultDebugger, errorMessage); RegCloseKey(handle); - return false; } - RegCloseKey(handle); + return success; +} + +bool startDefaultDebugger(QString *errorMessage) +{ + QString defaultDebugger; + if (!readDefaultDebugger(&defaultDebugger, errorMessage)) + return false; // binary, replace placeholders by pid/event id if (debug) qDebug() << "Default" << defaultDebugger; @@ -401,10 +407,13 @@ bool startDefaultDebugger(QString *errorMessage) bool chooseDebugger(QString *errorMessage) { + QString defaultDebugger; const QString msg = QString::fromLatin1("The application \"%1\" (process id %2) crashed. Would you like to debug it?").arg(getProcessBaseName(argProcessId)).arg(argProcessId); QMessageBox msgBox(QMessageBox::Information, QLatin1String(titleC), msg, QMessageBox::Cancel); QPushButton *creatorButton = msgBox.addButton(QLatin1String("Debug with Qt Creator"), QMessageBox::AcceptRole); QPushButton *defaultButton = msgBox.addButton(QLatin1String("Debug with default debugger"), QMessageBox::AcceptRole); + defaultButton->setEnabled(readDefaultDebugger(&defaultDebugger, errorMessage) + && !defaultDebugger.isEmpty()); msgBox.exec(); if (msgBox.clickedButton() == creatorButton) { // Just in case, default to standard @@ -444,12 +453,12 @@ static bool registerDebuggerKey(const WCHAR *key, do { if (!openRegistryKey(HKEY_LOCAL_MACHINE, key, true, &handle, errorMessage)) break; + // Save old key, which might be missing QString oldDebugger; - if (!registryReadStringKey(handle, debuggerRegistryValueNameC, &oldDebugger, errorMessage)) - break; + registryReadStringKey(handle, debuggerRegistryValueNameC, &oldDebugger, errorMessage); if (oldDebugger.contains(QLatin1String(applicationFileC), Qt::CaseInsensitive)) { *errorMessage = QLatin1String("The program is already registered as post mortem debugger."); - return false; + break; } if (!registryWriteStringKey(handle, debuggerRegistryDefaultValueNameC, oldDebugger, errorMessage)) break; @@ -483,11 +492,24 @@ static bool unregisterDebuggerKey(const WCHAR *key, QString *errorMessage) do { if (!openRegistryKey(HKEY_LOCAL_MACHINE, key, true, &handle, errorMessage)) break; + QString debugger; + registryReadStringKey(handle, debuggerRegistryValueNameC, &debugger, errorMessage); + if (!(debugger.isEmpty() + || debugger.contains(QLatin1String(applicationFileC), Qt::CaseInsensitive))) { + *errorMessage = QLatin1String("The program is not registered as post mortem debugger."); + break; + } QString oldDebugger; if (!registryReadStringKey(handle, debuggerRegistryDefaultValueNameC, &oldDebugger, errorMessage)) break; - if (!registryWriteStringKey(handle, debuggerRegistryValueNameC, oldDebugger, errorMessage)) - break; + // Re-register old debugger or delete key if it was empty. + if (oldDebugger.isEmpty()) { + if (!registryDeleteValue(handle, debuggerRegistryValueNameC, errorMessage)) + break; + } else { + if (!registryWriteStringKey(handle, debuggerRegistryValueNameC, oldDebugger, errorMessage)) + break; + } if (!registryDeleteValue(handle, debuggerRegistryDefaultValueNameC, errorMessage)) break; success = true; |