Commit f91cc66f authored by hjk's avatar hjk

Debugger: Combine some watch related GDB and LLDB code paths

Change-Id: I20e5f6f04418c931354a07bc3597f6982fcaf942
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
parent cf21092e
......@@ -250,21 +250,9 @@ class Dumper(DumperBase):
self.resultVarName = args.get("resultvarname", "")
self.expandedINames = set(args.get("expanded", []))
self.stringCutOff = int(args.get("stringcutoff", 10000))
self.displayStringLimit = int(args.get("displaystringlimit", 10000))
self.typeformats = {}
for f in args.get("typeformats", "").split(","):
pos = f.find("=")
if pos != -1:
typeName = self.hexdecode(f[0:pos])
self.typeformats[typeName] = int(f[pos+1:])
self.formats = {}
for f in args.get("formats", "").split(","):
pos = f.find("=")
if pos != -1:
self.formats[f[0:pos]] = int(f[pos+1:])
self.displayStringLimit = int(args.get("displaystringlimit", 100))
self.typeformats = args.get("typeformats", {})
self.formats = args.get("formats", {})
self.watchers = args.get("watchers", {})
self.qmlcontext = int(args.get("qmlcontext", "0"))
self.useDynamicType = int(args.get("dyntype", "0"))
......
......@@ -1634,29 +1634,14 @@ class Dumper(DumperBase):
self.report('success="%d",output="%s",error="%s"' % (success, output, error))
def updateData(self, args):
if 'expanded' in args:
self.expandedINames = set(args['expanded'].split(','))
if 'autoderef' in args:
self.autoDerefPointers = int(args['autoderef'])
if 'dyntype' in args:
self.useDynamicType = int(args['dyntype'])
if 'fancy' in args:
self.useFancy = int(args['fancy'])
if 'passexceptions' in args:
self.passExceptions = int(args['passexceptions'])
if 'watchers' in args:
self.currentWatchers = args['watchers']
if 'typeformats' in args:
for f in args['typeformats'].split(','):
pos = f.find("=")
if pos != -1:
typeName = self.hexdecode(f[0:pos])
self.typeformats[typeName] = int(f[pos+1:])
if 'formats' in args:
for f in args['formats'].split(','):
pos = f.find("=")
if pos != -1:
self.formats[f[0:pos]] = int(f[pos+1:])
self.expandedINames = set(args.get('expanded', []))
self.autoDerefPointers = int(args.get('autoderef', '0'))
self.useDynamicType = int(args.get('dyntype', '0'))
self.useFancy = int(args.get('fancy', '0'))
self.passExceptions = int(args.get('passexceptions', '0'))
self.currentWatchers = args.get('watchers', {})
self.typeformats = args.get("typeformats", {})
self.formats = args.get("formats", {})
self.reportVariables(args)
def disassemble(self, args):
......
......@@ -4753,19 +4753,14 @@ void addGdbOptionPages(QList<IOptionsPage *> *opts)
opts->push_back(new GdbOptionsPage2());
}
void GdbEngine::updateLocalsPython(const UpdateParameters &params)
{
//m_pendingWatchRequests = 0;
m_pendingBreakpointRequests = 0;
m_processedNames.clear();
WatchHandler *handler = watchHandler();
DebuggerCommand cmd("showData");
cmd.arg("expanded", handler->expansionRequests());
cmd.arg("typeformats", handler->typeFormatRequests());
cmd.arg("formats", handler->individualFormatRequests());
watchHandler()->appendFormatRequests(&cmd);
cmd.arg("stringcutoff", action(MaximalStringLength)->value().toByteArray());
cmd.arg("displaystringlimit", action(DisplayStringLimit)->value().toByteArray());
......
......@@ -848,13 +848,9 @@ void LldbEngine::updateLocals()
void LldbEngine::doUpdateLocals(UpdateParameters params)
{
WatchHandler *handler = watchHandler();
DebuggerCommand cmd("updateData");
cmd.arg("nativeMixed", isNativeMixedActive());
cmd.arg("expanded", handler->expansionRequests());
cmd.arg("typeformats", handler->typeFormatRequests());
cmd.arg("formats", handler->individualFormatRequests());
watchHandler()->appendFormatRequests(&cmd);
const static bool alwaysVerbose = !qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty();
cmd.arg("passexceptions", alwaysVerbose);
......
......@@ -725,7 +725,7 @@ void PdbEngine::updateLocals()
options.chop(1);
postCommand("qdebug('" + options + "','"
+ handler->expansionRequests() + "','"
// + handler->expansionRequests() + "','"
+ handler->typeFormatRequests() + "','"
+ handler->individualFormatRequests() + "','"
+ watchers.toHex() + "')", CB(handleListLocals));
......
......@@ -1130,15 +1130,12 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
emit columnAdjustmentRequested();
}
void WatchItem::formatRequests(QByteArray *out) const
int WatchItem::requestedFormat() const
{
int format = theIndividualFormats.value(d.iname, AutomaticFormat);
if (format == AutomaticFormat)
format = theTypeFormats.value(stripForFormat(d.type), AutomaticFormat);
if (format != AutomaticFormat)
*out += d.iname + ":format=" + QByteArray::number(format) + ',';
foreach (const TreeItem *child, children())
static_cast<const WatchItem *>(child)->formatRequests(out);
return format;
}
void WatchItem::showInEditorHelper(QString *contents, int depth) const
......@@ -1639,22 +1636,6 @@ int WatchHandler::format(const QByteArray &iname) const
return result;
}
QByteArray WatchHandler::expansionRequests() const
{
QByteArray ba;
m_model->root()->formatRequests(&ba);
if (!m_model->m_expandedINames.isEmpty()) {
QSetIterator<QByteArray> jt(m_model->m_expandedINames);
while (jt.hasNext()) {
QByteArray iname = jt.next();
ba.append(iname);
ba.append(',');
}
ba.chop(1);
}
return ba;
}
QByteArray WatchHandler::typeFormatRequests() const
{
QByteArray ba;
......@@ -1695,6 +1676,39 @@ QByteArray WatchHandler::individualFormatRequests() const
return ba;
}
void WatchHandler::appendFormatRequests(DebuggerCommand *cmd)
{
cmd->beginList("expanded");
QSetIterator<QByteArray> jt(m_model->m_expandedINames);
while (jt.hasNext()) {
QByteArray iname = jt.next();
//WatchItem *item = m_model->findItem(iname);
cmd->arg(iname);
//cmd->arg("format", item->requestedFormat());
}
cmd->endList();
cmd->beginGroup("typeformats");
QHashIterator<QByteArray, int> it(theTypeFormats);
while (it.hasNext()) {
it.next();
const int format = it.value();
if (format >= RawFormat && format < ArtificialFormatBase)
cmd->arg(it.key(), format);
}
cmd->endGroup();
cmd->beginGroup("formats");
QHashIterator<QByteArray, int> it2(theIndividualFormats);
while (it2.hasNext()) {
it2.next();
const int format = it2.value();
if (format >= RawFormat && format < ArtificialFormatBase)
cmd->arg(it2.key(), format);
}
cmd->endGroup();
}
void WatchHandler::addDumpers(const GdbMi &dumpers)
{
foreach (const GdbMi &dumper, dumpers.children()) {
......
......@@ -41,6 +41,7 @@
namespace Debugger {
namespace Internal {
class DebuggerCommand;
class SeparatedView;
class WatchModel;
......@@ -74,7 +75,7 @@ public:
int editType() const;
QColor color() const;
void formatRequests(QByteArray *out) const;
int requestedFormat() const;
void showInEditorHelper(QString *contents, int depth) const;
WatchItem *findItem(const QByteArray &iname);
void parseWatchData(const GdbMi &input);
......@@ -211,7 +212,6 @@ public:
static QStringList watchedExpressions();
static QHash<QByteArray, int> watcherNames();
QByteArray expansionRequests() const;
QByteArray typeFormatRequests() const;
QByteArray individualFormatRequests() const;
......@@ -234,6 +234,7 @@ public:
void setCurrentItem(const QByteArray &iname);
void updateWatchersWindow();
void appendFormatRequests(DebuggerCommand *cmd);
void insertData(const WatchData &data); // Convenience.
void insertData(const QList<WatchData> &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