Commit 28ca73df authored by hjk's avatar hjk

debugger: small fixes

parent e2419153
......@@ -457,6 +457,8 @@ void DisassemblerViewAgent::updateBreakpointMarkers()
if (!address)
continue;
const int lineNumber = contents.lineForAddress(address);
if (!lineNumber)
continue;
BreakpointMarker2 *marker = new BreakpointMarker2(handler->icon(id));
d->breakpointMarks.append(marker);
d->editor->markableInterface()->addMark(marker, lineNumber);
......
......@@ -2156,25 +2156,22 @@ QByteArray GdbEngine::breakpointLocation(BreakpointId id)
return "__cxa_begin_catch";
if (data.type == BreakpointAtMain)
#ifdef Q_OS_WIN
// FIXME: Should be target specific.
return "qMain";
#else
return "main";
#endif
const QByteArray functionName = data.functionName.toUtf8();
if (!functionName.isEmpty())
return functionName;
if (const quint64 address = data.address)
return addressSpec(address);
// In this case, data->funcName is something like '*0xdeadbeef'
const int lineNumber = data.lineNumber;
if (lineNumber == 0)
return functionName;
if (data.type == BreakpointByFunction)
return data.functionName.toUtf8();
if (data.type == BreakpointByAddress)
return addressSpec(data.address);
const QString fileName = data.useFullPath
? data.fileName : breakLocation(data.fileName);
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
return "\"\\\"" + GdbMi::escapeCString(fileName).toLocal8Bit() + "\\\":"
+ QByteArray::number(lineNumber) + '"';
+ QByteArray::number(data.lineNumber) + '"';
}
void GdbEngine::handleWatchInsert(const GdbResponse &response)
......@@ -2211,7 +2208,7 @@ void GdbEngine::attemptAdjustBreakpointLocation(BreakpointId id)
void GdbEngine::handleBreakInsert1(const GdbResponse &response)
{
const int id = response.cookie.toInt();
BreakpointId id(response.cookie.toInt());
if (response.resultClass == GdbResultDone) {
// Interesting only on Mac?
GdbMi bkpt = response.data.findChild("bkpt");
......@@ -2695,8 +2692,8 @@ void GdbEngine::removeBreakpoint(BreakpointId id)
QTC_ASSERT(handler->state(id) == BreakpointRemoveRequested, /**/);
handler->notifyBreakpointRemoveProceeding(id);
BreakpointResponse br = handler->response(id);
showMessage(_("DELETING BP %1 IN ").arg(br.number)
+ handler->fileName(id));
showMessage(_("DELETING BP %1 IN %2").arg(br.number)
.arg(handler->fileName(id)));
postCommand("-break-delete " + QByteArray::number(br.number),
NeedsStop | RebuildBreakpointModel);
// Pretend it succeeds without waiting for response. Feels better.
......
......@@ -302,7 +302,6 @@ private: ////////// Gdb Output, State & Capability Handling //////////
private: ////////// Inferior Management //////////
// This should be always the last call in a function.
//Q_SLOT virtual void attemptBreakpointSynchronization();
bool stateAcceptsBreakpointChanges() const;
bool acceptsBreakpoint(BreakpointId id) const;
void insertBreakpoint(BreakpointId id);
......
......@@ -326,43 +326,26 @@ void PdbEngine::selectThread(int index)
Q_UNUSED(index)
}
void PdbEngine::attemptBreakpointSynchronization()
bool PdbEngine::acceptsBreakpoint(BreakpointId id) const
{
const QString fileName = breakHandler()->fileName(id);
return fileName.endsWith(QLatin1String(".py"));
}
void PdbEngine::insertBreakpoint(BreakpointId id)
{
BreakHandler *handler = breakHandler();
//qDebug() << "ATTEMPT BP SYNC";
bool updateNeeded = false;
foreach (BreakpointId id, handler->engineBreakpointIds(this)) {
if (handler->state(id) == BreakpointInsertRequested) {
handler->notifyBreakpointInsertOk(id);
updateNeeded = true;
QByteArray loc;
if (!handler->functionName(id).isEmpty())
loc = handler->functionName(id).toLatin1();
// The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants.
//return "\"\\\"" + GdbMi::escapeCString(data->fileName).toLocal8Bit()
// + "\\\":" + data->lineNumber + '"';
else
loc = handler->fileName(id).toLocal8Bit() + ':'
+ QByteArray::number(handler->lineNumber(id));
postCommand("break " + loc, CB(handleBreakInsert), QVariant(id));
}
/*
if (data->bpNumber.isEmpty()) {
data->bpNumber = QByteArray::number(index + 1);
updateNeeded = true;
}
if (!data->fileName.isEmpty() && data->markerFileName().isEmpty()) {
data->setMarkerFileName(data->fileName);
data->setMarkerLineNumber(data->lineNumber.toInt());
updateNeeded = true;
}
*/
}
//if (updateNeeded)
// handler->updateMarkers();
QTC_ASSERT(handler->state(id) == BreakpointInsertRequested, /**/);
handler->notifyBreakpointInsertProceeding(id);
QByteArray loc;
if (handler->type(id) == BreakpointByFunction)
loc = handler->functionName(id).toLatin1();
else
loc = handler->fileName(id).toLocal8Bit() + ':'
+ QByteArray::number(handler->lineNumber(id));
postCommand("break " + loc, CB(handleBreakInsert), QVariant(id));
}
void PdbEngine::handleBreakInsert(const PdbResponse &response)
......@@ -385,6 +368,19 @@ void PdbEngine::handleBreakInsert(const PdbResponse &response)
handler->setResponse(id, br);
}
void PdbEngine::removeBreakpoint(BreakpointId id)
{
BreakHandler *handler = breakHandler();
QTC_ASSERT(handler->state(id) == BreakpointRemoveRequested, /**/);
handler->notifyBreakpointRemoveProceeding(id);
BreakpointResponse br = handler->response(id);
showMessage(_("DELETING BP %1 IN %2").arg(br.number)
.arg(handler->fileName(id)));
postCommand("clear " + QByteArray::number(br.number));
// Pretend it succeeds without waiting for response.
handler->notifyBreakpointRemoveOk(id);
}
void PdbEngine::loadSymbols(const QString &moduleName)
{
Q_UNUSED(moduleName)
......
......@@ -88,9 +88,12 @@ private:
void activateFrame(int index);
void selectThread(int index);
void attemptBreakpointSynchronization();
bool acceptsBreakpoint(BreakpointId id) const;
void insertBreakpoint(BreakpointId id);
void removeBreakpoint(BreakpointId id);
void assignValueInDebugger(const Internal::WatchData *w, const QString &expr, const QVariant &value);
void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value);
void executeDebuggerCommand(const QString &command);
void loadSymbols(const QString &moduleName);
......
......@@ -1539,7 +1539,9 @@ QVariant testQVariant2()
*(QString*)value.data() = QString("XXX");
int i = 1;
Q_UNUSED(i);
++i;
++i;
++i;
#if 1
QVariant var;
var.setValue(1);
......
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