Commit 3d9a53cf authored by hjk's avatar hjk

debugger: replace a few '#ifdef LINUX' by '#if defined(UNIX) && !defined(MAC)

parent af367068
......@@ -164,10 +164,12 @@ DebuggerManager::DebuggerManager()
DebuggerManager::~DebuggerManager()
{
delete gdbEngine;
delete winEngine;
delete scriptEngine;
delete tcfEngine;
#define doDelete(ptr) delete ptr; ptr = 0
doDelete(gdbEngine);
doDelete(winEngine);
doDelete(scriptEngine);
doDelete(tcfEngine);
#undef doDelete
}
void DebuggerManager::init()
......@@ -507,8 +509,8 @@ void DebuggerManager::setSimpleDockWidgetArrangement()
m_mainWindow->tabifyDockWidget(m_watchDock, m_threadsDock);
m_mainWindow->tabifyDockWidget(m_watchDock, m_sourceFilesDock);
// They are rarely used even in ordinary debugging. Hiding them also saves
// cycles since the corresponding information won't be retrieved.
// They following views are rarely used in ordinary debugging. Hiding them
// saves cycles since the corresponding information won't be retrieved.
m_sourceFilesDock->hide();
m_registerDock->hide();
m_disassemblerDock->hide();
......@@ -621,54 +623,35 @@ void DebuggerManager::shutdown()
m_engine->shutdown();
m_engine = 0;
delete scriptEngine;
scriptEngine = 0;
delete gdbEngine;
gdbEngine = 0;
delete winEngine;
winEngine = 0;
#define doDelete(ptr) delete ptr; ptr = 0
doDelete(scriptEngine);
doDelete(gdbEngine);
doDelete(winEngine);
doDelete(tcfEngine);
// Delete these manually before deleting the manager
// (who will delete the models for most views)
delete m_breakWindow;
delete m_disassemblerWindow;
delete m_modulesWindow;
delete m_outputWindow;
delete m_registerWindow;
delete m_stackWindow;
delete m_sourceFilesWindow;
delete m_threadsWindow;
delete m_tooltipWindow;
delete m_watchersWindow;
delete m_localsWindow;
// These widgets are all in some layout which will take care of deletion.
m_breakWindow = 0;
m_disassemblerWindow = 0;
m_modulesWindow = 0;
m_outputWindow = 0;
m_registerWindow = 0;
m_stackWindow = 0;
m_sourceFilesWindow = 0;
m_threadsWindow = 0;
m_tooltipWindow = 0;
m_watchersWindow = 0;
m_localsWindow = 0;
delete m_breakHandler;
delete m_disassemblerHandler;
delete m_threadsHandler;
delete m_modulesHandler;
delete m_registerHandler;
delete m_stackHandler;
delete m_watchHandler;
m_breakHandler = 0;
m_disassemblerHandler = 0;
m_threadsHandler = 0;
m_modulesHandler = 0;
m_registerHandler = 0;
m_stackHandler = 0;
m_watchHandler = 0;
doDelete(m_breakWindow);
doDelete(m_disassemblerWindow);
doDelete(m_modulesWindow);
doDelete(m_outputWindow);
doDelete(m_registerWindow);
doDelete(m_stackWindow);
doDelete(m_sourceFilesWindow);
doDelete(m_threadsWindow);
doDelete(m_tooltipWindow);
doDelete(m_watchersWindow);
doDelete(m_localsWindow);
doDelete(m_breakHandler);
doDelete(m_disassemblerHandler);
doDelete(m_threadsHandler);
doDelete(m_modulesHandler);
doDelete(m_registerHandler);
doDelete(m_stackHandler);
doDelete(m_watchHandler);
//qDebug() << "DEBUGGER_MANAGER SHUTDOWN END";
#undef doDelete
}
BreakpointData *DebuggerManager::findBreakpoint(const QString &fileName, int lineNumber)
......
......@@ -348,8 +348,10 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent)
this, SLOT(updateState()));
m_group.clear();
#ifdef QT_DEBUG
m_group.insert(theDebuggerAction(UseDebuggingHelpers),
m_ui.checkBoxUseDebuggingHelpers);
#endif
m_group.insert(theDebuggerAction(UseCustomDebuggingHelperLocation),
m_ui.checkBoxUseCustomDebuggingHelperLocation);
m_group.insert(theDebuggerAction(CustomDebuggingHelperLocation),
......
......@@ -416,7 +416,7 @@ void GdbEngine::handleResponse(const QByteArray &buff)
QByteArray id = record.findChild("id").data();
q->showStatusMessage(tr("Thread %1 selected.").arg(_(id)));
//"{id="2"}"
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC)
} else if (asyncClass == "shlibs-updated") {
// MAC announces updated libs
} else if (asyncClass == "shlibs-added") {
......@@ -566,7 +566,7 @@ void GdbEngine::readGdbStandardOutput()
scan = newstart;
if (end == start)
continue;
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
if (m_inbuffer.at(end - 1) == '\r') {
--end;
if (end == start)
......@@ -754,35 +754,6 @@ void GdbEngine::handleTargetCore(const GdbResultRecord &, const QVariant &)
qq->reloadRegisters();
}
#if 0
void GdbEngine::handleQueryPwd(const GdbResultRecord &record)
{
// FIXME: remove this special case as soon as 'pwd'
// is supported by MI
//qDebug() << "PWD OUTPUT:" << record.toString();
// Gdb responses _unless_ we get an error first.
if (record.resultClass == GdbResultDone) {
QByteArray pwd = record.data.findChild("consolestreamoutput").data();
#ifdef Q_OS_LINUX
// "5^done,{logstreamoutput="pwd ",consolestreamoutput
// ="Working directory /home/apoenitz/dev/work/test1. "}
int pos = pwd.indexOf("Working directory");
pwd = pwd.mid(pos + 18);
pwd = pwd.trimmed();
if (pwd.endsWith('.'))
pwd.chop(1);
#endif
#ifdef Q_OS_WIN
FIXME: this is broken
// ~"Working directory C:\\Users\\Thomas\\Documents\\WBTest3\\debug.\n"
pwd = pwd.trimmed();
#endif
m_pwd = QString::fromLocal8Bit(pwd);
debugMessage("PWD RESULT: " + m_pwd);
}
}
#endif
void GdbEngine::handleQuerySources(const GdbResultRecord &record, const QVariant &)
{
if (record.resultClass == GdbResultDone) {
......@@ -1484,7 +1455,7 @@ bool GdbEngine::startDebugger()
//postCommand(_("handle SIGTERM pass nostop print"));
postCommand(_("set unwindonsignal on"));
//postCommand(_("pwd", handleQueryPwd));
//postCommand(_("pwd"));
postCommand(_("set width 0"));
postCommand(_("set height 0"));
......@@ -1575,7 +1546,7 @@ void GdbEngine::continueInferior()
void GdbEngine::handleStart(const GdbResultRecord &response, const QVariant &)
{
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC)
Q_UNUSED(response);
#else
if (response.resultClass == GdbResultDone) {
......@@ -1860,14 +1831,16 @@ void GdbEngine::sendInsertBreakpoint(int index)
const BreakpointData *data = qq->breakHandler()->at(index);
QString where;
if (data->funcName.isEmpty()) {
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
where = data->fileName;
#ifdef Q_OS_MAC
#endif
#if defined(Q_OS_MAC)
// full names do not work on Mac/MI
QFileInfo fi(data->fileName);
where = fi.fileName();
//where = fi.absoluteFilePath();
#endif
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
// full names do not work on Mac/MI
QFileInfo fi(data->fileName);
where = fi.fileName();
......@@ -1884,19 +1857,19 @@ void GdbEngine::sendInsertBreakpoint(int index)
// set up fallback in case of pending breakpoints which aren't handled
// by the MI interface
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
QString cmd = _("-break-insert -f ");
//if (!data->condition.isEmpty())
// cmd += _("-c ") + data->condition + ' ';
cmd += where;
#endif
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC)
QString cmd = _("-break-insert -l -1 ");
//if (!data->condition.isEmpty())
// cmd += "-c " + data->condition + " ";
cmd += where;
#endif
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
QString cmd = _("-break-insert ");
//if (!data->condition.isEmpty())
// cmd += "-c " + data->condition + " ";
......@@ -2027,7 +2000,7 @@ void GdbEngine::handleBreakInsert(const GdbResultRecord &record, const QVariant
BreakHandler *handler = qq->breakHandler();
if (record.resultClass == GdbResultDone) {
//qDebug() << "HANDLE BREAK INSERT" << index;
//#ifdef Q_OS_MAC
//#if defined(Q_OS_MAC)
// interesting only on Mac?
BreakpointData *data = handler->at(index);
GdbMi bkpt = record.data.findChild("bkpt");
......@@ -2040,7 +2013,7 @@ void GdbEngine::handleBreakInsert(const GdbResultRecord &record, const QVariant
const BreakpointData *data = handler->at(index);
// Note that it is perfectly correct that the file name is put
// in quotes but not escaped. GDB simply is like that.
#ifdef Q_OS_LINUX
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
//QString where = "\"\\\"" + data->fileName + "\\\":"
// + data->lineNumber + "\"";
QString where = _c('"') + data->fileName + _("\":")
......@@ -2048,12 +2021,12 @@ void GdbEngine::handleBreakInsert(const GdbResultRecord &record, const QVariant
// Should not happen with -break-insert -f. gdb older than 6.8?
QTC_ASSERT(false, /**/);
#endif
#ifdef Q_OS_MAC
#if defined(Q_OS_MAC)
QFileInfo fi(data->fileName);
QString where = _c('"') + fi.fileName() + _("\":")
+ data->lineNumber;
#endif
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
QFileInfo fi(data->fileName);
QString where = _c('"') + fi.fileName() + _("\":")
+ data->lineNumber;
......@@ -2454,7 +2427,7 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record, const QVari
stackFrames.append(frame);
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN)
const bool isBogus =
// Assume this is wrong and points to some strange stl_algobase
// implementation. Happens on Karsten's XP system with Gdb 5.50
......
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