Debugger: Using DebuggerCommand instead of bbedit call

Mid-term goal is to reduce the amount of similar code
at least in GDB and LLDB engines.

Change-Id: I4883686a102246be3135ddc694b837b1187ac9e9
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
hjk
2015-02-10 13:40:26 +01:00
parent 85ed66bae9
commit 547855bf02
2 changed files with 18 additions and 34 deletions

View File

@@ -214,18 +214,6 @@ def stripTypedefs(typeobj):
return typeobj
#######################################################################
#
# Edit Command
#
#######################################################################
def bbedit(args):
theDumper.bbedit(args)
registerCommand("bbedit", bbedit)
#######################################################################
#
# Frame Command
@@ -1456,9 +1444,11 @@ class Dumper(DumperBase):
self.currentQtNamespaceGuess = ""
return ""
def bbedit(self, args):
(typeName, expr, data) = args.split(',')
typeName = self.hexdecode(typeName)
def assignValue(self, args):
typeName = self.hexdecode(args['type'])
expr = self.hexdecode(args['expr'])
value = self.hexdecode(args['value'])
simpleType = int(args['simpleType'])
ns = self.qtNamespace()
if typeName.startswith(ns):
typeName = typeName[len(ns):]
@@ -1466,14 +1456,12 @@ class Dumper(DumperBase):
pos = typeName.find('<')
if pos != -1:
typeName = typeName[0:pos]
expr = self.hexdecode(expr)
data = self.hexdecode(data)
if typeName in self.qqEditable:
#self.qqEditable[typeName](self, expr, data)
value = gdb.parse_and_eval(expr)
self.qqEditable[typeName](self, value, data)
if typeName in self.qqEditable and not simpleType:
#self.qqEditable[typeName](self, expr, value)
expr = gdb.parse_and_eval(expr)
self.qqEditable[typeName](self, expr, value)
else:
cmd = "set variable (%s)=%s" % (expr, data)
cmd = "set variable (%s)=%s" % (expr, value)
gdb.execute(cmd)
def hasVTable(self, typeobj):

View File

@@ -855,7 +855,7 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
void GdbEngine::runCommand(const DebuggerCommand &command)
{
QByteArray cmd = command.function + "({" + command.args + "})";
postCommand("python theDumper." + cmd);
postCommand("python theDumper." + cmd, command.flags, command.callback);
}
void GdbEngine::postCommand(const QByteArray &command, int flags,
@@ -3786,17 +3786,13 @@ void GdbEngine::insertData(const WatchData &data)
void GdbEngine::assignValueInDebugger(const WatchData *data,
const QString &expression, const QVariant &value)
{
if (!isIntOrFloatType(data->type)) {
QByteArray cmd = "bbedit "
+ data->type.toHex() + ','
+ expression.toUtf8().toHex() + ','
+ value.toString().toUtf8().toHex();
postCommand(cmd, Discardable, CB(handleVarAssign));
} else {
postCommand("set variable (" + expression.toLatin1() + ")="
+ GdbMi::escapeCString(value.toString().toLatin1()),
Discardable, CB(handleVarAssign));
}
DebuggerCommand cmd("assignValue");
cmd.arg("type", data->type.toHex());
cmd.arg("expr", expression.toLatin1().toHex());
cmd.arg("value", value.toString().toLatin1().toHex());
cmd.arg("simpleType", isIntOrFloatType(data->type));
cmd.callback = CB(handleVarAssign);
runCommand(cmd);
}
void GdbEngine::watchPoint(const QPoint &pnt)