Commit 72d90fd5 authored by hjk's avatar hjk

debugger: merge multiple fancy views of the same object

parent f0300b9e
...@@ -781,13 +781,14 @@ class FrameCommand(gdb.Command): ...@@ -781,13 +781,14 @@ class FrameCommand(gdb.Command):
def handleWatch(self, d, exp, iname): def handleWatch(self, d, exp, iname):
exp = str(exp) exp = str(exp)
escapedExp = exp.replace('"', '\\"');
#warn("HANDLING WATCH %s, INAME: '%s'" % (exp, iname)) #warn("HANDLING WATCH %s, INAME: '%s'" % (exp, iname))
if exp.startswith("[") and exp.endswith("]"): if exp.startswith("[") and exp.endswith("]"):
#warn("EVAL: EXP: %s" % exp) #warn("EVAL: EXP: %s" % exp)
d.beginHash() d.beginHash()
d.putField("iname", iname) d.putField("iname", iname)
d.putField("name", exp) d.putField("name", escapedExp)
d.putField("exp", exp) d.putField("exp", escapedExp)
try: try:
list = eval(exp) list = eval(exp)
d.putValue("") d.putValue("")
...@@ -800,8 +801,8 @@ class FrameCommand(gdb.Command): ...@@ -800,8 +801,8 @@ class FrameCommand(gdb.Command):
self.handleWatch(d, item, "%s.%d" % (iname, itemNumber)) self.handleWatch(d, item, "%s.%d" % (iname, itemNumber))
itemNumber += 1 itemNumber += 1
d.endChildren() d.endChildren()
except: except RuntimeError, error:
warn("EVAL: ERROR CAUGHT") warn("EVAL: ERROR CAUGHT %s" % error)
d.putValue("<syntax error>") d.putValue("<syntax error>")
d.putType(" ") d.putType(" ")
d.putNumChild(0) d.putNumChild(0)
...@@ -812,18 +813,20 @@ class FrameCommand(gdb.Command): ...@@ -812,18 +813,20 @@ class FrameCommand(gdb.Command):
d.beginHash() d.beginHash()
d.putField("iname", iname) d.putField("iname", iname)
d.putField("name", exp) d.putField("name", escapedExp)
d.putField("exp", exp) d.putField("exp", escapedExp)
handled = False handled = False
if exp == "<Edit>": if exp == "<Edit>" or len(exp) == 0:
d.putValue('value=" ",type=" ",numchild="0",') d.put('value=" ",type=" ",numchild="0",')
else: else:
#try: try:
value = parseAndEvaluate(exp) value = parseAndEvaluate(exp)
item = Item(value, iname, None, None) item = Item(value, iname, None, None)
if not value is None:
d.putAddress(value.address)
d.putItemHelper(item) d.putItemHelper(item)
#except RuntimeError: except RuntimeError:
#d.put('value="<invalid>",type="<unknown>",numchild="0",') d.put('value="<invalid>",type="<unknown>",numchild="0",')
d.endHash() d.endHash()
......
...@@ -1350,7 +1350,8 @@ static void swapEndian(char *d, int nchar) ...@@ -1350,7 +1350,8 @@ static void swapEndian(char *d, int nchar)
void WatchHandler::showEditValue(const WatchData &data) void WatchHandler::showEditValue(const WatchData &data)
{ {
QObject *w = m_editHandlers.value(data.iname); const QByteArray key = data.addr.isEmpty() ? data.iname : data.addr;
QObject *w = m_editHandlers.value(key);
if (data.editformat == 0x0) { if (data.editformat == 0x0) {
m_editHandlers.remove(data.iname); m_editHandlers.remove(data.iname);
delete w; delete w;
...@@ -1364,7 +1365,7 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1364,7 +1365,7 @@ void WatchHandler::showEditValue(const WatchData &data)
if (!data.addr.isEmpty()) if (!data.addr.isEmpty())
addr = QString::fromLatin1(data.addr); addr = QString::fromLatin1(data.addr);
l->setWindowTitle(tr("%1 object at %2").arg(data.type, addr)); l->setWindowTitle(tr("%1 object at %2").arg(data.type, addr));
m_editHandlers[data.iname] = l; m_editHandlers[key] = l;
} }
int width, height, format; int width, height, format;
QByteArray ba; QByteArray ba;
...@@ -1396,7 +1397,7 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1396,7 +1397,7 @@ void WatchHandler::showEditValue(const WatchData &data)
if (!t) { if (!t) {
delete w; delete w;
t = new QTextEdit; t = new QTextEdit;
m_editHandlers[data.iname] = t; m_editHandlers[key] = t;
} }
QByteArray ba = QByteArray::fromHex(data.editvalue); QByteArray ba = QByteArray::fromHex(data.editvalue);
QString str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2); QString str = QString::fromUtf16((ushort *)ba.constData(), ba.size()/2);
...@@ -1413,7 +1414,7 @@ void WatchHandler::showEditValue(const WatchData &data) ...@@ -1413,7 +1414,7 @@ void WatchHandler::showEditValue(const WatchData &data)
p = new QProcess; p = new QProcess;
p->start(cmd); p->start(cmd);
p->waitForStarted(); p->waitForStarted();
m_editHandlers[data.iname] = p; m_editHandlers[key] = p;
} }
p->write(input + "\n"); p->write(input + "\n");
} else { } else {
......
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