Commit 7ef927ac authored by hjk's avatar hjk
Browse files

debugger: simplify the 'break at main' logic

parent 49bb2213
......@@ -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();
......
......@@ -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;
......
......@@ -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);
......
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