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