debugger: small fixes

This commit is contained in:
hjk
2010-11-25 14:33:13 +01:00
parent e2419153a5
commit 28ca73df56
6 changed files with 49 additions and 50 deletions

View File

@@ -457,6 +457,8 @@ void DisassemblerViewAgent::updateBreakpointMarkers()
if (!address) if (!address)
continue; continue;
const int lineNumber = contents.lineForAddress(address); const int lineNumber = contents.lineForAddress(address);
if (!lineNumber)
continue;
BreakpointMarker2 *marker = new BreakpointMarker2(handler->icon(id)); BreakpointMarker2 *marker = new BreakpointMarker2(handler->icon(id));
d->breakpointMarks.append(marker); d->breakpointMarks.append(marker);
d->editor->markableInterface()->addMark(marker, lineNumber); d->editor->markableInterface()->addMark(marker, lineNumber);

View File

@@ -2156,25 +2156,22 @@ QByteArray GdbEngine::breakpointLocation(BreakpointId id)
return "__cxa_begin_catch"; return "__cxa_begin_catch";
if (data.type == BreakpointAtMain) if (data.type == BreakpointAtMain)
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// FIXME: Should be target specific.
return "qMain"; return "qMain";
#else #else
return "main"; return "main";
#endif #endif
const QByteArray functionName = data.functionName.toUtf8(); if (data.type == BreakpointByFunction)
if (!functionName.isEmpty()) return data.functionName.toUtf8();
return functionName; if (data.type == BreakpointByAddress)
if (const quint64 address = data.address) return addressSpec(data.address);
return addressSpec(address);
// In this case, data->funcName is something like '*0xdeadbeef'
const int lineNumber = data.lineNumber;
if (lineNumber == 0)
return functionName;
const QString fileName = data.useFullPath const QString fileName = data.useFullPath
? data.fileName : breakLocation(data.fileName); ? data.fileName : breakLocation(data.fileName);
// The argument is simply a C-quoted version of the argument to the // The argument is simply a C-quoted version of the argument to the
// non-MI "break" command, including the "original" quoting it wants. // non-MI "break" command, including the "original" quoting it wants.
return "\"\\\"" + GdbMi::escapeCString(fileName).toLocal8Bit() + "\\\":" return "\"\\\"" + GdbMi::escapeCString(fileName).toLocal8Bit() + "\\\":"
+ QByteArray::number(lineNumber) + '"'; + QByteArray::number(data.lineNumber) + '"';
} }
void GdbEngine::handleWatchInsert(const GdbResponse &response) void GdbEngine::handleWatchInsert(const GdbResponse &response)
@@ -2211,7 +2208,7 @@ void GdbEngine::attemptAdjustBreakpointLocation(BreakpointId id)
void GdbEngine::handleBreakInsert1(const GdbResponse &response) void GdbEngine::handleBreakInsert1(const GdbResponse &response)
{ {
const int id = response.cookie.toInt(); BreakpointId id(response.cookie.toInt());
if (response.resultClass == GdbResultDone) { if (response.resultClass == GdbResultDone) {
// Interesting only on Mac? // Interesting only on Mac?
GdbMi bkpt = response.data.findChild("bkpt"); GdbMi bkpt = response.data.findChild("bkpt");
@@ -2695,8 +2692,8 @@ void GdbEngine::removeBreakpoint(BreakpointId id)
QTC_ASSERT(handler->state(id) == BreakpointRemoveRequested, /**/); QTC_ASSERT(handler->state(id) == BreakpointRemoveRequested, /**/);
handler->notifyBreakpointRemoveProceeding(id); handler->notifyBreakpointRemoveProceeding(id);
BreakpointResponse br = handler->response(id); BreakpointResponse br = handler->response(id);
showMessage(_("DELETING BP %1 IN ").arg(br.number) showMessage(_("DELETING BP %1 IN %2").arg(br.number)
+ handler->fileName(id)); .arg(handler->fileName(id)));
postCommand("-break-delete " + QByteArray::number(br.number), postCommand("-break-delete " + QByteArray::number(br.number),
NeedsStop | RebuildBreakpointModel); NeedsStop | RebuildBreakpointModel);
// Pretend it succeeds without waiting for response. Feels better. // Pretend it succeeds without waiting for response. Feels better.

View File

@@ -302,7 +302,6 @@ private: ////////// Gdb Output, State & Capability Handling //////////
private: ////////// Inferior Management ////////// private: ////////// Inferior Management //////////
// This should be always the last call in a function. // This should be always the last call in a function.
//Q_SLOT virtual void attemptBreakpointSynchronization();
bool stateAcceptsBreakpointChanges() const; bool stateAcceptsBreakpointChanges() const;
bool acceptsBreakpoint(BreakpointId id) const; bool acceptsBreakpoint(BreakpointId id) const;
void insertBreakpoint(BreakpointId id); void insertBreakpoint(BreakpointId id);

View File

@@ -326,43 +326,26 @@ void PdbEngine::selectThread(int index)
Q_UNUSED(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(); BreakHandler *handler = breakHandler();
//qDebug() << "ATTEMPT BP SYNC"; QTC_ASSERT(handler->state(id) == BreakpointInsertRequested, /**/);
bool updateNeeded = false; handler->notifyBreakpointInsertProceeding(id);
foreach (BreakpointId id, handler->engineBreakpointIds(this)) {
if (handler->state(id) == BreakpointInsertRequested) {
handler->notifyBreakpointInsertOk(id);
updateNeeded = true;
QByteArray loc; QByteArray loc;
if (!handler->functionName(id).isEmpty()) if (handler->type(id) == BreakpointByFunction)
loc = handler->functionName(id).toLatin1(); 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 else
loc = handler->fileName(id).toLocal8Bit() + ':' loc = handler->fileName(id).toLocal8Bit() + ':'
+ QByteArray::number(handler->lineNumber(id)); + QByteArray::number(handler->lineNumber(id));
postCommand("break " + loc, CB(handleBreakInsert), QVariant(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();
} }
void PdbEngine::handleBreakInsert(const PdbResponse &response) void PdbEngine::handleBreakInsert(const PdbResponse &response)
@@ -385,6 +368,19 @@ void PdbEngine::handleBreakInsert(const PdbResponse &response)
handler->setResponse(id, br); 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) void PdbEngine::loadSymbols(const QString &moduleName)
{ {
Q_UNUSED(moduleName) Q_UNUSED(moduleName)

View File

@@ -88,9 +88,12 @@ private:
void activateFrame(int index); void activateFrame(int index);
void selectThread(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 executeDebuggerCommand(const QString &command);
void loadSymbols(const QString &moduleName); void loadSymbols(const QString &moduleName);

View File

@@ -1539,7 +1539,9 @@ QVariant testQVariant2()
*(QString*)value.data() = QString("XXX"); *(QString*)value.data() = QString("XXX");
int i = 1; int i = 1;
Q_UNUSED(i); ++i;
++i;
++i;
#if 1 #if 1
QVariant var; QVariant var;
var.setValue(1); var.setValue(1);