debugger: let python handle the listing of breakpoints

TODO: only transfer deltas
This commit is contained in:
hjk
2010-02-05 15:23:09 +01:00
parent 735b3489d4
commit 4cba453a1e
4 changed files with 51 additions and 18 deletions

View File

@@ -128,13 +128,14 @@ def listOfBreakpoints(d):
continue continue
number = line[0:5] number = line[0:5]
pos0x = line.find(" 0x") pos0x = line.find(" 0x")
posin = line.find(" in ") posin = line.find(" in ", pos0x)
posat = line.find(" at ") posat = line.find(" at ", posin)
poscol = line.find(":", posat) poscol = line.find(":", posat)
if pos0x < posin and pos0x != -1: if pos0x < posin and pos0x != -1:
bp.address.append(line[pos0x + 1 : posin]) bp.address.append(line[pos0x + 1 : posin])
if line.find("<PENDING>") >= 0: # Take "no address" as indication that the bp is pending.
bp.address.append("<PENDING>") #if line.find("<PENDING>") >= 0:
# bp.address.append("<PENDING>")
if posin < posat and posin != -1: if posin < posat and posin != -1:
bp.function = line[posin + 4 : posat] bp.function = line[posin + 4 : posat]
if posat < poscol and poscol != -1: if posat < poscol and poscol != -1:
@@ -625,10 +626,10 @@ class FrameCommand(gdb.Command):
# Breakpoints # Breakpoints
# #
breakpoints = "" breakpoints = ""
#d.safeoutput = "" d.safeoutput = ""
#listOfBreakpoints(d) listOfBreakpoints(d)
#d.pushOutput() d.pushOutput()
#breakpoints = d.safeoutput breakpoints = d.safeoutput
print('data=[' + locals + sep + watchers + '],bkpts=[' + breakpoints + ']\n') print('data=[' + locals + sep + watchers + '],bkpts=[' + breakpoints + ']\n')

View File

@@ -91,7 +91,7 @@ public:
QString bpFileName; // file name acknowledged by the debugger engine QString bpFileName; // file name acknowledged by the debugger engine
QByteArray bpLineNumber; // line number acknowledged by the debugger engine QByteArray bpLineNumber; // line number acknowledged by the debugger engine
QString bpFuncName; // function name acknowledged by the debugger engine QString bpFuncName; // function name acknowledged by the debugger engine
QString bpAddress; // address acknowledged by the debugger engine QByteArray bpAddress; // address acknowledged by the debugger engine
bool bpMultiple; // happens in constructors/gdb bool bpMultiple; // happens in constructors/gdb
bool bpEnabled; // enable/disable command sent bool bpEnabled; // enable/disable command sent

View File

@@ -1315,14 +1315,16 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints)) if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints))
reloadSourceFilesInternal(); // This needs to be done before fullName() may need it reloadSourceFilesInternal(); // This needs to be done before fullName() may need it
if (m_breakListOutdated) if (!hasPython()) {
reloadBreakListInternal(); if (m_breakListOutdated)
else
// Older gdb versions do not produce "library loaded" messages
// so the breakpoint update is not triggered.
if (m_gdbVersion < 70000 && !m_isMacGdb && !m_breakListUpdating
&& manager()->breakHandler()->size() > 0)
reloadBreakListInternal(); reloadBreakListInternal();
else
// Older gdb versions do not produce "library loaded" messages
// so the breakpoint update is not triggered.
if (m_gdbVersion < 70000 && !m_isMacGdb && !m_breakListUpdating
&& manager()->breakHandler()->size() > 0)
reloadBreakListInternal();
}
if (reason == "breakpoint-hit") { if (reason == "breakpoint-hit") {
showStatusMessage(tr("Stopped at breakpoint.")); showStatusMessage(tr("Stopped at breakpoint."));
@@ -1945,7 +1947,7 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
if (child.data() == "<MULTIPLE>") if (child.data() == "<MULTIPLE>")
data->bpMultiple = true; data->bpMultiple = true;
else else
data->bpAddress = _(child.data()); data->bpAddress = child.data();
} else if (child.hasName("file")) { } else if (child.hasName("file")) {
file = child.data(); file = child.data();
} else if (child.hasName("fullname")) { } else if (child.hasName("fullname")) {
@@ -2190,7 +2192,7 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointData *
re.setMinimal(true); re.setMinimal(true);
if (re.indexIn(output) != -1) { if (re.indexIn(output) != -1) {
data->bpAddress = re.cap(1); data->bpAddress = re.cap(1).toLatin1();
data->bpFuncName = re.cap(2).trimmed(); data->bpFuncName = re.cap(2).trimmed();
data->bpLineNumber = re.cap(4).toLatin1(); data->bpLineNumber = re.cap(4).toLatin1();
QString full = fullName(re.cap(3)); QString full = fullName(re.cap(3));

View File

@@ -33,6 +33,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerstringutils.h" #include "debuggerstringutils.h"
#include "breakhandler.h"
#include "watchhandler.h" #include "watchhandler.h"
#include "stackhandler.h" #include "stackhandler.h"
@@ -141,6 +142,35 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
//for (int i = 0; i != list.size(); ++i) //for (int i = 0; i != list.size(); ++i)
// qDebug() << "LOCAL: " << list.at(i).toString(); // qDebug() << "LOCAL: " << list.at(i).toString();
data = all.findChild("bkpts");
if (data.isValid()) {
BreakHandler *handler = manager()->breakHandler();
foreach (const GdbMi &child, data.children()) {
int bpNumber = child.findChild("number").data().toInt();
int found = handler->findBreakpoint(bpNumber);
if (found != -1) {
BreakpointData *bp = handler->at(found);
GdbMi addr = child.findChild("addr");
if (addr.isValid()) {
bp->bpAddress = child.findChild("addr").data();
bp->pending = false;
} else {
bp->bpAddress = "<PENDING>";
bp->pending = true;
}
bp->bpFuncName = child.findChild("func").data();
bp->bpLineNumber = child.findChild("line").data();
bp->bpFileName = child.findChild("file").data();
bp->markerLineNumber = bp->bpLineNumber.toInt();
bp->markerFileName = bp->bpFileName;
} else {
QTC_ASSERT(false, qDebug() << child.toString());
//bp->bpNumber = "<unavailable>";
}
}
handler->updateMarkers();
}
//PENDING_DEBUG("AFTER handleStackFrame()"); //PENDING_DEBUG("AFTER handleStackFrame()");
// FIXME: This should only be used when updateLocals() was // FIXME: This should only be used when updateLocals() was
// triggered by expanding an item in the view. // triggered by expanding an item in the view.