debugger: simplify the 'break at main' logic

This commit is contained in:
hjk
2010-12-14 12:50:10 +01:00
parent 49bb22134f
commit 7ef927ac6c
3 changed files with 8 additions and 24 deletions

View File

@@ -95,7 +95,6 @@ DebuggerStartParameters::DebuggerStartParameters() :
isSnapshot(false), isSnapshot(false),
attachPID(-1), attachPID(-1),
useTerminal(false), useTerminal(false),
breakAtMain(false),
qmlServerAddress("127.0.0.1"), qmlServerAddress("127.0.0.1"),
qmlServerPort(0), qmlServerPort(0),
useServerStartScript(false), useServerStartScript(false),
@@ -493,9 +492,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
if (!d->m_startParameters.environment.size()) if (!d->m_startParameters.environment.size())
d->m_startParameters.environment = Utils::Environment(); d->m_startParameters.environment = Utils::Environment();
if (d->m_startParameters.breakAtMain)
breakByFunctionMain();
const unsigned engineCapabilities = debuggerCapabilities(); const unsigned engineCapabilities = debuggerCapabilities();
debuggerCore()->action(OperateByInstruction) debuggerCore()->action(OperateByInstruction)
->setEnabled(engineCapabilities & DisassemblerCapability); ->setEnabled(engineCapabilities & DisassemblerCapability);
@@ -510,21 +506,6 @@ void DebuggerEngine::startDebugger(DebuggerRunControl *runControl)
setupEngine(); 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() void DebuggerEngine::resetLocation()
{ {
d->m_disassemblerAgent.resetLocation(); d->m_disassemblerAgent.resetLocation();

View File

@@ -76,7 +76,6 @@ public:
QString workingDirectory; QString workingDirectory;
qint64 attachPID; qint64 attachPID;
bool useTerminal; bool useTerminal;
bool breakAtMain;
// Used by AttachCrashedExternal. // Used by AttachCrashedExternal.
QString crashParameter; QString crashParameter;
@@ -257,9 +256,6 @@ public:
bool debuggerActionsEnabled() const; bool debuggerActionsEnabled() const;
static bool debuggerActionsEnabled(DebuggerState state); static bool debuggerActionsEnabled(DebuggerState state);
void breakByFunction(const QString &functionName);
void breakByFunctionMain();
DebuggerState state() const; DebuggerState state() const;
DebuggerState lastGoodState() const; DebuggerState lastGoodState() const;
DebuggerState targetState() const; DebuggerState targetState() const;

View File

@@ -1499,13 +1499,20 @@ void DebuggerPluginPrivate::startExternalApplication()
sp.executable = dlg.executableFile(); sp.executable = dlg.executableFile();
sp.startMode = StartExternal; sp.startMode = StartExternal;
sp.workingDirectory = dlg.workingDirectory(); sp.workingDirectory = dlg.workingDirectory();
sp.breakAtMain = dlg.breakAtMain();
if (!dlg.executableArguments().isEmpty()) if (!dlg.executableArguments().isEmpty())
sp.processArgs = dlg.executableArguments(); sp.processArgs = dlg.executableArguments();
// Fixme: 1 of 3 testing hacks. // Fixme: 1 of 3 testing hacks.
if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ "))) if (sp.processArgs.startsWith(__("@tcf@ ")) || sp.processArgs.startsWith(__("@sym@ ")))
sp.toolChainType = ToolChain_RVCT2_ARMV5; 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)) if (RunControl *rc = m_debuggerRunControlFactory->create(sp))
startDebugger(rc); startDebugger(rc);