Commit a2518b6d authored by hjk's avatar hjk
Browse files

debugger: disable address related breakpoints on debugger exit

parent ae730dbe
......@@ -303,9 +303,6 @@ void BreakHandler::saveBreakpoints()
for ( ; it != et; ++it) {
const BreakpointParameters &data = it->data;
QMap<QString, QVariant> map;
// Do not persist Watchpoints.
if (data.isWatchpoint())
continue;
if (data.type != BreakpointByFileAndLine)
map.insert(_("type"), data.type);
if (!data.fileName.isEmpty())
......@@ -332,6 +329,8 @@ void BreakHandler::saveBreakpoints()
map.insert(_("module"), data.module);
if (!data.command.isEmpty())
map.insert(_("command"), data.command);
if (!data.expression.isEmpty())
map.insert(_("expression"), data.expression);
list.append(map);
}
debuggerCore()->setSessionValue("Breakpoints", list);
......@@ -387,6 +386,9 @@ void BreakHandler::loadBreakpoints()
v = map.value(_("command"));
if (v.isValid())
data.command = v.toString();
v = map.value(_("expression"));
if (v.isValid())
data.expression = v.toString();
appendBreakpoint(data);
}
//qDebug() << "LOADED BREAKPOINTS" << this << list.size();
......@@ -521,9 +523,9 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|| data.type == BreakpointAtSysCall)
return typeToString(data.type);
if (data.type == WatchpointAtAddress)
return tr("Data breakpoint at 0x%1").arg(data.address, 0, 16);
return tr("Data at 0x%1").arg(data.address, 0, 16);
if (data.type == WatchpointAtExpression)
return tr("Data breakpoint at %1").arg(data.expression);
return tr("Data at %1").arg(data.expression);
return empty;
}
break;
......@@ -882,6 +884,10 @@ void BreakHandler::notifyBreakpointReleased(BreakpointId id)
it->response = BreakpointResponse();
delete it->marker;
it->marker = 0;
if (it->data.type == WatchpointAtAddress
|| it->data.type == WatchpointAtExpression
|| it->data.type == BreakpointByAddress)
it->data.enabled = false;
updateMarker(id);
layoutChanged();
}
......@@ -1093,7 +1099,7 @@ bool BreakHandler::needsChange(BreakpointId id) const
}
void BreakHandler::setResponse(BreakpointId id,
const BreakpointResponse &response, bool takeOver)
const BreakpointResponse &response)
{
Iterator it = m_storage.find(id);
BREAK_ASSERT(it != m_storage.end(), return);
......@@ -1101,12 +1107,10 @@ void BreakHandler::setResponse(BreakpointId id,
item.response = response;
item.destroyMarker();
// Take over corrected values from response.
if (takeOver) {
if ((item.data.type == BreakpointByFileAndLine
|| item.data.type == BreakpointByFunction)
&& !response.module.isEmpty())
item.data.module = response.module;
}
if ((item.data.type == BreakpointByFileAndLine
|| item.data.type == BreakpointByFunction)
&& !response.module.isEmpty())
item.data.module = response.module;
updateMarker(id);
}
......
......@@ -137,7 +137,7 @@ public:
DebuggerEngine *engine(BreakpointId id) const;
void setEngine(BreakpointId id, DebuggerEngine *engine);
const BreakpointResponse &response(BreakpointId id) const;
void setResponse(BreakpointId id, const BreakpointResponse &data, bool takeOver = true);
void setResponse(BreakpointId id, const BreakpointResponse &data);
bool needsChange(BreakpointId id) const;
// State transitions.
......
......@@ -2318,7 +2318,9 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
// Mac yields:
//>32^done,wpt={number="4",exp="*4355182176"}
bresponse.number = wpt.findChild("number").data().toInt();
bresponse.address = wpt.findChild("exp").toAddress();
QByteArray exp = wpt.findChild("exp").data();
if (exp.startsWith('*'))
bresponse.address = exp.mid(1).toULongLong(0, 0);
handler->setResponse(id, bresponse);
QTC_ASSERT(!handler->needsChange(id), /**/);
handler->notifyBreakpointInsertOk(id);
......@@ -2327,9 +2329,10 @@ void GdbEngine::handleWatchInsert(const GdbResponse &response)
// Non-Mac: "Hardware watchpoint 2: *0xbfffed40\n"
const int end = ba.indexOf(':');
const int begin = ba.lastIndexOf(' ', end) + 1;
const QByteArray address = ba.mid(end + 3).trimmed();
const QByteArray address = ba.mid(end + 2).trimmed();
bresponse.number = ba.mid(begin, end - begin).toInt();
bresponse.address = address.toULongLong(0, 0);
if (address.startsWith('*'))
bresponse.address = address.mid(1).toULongLong(0, 0);
handler->setResponse(id, bresponse);
QTC_ASSERT(!handler->needsChange(id), /**/);
handler->notifyBreakpointInsertOk(id);
......
......@@ -380,7 +380,7 @@ qulonglong GdbMi::toAddress() const
ba.chop(1);
if (ba.startsWith('*') || ba.startsWith('@'))
ba = ba.mid(1);
return ba.toULongLong(0, 16);
return ba.toULongLong(0, 0);
}
//////////////////////////////////////////////////////////////////////////////////
......
......@@ -387,8 +387,10 @@ QString WatchData::toToolTip() const
QString WatchData::msgNotInScope()
{
//: Value of variable in Debugger Locals display for variables out of scope (stopped above initialization).
static const QString rc = QCoreApplication::translate("Debugger::Internal::WatchData", "<not in scope>");
//: Value of variable in Debugger Locals display for variables out
//: of scope (stopped above initialization).
static const QString rc =
QCoreApplication::translate("Debugger::Internal::WatchData", "<not in scope>");
return rc;
}
......@@ -397,7 +399,8 @@ const QString &WatchData::shadowedNameFormat()
//: Display of variables shadowed by variables of the same name
//: in nested scopes: Variable %1 is the variable name, %2 is a
//: simple count.
static const QString format = QCoreApplication::translate("Debugger::Internal::WatchData", "%1 <shadowed %2>");
static const QString format =
QCoreApplication::translate("Debugger::Internal::WatchData", "%1 <shadowed %2>");
return format;
}
......@@ -415,12 +418,16 @@ quint64 WatchData::coreAddress() const
QByteArray WatchData::hexAddress() const
{
return address ? (QByteArray("0x") + QByteArray::number(address, 16)) : QByteArray();
if (address)
return QByteArray("0x") + QByteArray::number(address, 16);
return QByteArray();
}
QByteArray WatchData::hexReferencingAddress() const
{
return referencingAddress ? (QByteArray("0x") + QByteArray::number(referencingAddress, 16)) : QByteArray();
if (referencingAddress)
return QByteArray("0x") + QByteArray::number(referencingAddress, 16);
return QByteArray();
}
} // namespace Internal
......
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