forked from qt-creator/qt-creator
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:
@@ -214,18 +214,6 @@ def stripTypedefs(typeobj):
|
|||||||
return typeobj
|
return typeobj
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
#
|
|
||||||
# Edit Command
|
|
||||||
#
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
def bbedit(args):
|
|
||||||
theDumper.bbedit(args)
|
|
||||||
|
|
||||||
registerCommand("bbedit", bbedit)
|
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
# Frame Command
|
# Frame Command
|
||||||
@@ -1456,9 +1444,11 @@ class Dumper(DumperBase):
|
|||||||
self.currentQtNamespaceGuess = ""
|
self.currentQtNamespaceGuess = ""
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def bbedit(self, args):
|
def assignValue(self, args):
|
||||||
(typeName, expr, data) = args.split(',')
|
typeName = self.hexdecode(args['type'])
|
||||||
typeName = self.hexdecode(typeName)
|
expr = self.hexdecode(args['expr'])
|
||||||
|
value = self.hexdecode(args['value'])
|
||||||
|
simpleType = int(args['simpleType'])
|
||||||
ns = self.qtNamespace()
|
ns = self.qtNamespace()
|
||||||
if typeName.startswith(ns):
|
if typeName.startswith(ns):
|
||||||
typeName = typeName[len(ns):]
|
typeName = typeName[len(ns):]
|
||||||
@@ -1466,14 +1456,12 @@ class Dumper(DumperBase):
|
|||||||
pos = typeName.find('<')
|
pos = typeName.find('<')
|
||||||
if pos != -1:
|
if pos != -1:
|
||||||
typeName = typeName[0:pos]
|
typeName = typeName[0:pos]
|
||||||
expr = self.hexdecode(expr)
|
if typeName in self.qqEditable and not simpleType:
|
||||||
data = self.hexdecode(data)
|
#self.qqEditable[typeName](self, expr, value)
|
||||||
if typeName in self.qqEditable:
|
expr = gdb.parse_and_eval(expr)
|
||||||
#self.qqEditable[typeName](self, expr, data)
|
self.qqEditable[typeName](self, expr, value)
|
||||||
value = gdb.parse_and_eval(expr)
|
|
||||||
self.qqEditable[typeName](self, value, data)
|
|
||||||
else:
|
else:
|
||||||
cmd = "set variable (%s)=%s" % (expr, data)
|
cmd = "set variable (%s)=%s" % (expr, value)
|
||||||
gdb.execute(cmd)
|
gdb.execute(cmd)
|
||||||
|
|
||||||
def hasVTable(self, typeobj):
|
def hasVTable(self, typeobj):
|
||||||
|
@@ -855,7 +855,7 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
|
|||||||
void GdbEngine::runCommand(const DebuggerCommand &command)
|
void GdbEngine::runCommand(const DebuggerCommand &command)
|
||||||
{
|
{
|
||||||
QByteArray cmd = command.function + "({" + command.args + "})";
|
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,
|
void GdbEngine::postCommand(const QByteArray &command, int flags,
|
||||||
@@ -3786,17 +3786,13 @@ void GdbEngine::insertData(const WatchData &data)
|
|||||||
void GdbEngine::assignValueInDebugger(const WatchData *data,
|
void GdbEngine::assignValueInDebugger(const WatchData *data,
|
||||||
const QString &expression, const QVariant &value)
|
const QString &expression, const QVariant &value)
|
||||||
{
|
{
|
||||||
if (!isIntOrFloatType(data->type)) {
|
DebuggerCommand cmd("assignValue");
|
||||||
QByteArray cmd = "bbedit "
|
cmd.arg("type", data->type.toHex());
|
||||||
+ data->type.toHex() + ','
|
cmd.arg("expr", expression.toLatin1().toHex());
|
||||||
+ expression.toUtf8().toHex() + ','
|
cmd.arg("value", value.toString().toLatin1().toHex());
|
||||||
+ value.toString().toUtf8().toHex();
|
cmd.arg("simpleType", isIntOrFloatType(data->type));
|
||||||
postCommand(cmd, Discardable, CB(handleVarAssign));
|
cmd.callback = CB(handleVarAssign);
|
||||||
} else {
|
runCommand(cmd);
|
||||||
postCommand("set variable (" + expression.toLatin1() + ")="
|
|
||||||
+ GdbMi::escapeCString(value.toString().toLatin1()),
|
|
||||||
Discardable, CB(handleVarAssign));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::watchPoint(const QPoint &pnt)
|
void GdbEngine::watchPoint(const QPoint &pnt)
|
||||||
|
Reference in New Issue
Block a user