From 7ef927ac6c546b836068eda4286b6e1e979c0ae5 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 14 Dec 2010 12:50:10 +0100 Subject: [PATCH] debugger: simplify the 'break at main' logic --- src/plugins/debugger/debuggerengine.cpp | 19 ------------------- src/plugins/debugger/debuggerengine.h | 4 ---- src/plugins/debugger/debuggerplugin.cpp | 9 ++++++++- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index bcb0100c934..3f4b19dd1c9 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -95,7 +95,6 @@ DebuggerStartParameters::DebuggerStartParameters() : isSnapshot(false), attachPID(-1), useTerminal(false), - breakAtMain(false), qmlServerAddress("127.0.0.1"), qmlServerPort(0), useServerStartScript(false), @@ -493,9 +492,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) if (!d->m_startParameters.environment.size()) d->m_startParameters.environment = Utils::Environment(); - if (d->m_startParameters.breakAtMain) - breakByFunctionMain(); - const unsigned engineCapabilities = debuggerCapabilities(); debuggerCore()->action(OperateByInstruction) ->setEnabled(engineCapabilities & DisassemblerCapability); @@ -510,21 +506,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl) setupEngine(); } -void DebuggerEngine::breakByFunctionMain() -{ -#ifdef Q_OS_WIN - // FIXME: wrong on non-Qt based binaries - emit breakByFunction("qMain"); -#else - emit breakByFunction("main"); -#endif -} - -void DebuggerEngine::breakByFunction(const QString &functionName) -{ - breakHandler()->breakByFunction(functionName); -} - void DebuggerEngine::resetLocation() { d->m_disassemblerAgent.resetLocation(); diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 9e6963888de..aec0adb6c89 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -76,7 +76,6 @@ public: QString workingDirectory; qint64 attachPID; bool useTerminal; - bool breakAtMain; // Used by AttachCrashedExternal. QString crashParameter; @@ -257,9 +256,6 @@ public: bool debuggerActionsEnabled() const; static bool debuggerActionsEnabled(DebuggerState state); - void breakByFunction(const QString &functionName); - void breakByFunctionMain(); - DebuggerState state() const; DebuggerState lastGoodState() const; DebuggerState targetState() const; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 7c9eb48ba5d..422bfe00340 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1499,13 +1499,20 @@ void DebuggerPluginPrivate::startExternalApplication() sp.executable = dlg.executableFile(); sp.startMode = StartExternal; sp.workingDirectory = dlg.workingDirectory(); - sp.breakAtMain = dlg.breakAtMain(); if (!dlg.executableArguments().isEmpty()) sp.processArgs = dlg.executableArguments(); // Fixme: 1 of 3 testing hacks. if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ "))) sp.toolChainType = ToolChain_RVCT2_ARMV5; + if (dlg.breakAtMain()) { +#ifdef Q_OS_WIN + // FIXME: wrong on non-Qt based binaries + breakHandler()->breakByFunction("qMain"); +#else + breakHandler()->breakByFunction("main"); +#endif + } if (RunControl *rc = m_debuggerRunControlFactory->create(sp)) startDebugger(rc); -- GitLab