Commit 9dc3e3ed authored by hjk's avatar hjk

debugger: fix quoting of watched expressions with funny chars inside

Base 64 to the rescue.

Reviewed-by: con
parent d40c15ab
......@@ -1335,15 +1335,13 @@ class Dumper:
def handleWatch(self, exp, iname):
exp = str(exp)
escapedExp = exp.replace('"', '\\"')
escapedExp = escapedExp.replace('\\', '\\\\')
escapedExp = base64.b64encode(exp);
#warn("HANDLING WATCH %s, INAME: '%s'" % (exp, iname))
if exp.startswith("[") and exp.endswith("]"):
#warn("EVAL: EXP: %s" % exp)
with SubItem(self):
self.put('iname="%s",' % iname)
self.put('name="%s",' % escapedExp)
self.put('exp="%s",' % escapedExp)
self.put('wname="%s",' % escapedExp)
try:
list = eval(exp)
self.putValue("")
......@@ -1366,8 +1364,7 @@ class Dumper:
with SubItem(self):
self.put('iname="%s",' % iname)
self.put('name="%s",' % escapedExp)
self.put('exp="%s",' % escapedExp)
self.put('wname="%s",' % escapedExp)
handled = False
if len(exp) == 0: # The <Edit> case
self.putValue(" ")
......
......@@ -152,7 +152,15 @@ void GdbEngine::handleStackFramePython(const GdbResponse &response)
foreach (const GdbMi &child, data.children()) {
WatchData dummy;
dummy.iname = child.findChild("iname").data();
dummy.name = _(child.findChild("name").data());
GdbMi wname = child.findChild("wname");
if (wname.isValid()) {
// Happens (only) for watched expressions. They are encoded as.
// base64 encoded 8 bit data, without quotes
dummy.name = decodeData(wname.data(), 5);
dummy.exp = dummy.name.toUtf8();
} else {
dummy.name = _(child.findChild("name").data());
}
//qDebug() << "CHILD: " << child.toString();
parseWatchData(watchHandler()->expandedINames(), dummy, child, &list);
}
......
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