Commit f9cd211d authored by hjk's avatar hjk
Browse files

debugger: fix setting of breakpoint types on session loading

parent 47905482
...@@ -204,8 +204,7 @@ void BreakHandler::setWatchpointByAddress(quint64 address) ...@@ -204,8 +204,7 @@ void BreakHandler::setWatchpointByAddress(quint64 address)
{ {
const int id = findWatchpointByAddress(address); const int id = findWatchpointByAddress(address);
if (id == -1) { if (id == -1) {
BreakpointData data; BreakpointData data(Watchpoint);
data.setType(Watchpoint);
data.setAddress(address); data.setAddress(address);
appendBreakpoint(data); appendBreakpoint(data);
scheduleSynchronization(); scheduleSynchronization();
...@@ -296,7 +295,7 @@ void BreakHandler::loadBreakpoints() ...@@ -296,7 +295,7 @@ void BreakHandler::loadBreakpoints()
if (v.isValid()) if (v.isValid())
data.setUseFullPath(bool(v.toInt())); data.setUseFullPath(bool(v.toInt()));
v = map.value(_("type")); v = map.value(_("type"));
if (v.isValid()) if (v.isValid() && v.toInt() != UnknownType)
data.setType(BreakpointType(v.toInt())); data.setType(BreakpointType(v.toInt()));
data.setMarkerFileName(data.fileName()); data.setMarkerFileName(data.fileName());
data.setMarkerLineNumber(data.lineNumber()); data.setMarkerLineNumber(data.lineNumber());
...@@ -623,6 +622,8 @@ void BreakHandler::removeBreakpoint(BreakpointId id) ...@@ -623,6 +622,8 @@ void BreakHandler::removeBreakpoint(BreakpointId id)
void BreakHandler::appendBreakpoint(const BreakpointData &data) void BreakHandler::appendBreakpoint(const BreakpointData &data)
{ {
QTC_ASSERT(data.type() != UnknownType, return);
// Ok to be not thread-safe. The order does not matter and only the gui // Ok to be not thread-safe. The order does not matter and only the gui
// produces authoritative ids. // produces authoritative ids.
static quint64 currentId = 0; static quint64 currentId = 0;
...@@ -652,8 +653,10 @@ void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber, ...@@ -652,8 +653,10 @@ void BreakHandler::toggleBreakpoint(const QString &fileName, int lineNumber,
} else { } else {
BreakpointData data; BreakpointData data;
if (address) { if (address) {
data.setType(BreakpointByAddress);
data.setAddress(address); data.setAddress(address);
} else { } else {
data.setType(BreakpointByFileAndLine);
data.setFileName(fileName); data.setFileName(fileName);
data.setLineNumber(lineNumber); data.setLineNumber(lineNumber);
} }
...@@ -687,8 +690,7 @@ void BreakHandler::breakByFunction(const QString &functionName) ...@@ -687,8 +690,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
&& data.ignoreCount() == 0) && data.ignoreCount() == 0)
return; return;
} }
BreakpointData data; BreakpointData data(BreakpointByFunction);
data.setType(BreakpointByFunction);
data.setFunctionName(functionName); data.setFunctionName(functionName);
appendBreakpoint(data); appendBreakpoint(data);
} }
......
...@@ -363,14 +363,12 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) ...@@ -363,14 +363,12 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
else if (act == addBreakpointAction) else if (act == addBreakpointAction)
addBreakpoint(); addBreakpoint();
else if (act == breakAtThrowAction) { else if (act == breakAtThrowAction) {
BreakpointData data; BreakpointData data(BreakpointByFunction);
data.setType(BreakpointByFunction);
data.setFunctionName(BreakpointData::throwFunction); data.setFunctionName(BreakpointData::throwFunction);
handler->appendBreakpoint(data); handler->appendBreakpoint(data);
} else if (act == breakAtCatchAction) { } else if (act == breakAtCatchAction) {
// FIXME: Use the proper breakpoint type instead. // FIXME: Use the proper breakpoint type instead.
BreakpointData data; BreakpointData data(BreakpointByFunction);
data.setType(BreakpointByFunction);
data.setFunctionName(BreakpointData::catchFunction); data.setFunctionName(BreakpointData::catchFunction);
handler->appendBreakpoint(data); handler->appendBreakpoint(data);
} }
...@@ -405,7 +403,7 @@ void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent) ...@@ -405,7 +403,7 @@ void BreakWindow::editBreakpoint(BreakpointId id, QWidget *parent)
void BreakWindow::addBreakpoint() void BreakWindow::addBreakpoint()
{ {
BreakpointData data; BreakpointData data(BreakpointByFileAndLine);
BreakpointDialog dialog(this); BreakpointDialog dialog(this);
if (dialog.showDialog(&data)) if (dialog.showDialog(&data))
breakHandler()->appendBreakpoint(data); breakHandler()->appendBreakpoint(data);
......
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