summaryrefslogtreecommitdiff
path: root/src/plugins/debugger
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-11-25 14:33:13 +0100
committerhjk <qtc-committer@nokia.com>2010-11-25 15:03:02 +0100
commit28ca73df56ed2830e15c9bfb2fbcddbd77dbe082 (patch)
tree1af4797623574a658cdc7e17c463fea8ab6bde47 /src/plugins/debugger
parente2419153a53d2d293f8300deb693da1cdc83fd5c (diff)
downloadqt-creator-28ca73df56ed2830e15c9bfb2fbcddbd77dbe082.tar.gz
debugger: small fixes
Diffstat (limited to 'src/plugins/debugger')
-rw-r--r--src/plugins/debugger/debuggeragents.cpp2
-rw-r--r--src/plugins/debugger/gdb/gdbengine.cpp23
-rw-r--r--src/plugins/debugger/gdb/gdbengine.h1
-rw-r--r--src/plugins/debugger/pdb/pdbengine.cpp66
-rw-r--r--src/plugins/debugger/pdb/pdbengine.h7
5 files changed, 48 insertions, 51 deletions
diff --git a/src/plugins/debugger/debuggeragents.cpp b/src/plugins/debugger/debuggeragents.cpp
index 4d5963e185..36ac56f46a 100644
--- a/src/plugins/debugger/debuggeragents.cpp
+++ b/src/plugins/debugger/debuggeragents.cpp
@@ -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);
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 92235c17f0..eed5fba3ad 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -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.
diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h
index 814a43e7c7..71bbd80a1b 100644
--- a/src/plugins/debugger/gdb/gdbengine.h
+++ b/src/plugins/debugger/gdb/gdbengine.h
@@ -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);
diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp
index d64e9fde72..5150a1adee 100644
--- a/src/plugins/debugger/pdb/pdbengine.cpp
+++ b/src/plugins/debugger/pdb/pdbengine.cpp
@@ -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)
diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h
index c65509ba6f..c3acb01228 100644
--- a/src/plugins/debugger/pdb/pdbengine.h
+++ b/src/plugins/debugger/pdb/pdbengine.h
@@ -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);