Commit 4cba453a authored by hjk's avatar hjk

debugger: let python handle the listing of breakpoints

TODO: only transfer deltas
parent 735b3489
......@@ -128,13 +128,14 @@ def listOfBreakpoints(d):
continue
number = line[0:5]
pos0x = line.find(" 0x")
posin = line.find(" in ")
posat = line.find(" at ")
posin = line.find(" in ", pos0x)
posat = line.find(" at ", posin)
poscol = line.find(":", posat)
if pos0x < posin and pos0x != -1:
bp.address.append(line[pos0x + 1 : posin])
if line.find("<PENDING>") >= 0:
bp.address.append("<PENDING>")
# Take "no address" as indication that the bp is pending.
#if line.find("<PENDING>") >= 0:
# bp.address.append("<PENDING>")
if posin < posat and posin != -1:
bp.function = line[posin + 4 : posat]
if posat < poscol and poscol != -1:
......@@ -625,10 +626,10 @@ class FrameCommand(gdb.Command):
# Breakpoints
#
breakpoints = ""
#d.safeoutput = ""
#listOfBreakpoints(d)
#d.pushOutput()
#breakpoints = d.safeoutput
d.safeoutput = ""
listOfBreakpoints(d)
d.pushOutput()
breakpoints = d.safeoutput
print('data=[' + locals + sep + watchers + '],bkpts=[' + breakpoints + ']\n')
......
......@@ -91,7 +91,7 @@ public:
QString bpFileName; // file name acknowledged by the debugger engine
QByteArray bpLineNumber; // line number 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 bpEnabled; // enable/disable command sent
......
......@@ -1315,14 +1315,16 @@ void GdbEngine::handleStop1(const GdbMi &data)
if (m_sourcesListOutdated && theDebuggerBoolSetting(UsePreciseBreakpoints))
reloadSourceFilesInternal(); // This needs to be done before fullName() may need it
if (m_breakListOutdated)
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)
if (!hasPython()) {
if (m_breakListOutdated)
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") {
showStatusMessage(tr("Stopped at breakpoint."));
......@@ -1945,7 +1947,7 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt
if (child.data() == "<MULTIPLE>")
data->bpMultiple = true;
else
data->bpAddress = _(child.data());
data->bpAddress = child.data();
} else if (child.hasName("file")) {
file = child.data();
} else if (child.hasName("fullname")) {
......@@ -2190,7 +2192,7 @@ void GdbEngine::extractDataFromInfoBreak(const QString &output, BreakpointData *
re.setMinimal(true);
if (re.indexIn(output) != -1) {
data->bpAddress = re.cap(1);
data->bpAddress = re.cap(1).toLatin1();
data->bpFuncName = re.cap(2).trimmed();
data->bpLineNumber = re.cap(4).toLatin1();
QString full = fullName(re.cap(3));
......
......@@ -33,6 +33,7 @@
#include "debuggeractions.h"
#include "debuggerstringutils.h"
#include "breakhandler.h"
#include "watchhandler.h"
#include "stackhandler.h"
......@@ -141,6 +142,35 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
//for (int i = 0; i != list.size(); ++i)
// 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()");
// FIXME: This should only be used when updateLocals() was
// triggered by expanding an item in the view.
......
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