debugger: fix fallback path to the CLI break

The filenames have to be quoted differently.
This commit is contained in:
hjk
2011-03-04 18:08:56 +01:00
parent f6ccdfb2cd
commit 486c1ddb18
3 changed files with 24 additions and 12 deletions

View File

@@ -741,6 +741,7 @@ void BreakHandler::setState(BreakpointId id, BreakpointState state)
} }
it->state = state; it->state = state;
layoutChanged();
} }
void BreakHandler::notifyBreakpointChangeAfterInsertNeeded(BreakpointId id) void BreakHandler::notifyBreakpointChangeAfterInsertNeeded(BreakpointId id)

View File

@@ -2265,6 +2265,16 @@ QByteArray GdbEngine::breakpointLocation(BreakpointId id)
+ QByteArray::number(data.lineNumber) + '"'; + QByteArray::number(data.lineNumber) + '"';
} }
QByteArray GdbEngine::breakpointLocation2(BreakpointId id)
{
BreakHandler *handler = breakHandler();
const BreakpointParameters &data = handler->breakpointData(id);
const QString fileName = data.pathUsage == BreakpointUseFullPath
? data.fileName : breakLocation(data.fileName);
return GdbMi::escapeCString(fileName).toLocal8Bit() + ':'
+ QByteArray::number(data.lineNumber);
}
void GdbEngine::handleWatchInsert(const GdbResponse &response) void GdbEngine::handleWatchInsert(const GdbResponse &response)
{ {
const int id = response.cookie.toInt(); const int id = response.cookie.toInt();
@@ -2333,7 +2343,7 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
// Some versions of gdb like "GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)" // Some versions of gdb like "GNU gdb (GDB) SUSE (6.8.91.20090930-2.4)"
// know how to do pending breakpoints using CLI but not MI. So try // know how to do pending breakpoints using CLI but not MI. So try
// again with MI. // again with MI.
QByteArray cmd = "break " + breakpointLocation(id); QByteArray cmd = "break " + breakpointLocation2(id);
postCommand(cmd, NeedsStop | RebuildBreakpointModel, postCommand(cmd, NeedsStop | RebuildBreakpointModel,
CB(handleBreakInsert2), id); CB(handleBreakInsert2), id);
} }
@@ -2341,15 +2351,15 @@ void GdbEngine::handleBreakInsert1(const GdbResponse &response)
void GdbEngine::handleBreakInsert2(const GdbResponse &response) void GdbEngine::handleBreakInsert2(const GdbResponse &response)
{ {
if (response.resultClass == GdbResultError) { if (response.resultClass == GdbResultDone) {
if (m_gdbVersion < 60800 && !m_isMacGdb) { BreakpointId id(response.cookie.toInt());
// This gdb version doesn't "do" pending breakpoints. attemptAdjustBreakpointLocation(id);
// Not much we can do about it except implementing the breakHandler()->notifyBreakpointInsertOk(id);
// logic on top of shared library events, and that's not } else {
// worth the effort. // Note: gdb < 60800 doesn't "do" pending breakpoints.
} else { // Not much we can do about it except implementing the
QTC_ASSERT(false, /**/); // logic on top of shared library events, and that's not
} // worth the effort.
} }
} }
@@ -2641,7 +2651,7 @@ void GdbEngine::insertBreakpoint(BreakpointId id)
return; return;
} }
QByteArray cmd; QByteArray cmd = "xxx";
if (handler->isTracepoint(id)) { if (handler->isTracepoint(id)) {
cmd = "-break-insert -a -f "; cmd = "-break-insert -a -f ";
} else if (m_isMacGdb) { } else if (m_isMacGdb) {

View File

@@ -373,7 +373,8 @@ private: ////////// View & Data Stuff //////////
void handleInfoLine(const GdbResponse &response); void handleInfoLine(const GdbResponse &response);
void extractDataFromInfoBreak(const QString &output, BreakpointId); void extractDataFromInfoBreak(const QString &output, BreakpointId);
void updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkpt); void updateBreakpointDataFromOutput(BreakpointId id, const GdbMi &bkpt);
QByteArray breakpointLocation(BreakpointId id); QByteArray breakpointLocation(BreakpointId id); // For gdb/MI.
QByteArray breakpointLocation2(BreakpointId id); // For gdb/CLI fallback.
QString breakLocation(const QString &file) const; QString breakLocation(const QString &file) const;
void reloadBreakListInternal(); void reloadBreakListInternal();
void attemptAdjustBreakpointLocation(BreakpointId id); void attemptAdjustBreakpointLocation(BreakpointId id);