summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/script/scriptengine.cpp
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-11-10 16:33:11 +0100
committerhjk <qtc-committer@nokia.com>2010-11-15 12:09:25 +0100
commit8ae541b36fc342c8f02c4b674a68a21c0ed8034d (patch)
treea0e0de05d986987110aec1783d213dfb16337567 /src/plugins/debugger/script/scriptengine.cpp
parent33bae0d7845e546c019d9bda3af44c3411ebcacb (diff)
downloadqt-creator-8ae541b36fc342c8f02c4b674a68a21c0ed8034d.tar.gz
debugger: Refactor breakpoint handling.
The breakpoints are now (fairly) tightly guarded by the BreakpointHandler. Engines and Views are only supposed to refer to them by id. They also have individual states now. The breakpoint data is split into a "user requested" "fixed" part in BreakpointData and the engines' acknowledged data in a new struct BreakpointResponse. TODO: Move m_state and m_engine members to BreakpointResponse. Fix regressions in the marker handling.
Diffstat (limited to 'src/plugins/debugger/script/scriptengine.cpp')
-rw-r--r--src/plugins/debugger/script/scriptengine.cpp56
1 files changed, 16 insertions, 40 deletions
diff --git a/src/plugins/debugger/script/scriptengine.cpp b/src/plugins/debugger/script/scriptengine.cpp
index b6f3ff3554..dd70b92d4d 100644
--- a/src/plugins/debugger/script/scriptengine.cpp
+++ b/src/plugins/debugger/script/scriptengine.cpp
@@ -33,6 +33,7 @@
#include "breakhandler.h"
#include "debuggerconstants.h"
+#include "debuggercore.h"
#include "debuggerdialogs.h"
#include "debuggerstringutils.h"
#include "moduleshandler.h"
@@ -448,6 +449,8 @@ void ScriptEngine::selectThread(int index)
void ScriptEngine::attemptBreakpointSynchronization()
{
+ QTC_ASSERT(false, /* FIXME */);
+/*
BreakHandler *handler = breakHandler();
bool updateNeeded = false;
for (int index = 0; index != handler->size(); ++index) {
@@ -468,6 +471,7 @@ void ScriptEngine::attemptBreakpointSynchronization()
}
if (updateNeeded)
handler->updateMarkers();
+*/
}
void ScriptEngine::loadSymbols(const QString &moduleName)
@@ -589,31 +593,6 @@ void ScriptEngine::assignValueInDebugger(const Internal::WatchData *,
updateLocals();
}
-static BreakpointData *findBreakPointByFunction(BreakHandler *handler,
- const QString &functionName)
-{
- const int count = handler->size();
- for (int b = 0; b < count; b++) {
- BreakpointData *data = handler->at(b);
- if (data->funcName == functionName)
- return data;
- }
- return 0;
-}
-
-static BreakpointData *findBreakPointByFileName(BreakHandler *handler,
- int lineNumber,
- const QString &fileName)
-{
- const int count = handler->size();
- for (int b = 0; b < count; b++) {
- BreakpointData *data = handler->at(b);
- if (lineNumber == data->lineNumber && fileName == data->fileName)
- return data;
- }
- return 0;
-}
-
bool ScriptEngine::checkForBreakCondition(bool byFunction)
{
// FIXME: Should that ever happen after setAgent(0) in shutdownInferior()?
@@ -629,33 +608,30 @@ bool ScriptEngine::checkForBreakCondition(bool byFunction)
const QString fileName = info.fileName();
const int lineNumber = byFunction
? info.functionStartLineNumber() : info.lineNumber();
- SDEBUG(Q_FUNC_INFO << byFunction << functionName
- << lineNumber << fileName);
+ SDEBUG(Q_FUNC_INFO << byFunction << functionName << lineNumber << fileName);
if (m_stopOnNextLine) {
// Interrupt inferior
m_stopOnNextLine = false;
} else {
if (byFunction && functionName.isEmpty())
return false;
- BreakpointData *data = byFunction ?
- findBreakPointByFunction(breakHandler(), functionName) :
- findBreakPointByFileName(breakHandler(), lineNumber, fileName);
- if (!data)
- return false;
+ BreakHandler *handler = breakHandler();
+ BreakpointId id = byFunction ?
+ handler->findBreakpointByFunction(functionName) :
+ handler->findBreakpointByFileAndLine(fileName, lineNumber, false);
// Skip disabled breakpoint.
- if (!data->enabled)
+ if (!handler->isEnabled(id))
return false;
+ BreakpointResponse br;
// We just run into a breakpoint.
//SDEBUG("RESOLVING BREAKPOINT AT " << fileName << lineNumber);
- data->bpLineNumber = lineNumber;
- data->bpFileName = fileName;
- data->bpFuncName = functionName;
- data->setMarkerLineNumber(lineNumber);
- data->setMarkerFileName(fileName);
- data->pending = false;
- breakHandler()->updateMarker(data);
+ br.bpLineNumber = lineNumber;
+ br.bpFileName = fileName;
+ br.bpFuncName = functionName;
+ handler->setState(id, BreakpointInserted);
+ handler->setResponse(id, br);
}
notifyInferiorSpontaneousStop();
SDEBUG("Stopped at " << lineNumber << fileName);