Commit 6e22eda3 authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 8ab578b1 99becbe1
......@@ -32,7 +32,7 @@
// this relies on contents copied from qobject_p.h
#define PRIVATE_OBJECT_ALLOWED 1
#ifdef HAS_QOBJECT_P_H
#ifdef HAS_QOBJECT_P_H // Detected by qmake
# include <QtCore/private/qobject_p.h>
#endif
#include <QtCore/QDateTime>
......@@ -149,7 +149,7 @@ int qtGhVersion = QT_VERSION;
# define NSY ""
#endif
#if PRIVATE_OBJECT_ALLOWED && !HAS_QOBJECT_P_H
#if PRIVATE_OBJECT_ALLOWED && !defined(HAS_QOBJECT_P_H)
#if defined(QT_BEGIN_NAMESPACE)
QT_BEGIN_NAMESPACE
......@@ -292,8 +292,8 @@ static bool startsWith(const char *s, const char *t)
// On Windows, try to be less crash-prone by checking memory using WinAPI
#ifdef Q_OS_WIN
# define qCheckAccess(d) if (IsBadReadPtr(d, 1)) return; do { qProvokeSegFaultHelper = *(char*)d; } while (0)
# define qCheckPointer(d) if (d && IsBadReadPtr(d, 1)) return; do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
# define qCheckAccess(d) do { if (IsBadReadPtr(d, 1)) return; qProvokeSegFaultHelper = *(char*)d; } while (0)
# define qCheckPointer(d) do { if (d && IsBadReadPtr(d, 1)) return; if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
#else
# define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0)
# define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
......@@ -2252,7 +2252,14 @@ static void qDumpQWeakPointer(QDumper &d)
static void qDumpStdList(QDumper &d)
{
const std::list<int> &list = *reinterpret_cast<const std::list<int> *>(d.data);
const void *p = d.data;
#ifdef Q_CC_MSVC
const int size = static_cast<int>(list.size());
if (size < 0)
return;
if (size)
qCheckAccess(list.begin().operator ->());
#else
const void *p = d.data;
qCheckAccess(p);
p = deref(p);
qCheckAccess(p);
......@@ -2264,7 +2271,7 @@ static void qDumpStdList(QDumper &d)
qCheckAccess(p);
p = deref(addOffset(p, sizeof(void*)));
qCheckAccess(p);
#endif
int nn = 0;
std::list<int>::const_iterator it = list.begin();
for (; nn < 101 && it != list.end(); ++nn, ++it)
......@@ -2447,7 +2454,7 @@ static void qDumpStdWString(QDumper &d)
}
static void qDumpStdVector(QDumper &d)
{
{
// Correct type would be something like:
// std::_Vector_base<int,std::allocator<int, std::allocator<int> >>::_Vector_impl
struct VectorImpl {
......@@ -2455,8 +2462,13 @@ static void qDumpStdVector(QDumper &d)
char *finish;
char *end_of_storage;
};
#ifdef Q_CC_MSVC
// Pointers are at end of the structure
const char * vcp = static_cast<const char *>(d.data);
const VectorImpl *v = reinterpret_cast<const VectorImpl *>(vcp + sizeof(std::vector<int>) - sizeof(VectorImpl));
#else
const VectorImpl *v = static_cast<const VectorImpl *>(d.data);
#endif
// Try to provoke segfaults early to prevent the frontend
// from asking for unavailable child details
int nn = (v->finish - v->start) / d.extraInt[0];
......
......@@ -30,11 +30,11 @@
#include <QtCore/QStringList>
#include <QtCore/QVector>
#include <QtCore/QTimer>
#include <QtCore/private/qobject_p.h>
#include <string>
#include <list>
#include <vector>
#include <set>
#include <stdio.h>
#include <string.h>
......@@ -204,19 +204,36 @@ static int dumpStdStringVector()
return 0;
}
static int dumpStdIntSet()
{
std::set<int> test;
test.insert(1);
test.insert(2);
prepareInBuffer("std::set", "local.intset", "local.intset", "int");
qDumpObjectData440(2, 42, &test, 1, sizeof(int), sizeof(std::list<int>::allocator_type), 0, 0);
fputs(qDumpOutBuffer, stdout);
fputc('\n', stdout);
return 0;
}
static int dumpStdStringSet()
{
std::set<std::string> test;
test.insert("item1");
test.insert("item2");
prepareInBuffer("std::set", "local.stringset", "local.stringset", "std::string");
qDumpObjectData440(2, 42, &test, 1, sizeof(std::string), sizeof(std::list<int>::allocator_type), 0, 0);
fputs(qDumpOutBuffer, stdout);
fputc('\n', stdout);
return 0;
}
static int dumpQObject()
{
// Requires the childOffset to be know, but that is not critical
QTimer t;
QObjectPrivate *tp = reinterpret_cast<QObjectPrivate *>(&t);
#ifdef KNOWS_OFFSET
const int childOffset = (char*)&tp->children - (char*)tp;
#else
const int childOffset = 0;
#endif
printf("Qt version %s Child offset: %d\n", QT_VERSION_STR, childOffset);
prepareInBuffer("QObject", "local.qobject", "local.qobject", "");
qDumpObjectData440(2, 42, &t, 1, childOffset, 0, 0, 0);
qDumpObjectData440(2, 42, &t, 1, 0, 0, 0, 0);
fputs(qDumpOutBuffer, stdout);
fputc('\n', stdout);
return 0;
......@@ -256,6 +273,10 @@ int main(int argc, char *argv[])
dumpStdIntVector();
if (!qstrcmp(arg, "vector<string>"))
dumpStdStringVector();
if (!qstrcmp(arg, "set<int>"))
dumpStdIntSet();
if (!qstrcmp(arg, "set<string>"))
dumpStdStringSet();
if (!qstrcmp(arg, "QObject"))
dumpQObject();
}
......
......@@ -9,8 +9,8 @@ defineReplace(prependAll) {
return($$result)
}
LUPDATE = $$targetPath($$[QT_INSTALL_PREFIX]/bin/lupdate) -locations relative -no-ui-lines
LRELEASE = $$targetPath($$[QT_INSTALL_PREFIX]/bin/lrelease)
LUPDATE = $$targetPath($$[QT_INSTALL_BINS]/lupdate) -locations relative -no-ui-lines
LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
TS_FILES = $$prependAll(TRANSLATIONS, $$PWD/qtcreator_,.ts)
......
......@@ -1186,14 +1186,6 @@ bool CdbDebugEnginePrivate::attemptBreakpointSynchronization(QString *errorMessa
errorMessage);
}
void CdbDebugEngine::loadSessionData()
{
}
void CdbDebugEngine::saveSessionData()
{
}
void CdbDebugEngine::reloadDisassembler()
{
enum { ContextLines = 40 };
......
......@@ -85,9 +85,6 @@ public:
virtual void attemptBreakpointSynchronization();
virtual void loadSessionData();
virtual void saveSessionData();
virtual void reloadDisassembler();
virtual void reloadModules();
......@@ -97,6 +94,7 @@ public:
virtual void reloadRegisters();
virtual void reloadSourceFiles();
virtual void reloadFullStack() {}
protected:
void timerEvent(QTimerEvent*);
......
......@@ -206,6 +206,10 @@ void DebuggerManager::init()
stackView->setModel(m_stackHandler->stackModel());
connect(stackView, SIGNAL(frameActivated(int)),
this, SLOT(activateFrame(int)));
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
// Threads
m_threadsHandler = new ThreadsHandler;
......@@ -273,9 +277,8 @@ void DebuggerManager::init()
m_registerHandler = new RegisterHandler;
registerView->setModel(m_registerHandler->model());
m_watchHandler = new WatchHandler;
// Locals
m_watchHandler = new WatchHandler;
QTreeView *localsView = qobject_cast<QTreeView *>(m_localsWindow);
localsView->setModel(m_watchHandler->model());
......@@ -427,7 +430,7 @@ QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(const QStringList
const bool cdbDisabled = arguments.contains(_("-disable-cdb"));
winEngine = createWinEngine(this, cdbDisabled, &rc);
scriptEngine = createScriptEngine(this, &rc);
setDebuggerType(GdbDebugger);
setDebuggerType(NoDebugger);
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << gdbEngine << winEngine << scriptEngine << rc.size();
return rc;
......@@ -445,6 +448,8 @@ void DebuggerManager::setDebuggerType(DebuggerType type)
case WinDebugger:
m_engine = winEngine;
break;
case NoDebugger:
m_engine = 0;
}
}
......@@ -697,7 +702,6 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << fileName << lineNumber;
QTC_ASSERT(m_engine, return);
QTC_ASSERT(m_breakHandler, return);
if (status() != DebuggerInferiorRunning
&& status() != DebuggerInferiorStopped
......@@ -712,7 +716,8 @@ void DebuggerManager::toggleBreakpoint(const QString &fileName, int lineNumber)
m_breakHandler->setBreakpoint(fileName, lineNumber);
else
m_breakHandler->removeBreakpoint(index);
m_engine->attemptBreakpointSynchronization();
attemptBreakpointSynchronization();
}
void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineNumber)
......@@ -720,7 +725,6 @@ void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineN
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << fileName << lineNumber;
QTC_ASSERT(m_engine, return);
QTC_ASSERT(m_breakHandler, return);
if (status() != DebuggerInferiorRunning
&& status() != DebuggerInferiorStopped
......@@ -731,24 +735,26 @@ void DebuggerManager::toggleBreakpointEnabled(const QString &fileName, int lineN
}
m_breakHandler->toggleBreakpointEnabled(fileName, lineNumber);
m_engine->attemptBreakpointSynchronization();
attemptBreakpointSynchronization();
}
void DebuggerManager::attemptBreakpointSynchronization()
{
m_engine->attemptBreakpointSynchronization();
if (m_engine)
m_engine->attemptBreakpointSynchronization();
}
void DebuggerManager::setToolTipExpression(const QPoint &pos, const QString &exp)
{
QTC_ASSERT(m_engine, return);
m_engine->setToolTipExpression(pos, exp);
if (m_engine)
m_engine->setToolTipExpression(pos, exp);
}
void DebuggerManager::updateWatchModel()
{
QTC_ASSERT(m_engine, return);
m_engine->updateWatchModel();
if (m_engine)
m_engine->updateWatchModel();
}
QVariant DebuggerManager::sessionValue(const QString &name)
......@@ -946,9 +952,9 @@ void DebuggerManager::startNewDebugger(DebuggerRunControl *runControl)
DebuggerType type;
QString errorMessage;
const bool hasDebugger = startMode() == AttachExternal ?
determineDebuggerType(m_attachedPID, &type, &errorMessage) :
determineDebuggerType(m_executable, &type, &errorMessage);
const bool hasDebugger = startMode() == AttachExternal
? determineDebuggerType(m_attachedPID, &type, &errorMessage)
: determineDebuggerType(m_executable, &type, &errorMessage);
if (!hasDebugger) {
QMessageBox::warning(mainWindow(), tr("Warning"),
tr("Cannot debug '%1': %2").arg(m_executable, errorMessage));
......@@ -1117,18 +1123,14 @@ void DebuggerManager::aboutToSaveSession()
void DebuggerManager::loadSessionData()
{
QTC_ASSERT(m_engine, return);
m_breakHandler->loadSessionData();
m_watchHandler->loadSessionData();
m_engine->loadSessionData();
}
void DebuggerManager::saveSessionData()
{
QTC_ASSERT(m_engine, return);
m_breakHandler->saveSessionData();
m_watchHandler->saveSessionData();
m_engine->saveSessionData();
}
void DebuggerManager::dumpLog()
......@@ -1164,17 +1166,15 @@ void DebuggerManager::setBreakpoint(const QString &fileName, int lineNumber)
qDebug() << Q_FUNC_INFO << fileName << lineNumber;
QTC_ASSERT(m_breakHandler, return);
QTC_ASSERT(m_engine, return);
m_breakHandler->setBreakpoint(fileName, lineNumber);
m_engine->attemptBreakpointSynchronization();
attemptBreakpointSynchronization();
}
void DebuggerManager::breakByFunction(const QString &functionName)
{
QTC_ASSERT(m_breakHandler, return);
QTC_ASSERT(m_engine, return);
m_breakHandler->breakByFunction(functionName);
m_engine->attemptBreakpointSynchronization();
attemptBreakpointSynchronization();
}
void DebuggerManager::breakByFunction()
......@@ -1300,14 +1300,16 @@ void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
void DebuggerManager::continueExec()
{
m_engine->continueInferior();
if (m_engine)
m_engine->continueInferior();
}
void DebuggerManager::interruptDebuggingRequest()
{
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << status();
QTC_ASSERT(m_engine, return);
if (!m_engine)
return;
bool interruptIsExit = (status() != DebuggerInferiorRunning);
if (interruptIsExit)
exitDebugger();
......@@ -1319,11 +1321,10 @@ void DebuggerManager::interruptDebuggingRequest()
void DebuggerManager::runToLineExec()
{
QTC_ASSERT(m_engine, return);
QString fileName;
int lineNumber = -1;
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
if (!fileName.isEmpty()) {
if (m_engine && !fileName.isEmpty()) {
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << fileName << lineNumber;
m_engine->runToLineExec(fileName, lineNumber);
......@@ -1360,7 +1361,7 @@ void DebuggerManager::runToFunctionExec()
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << functionName;
if (!functionName.isEmpty())
if (m_engine && !functionName.isEmpty())
m_engine->runToFunctionExec(functionName);
}
......@@ -1369,7 +1370,7 @@ void DebuggerManager::jumpToLineExec()
QString fileName;
int lineNumber = -1;
emit currentTextEditorRequested(&fileName, &lineNumber, 0);
if (!fileName.isEmpty()) {
if (m_engine && !fileName.isEmpty()) {
if (Debugger::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO << fileName << lineNumber;
m_engine->jumpToLineExec(fileName, lineNumber);
......@@ -1404,10 +1405,8 @@ void DebuggerManager::fileOpen(const QString &fileName)
void DebuggerManager::reloadDisassembler()
{
QTC_ASSERT(m_engine, return);
if (!m_disassemblerDock || !m_disassemblerDock->isVisible())
return;
m_engine->reloadDisassembler();
if (m_engine && m_disassemblerDock && m_disassemblerDock->isVisible())
m_engine->reloadDisassembler();
}
void DebuggerManager::disassemblerDockToggled(bool on)
......@@ -1425,9 +1424,8 @@ void DebuggerManager::disassemblerDockToggled(bool on)
void DebuggerManager::reloadSourceFiles()
{
if (!m_sourceFilesDock || !m_sourceFilesDock->isVisible())
return;
m_engine->reloadSourceFiles();
if (m_engine && m_sourceFilesDock && m_sourceFilesDock->isVisible())
m_engine->reloadSourceFiles();
}
void DebuggerManager::sourceFilesDockToggled(bool on)
......@@ -1445,9 +1443,8 @@ void DebuggerManager::sourceFilesDockToggled(bool on)
void DebuggerManager::reloadModules()
{
if (!m_modulesDock || !m_modulesDock->isVisible())
return;
m_engine->reloadModules();
if (m_engine && m_modulesDock && m_modulesDock->isVisible())
m_engine->reloadModules();
}
void DebuggerManager::modulesDockToggled(bool on)
......@@ -1490,9 +1487,8 @@ void DebuggerManager::registerDockToggled(bool on)
void DebuggerManager::reloadRegisters()
{
if (!m_registerDock || !m_registerDock->isVisible())
return;
m_engine->reloadRegisters();
if (m_engine && m_registerDock && m_registerDock->isVisible())
m_engine->reloadRegisters();
}
//////////////////////////////////////////////////////////////////////
......@@ -1546,6 +1542,12 @@ DebuggerStartMode DebuggerManager::startMode() const
return m_runControl->startMode();
}
void DebuggerManager::reloadFullStack()
{
if (m_engine)
m_engine->reloadFullStack();
}
//////////////////////////////////////////////////////////////////////
//
......
......@@ -202,7 +202,7 @@ public:
QMainWindow *mainWindow() const { return m_mainWindow; }
QLabel *statusLabel() const { return m_statusLabel; }
enum DebuggerType { GdbDebugger, ScriptDebugger, WinDebugger };
enum DebuggerType { NoDebugger, GdbDebugger, ScriptDebugger, WinDebugger };
public slots:
void startNewDebugger(DebuggerRunControl *runControl);
......@@ -279,6 +279,7 @@ private slots:
void setStatus(int status);
void clearStatusMessage();
void attemptBreakpointSynchronization();
void reloadFullStack();
private:
//
......
......@@ -368,6 +368,7 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
mdebug->addAction(cmd);
#endif
#endif
updateState();
return w;
}
......@@ -376,9 +377,10 @@ void DebuggingHelperOptionPage::updateState()
{
m_ui.checkBoxUseCustomDebuggingHelperLocation->setEnabled(
m_ui.checkBoxUseDebuggingHelpers->isChecked());
m_ui.dumperLocationChooser->setEnabled(
m_ui.checkBoxUseDebuggingHelpers->isChecked()
&& m_ui.checkBoxUseCustomDebuggingHelperLocation->isChecked());
bool locationEnabled = m_ui.checkBoxUseDebuggingHelpers->isChecked()
&& m_ui.checkBoxUseCustomDebuggingHelperLocation->isChecked();
m_ui.dumperLocationChooser->setEnabled(locationEnabled);
m_ui.dumperLocationLabel->setEnabled(locationEnabled);
}
} // namespace Internal
......
......@@ -73,7 +73,7 @@
</spacer>
</item>
<item>
<widget class="QLabel" name="labelDebuggingHelperLocation">
<widget class="QLabel" name="dumperLocationLabel">
<property name="text">
<string>Location: </string>
</property>
......
......@@ -158,17 +158,13 @@ void GdbEngine::initializeConnections()
q, SLOT(showApplicationOutput(QString)),
Qt::QueuedConnection);
// FIXME: These trigger even if the engine is not active
connect(theDebuggerAction(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setUseDebuggingHelpers(QVariant)));
connect(theDebuggerAction(DebugDebuggingHelpers), SIGNAL(valueChanged(QVariant)),
this, SLOT(setDebugDebuggingHelpers(QVariant)));
connect(theDebuggerAction(RecheckDebuggingHelpers), SIGNAL(triggered()),
this, SLOT(recheckDebuggingHelperAvailability()));
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
}
void GdbEngine::initializeVariables()
......@@ -532,12 +528,18 @@ void GdbEngine::readGdbStandardOutput()
void GdbEngine::interruptInferior()
{
qq->notifyInferiorStopRequested();
if (m_gdbProc.state() == QProcess::NotRunning) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR WITHOUT RUNNING GDB"));
qq->notifyInferiorExited();
return;
}
if (q->startMode() == AttachRemote) {
execCommand(_("-exec-interrupt"));
return;
}
if (q->m_attachedPID <= 0) {
debugMessage(_("TRYING TO INTERRUPT INFERIOR BEFORE PID WAS OBTAINED"));
return;
......@@ -1021,8 +1023,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
return;
}
//tryLoadDebuggingHelpers();
// jump over well-known frames
static int stepCounter = 0;
if (theDebuggerBoolSetting(SkipKnownFrames)) {
......@@ -1420,6 +1420,7 @@ bool GdbEngine::startDebugger()
//execCommand(_("set print pretty on"));
//execCommand(_("set confirm off"));
//execCommand(_("set pagination off"));
execCommand(_("set print inferior-events 1"));
execCommand(_("set breakpoint pending on"));
execCommand(_("set print elements 10000"));
execCommand(_("-data-list-register-names"), CB(handleRegisterListNames));
......@@ -1602,8 +1603,10 @@ void GdbEngine::handleTargetAsync(const GdbResultRecord &record, const QVariant
if (record.resultClass == GdbResultDone) {
//execCommand(_("info target"), handleStart);
qq->notifyInferiorRunningRequested();
execCommand(_("target remote %1").arg(q->m_remoteChannel));
execCommand(_("-exec-continue"), CB(handleExecRun));
execCommand(_("target remote %1").arg(q->m_remoteChannel),
CB(handleAttach));
//execCommand(_("-exec-continue"), CB(handleExecRun));
handleAqcuiredInferior();
} else if (record.resultClass == GdbResultError) {
// a typical response on "old" gdb is:
// &"set target-async on\n"
......
......@@ -112,9 +112,6 @@ private:
Q_SLOT void attemptBreakpointSynchronization();
void loadSessionData() {}
void saveSessionData() {}
void assignValueInDebugger(const QString &expr, const QString &value);
void executeDebuggerCommand(const QString & command);
......
......@@ -74,9 +74,6 @@ public:
virtual void attemptBreakpointSynchronization() = 0;
virtual void loadSessionData() = 0;
virtual void saveSessionData() = 0;
virtual void reloadDisassembler() = 0;
virtual void reloadModules() = 0;
......@@ -87,6 +84,7 @@ public:
virtual void reloadRegisters() = 0;
virtual void reloadSourceFiles() = 0;
virtual void reloadFullStack() = 0;
};
} // namespace Internal
......
......@@ -94,9 +94,6 @@ private:
void attemptBreakpointSynchronization();
void loadSessionData() {}
void saveSessionData() {}
void assignValueInDebugger(const QString &expr, const QString &value);
void executeDebuggerCommand(const QString & command);
......@@ -107,6 +104,7 @@ private:
void reloadModules();
void reloadRegisters() {}
void reloadSourceFiles() {}
void reloadFullStack() {}
bool supportsThreads() const { return true; }
void maybeBreakNow(bool byFunction);
......