summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-05-27 22:35:54 +0200
committerhjk <hjk121@nokiamail.com>2014-05-28 15:07:59 +0200
commit252048ef01347d3061dcdfc8db54ec21c045d801 (patch)
tree45bc55a1525d46001b8e6a8d70c3800a59413e47
parent8eee847654ecaae0e57d23939f9cad6faefb82ee (diff)
downloadqt-creator-252048ef01347d3061dcdfc8db54ec21c045d801.tar.gz
Debugger: Make char * displayable in separate windows
Task-number: QTCREATORBUG-7313 Change-Id: I8d475dd94a48e7a1d5efe4c2c0d90cb6bdf9b3e2 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
-rw-r--r--share/qtcreator/debugger/dumper.py26
-rw-r--r--share/qtcreator/debugger/gdbbridge.py8
-rw-r--r--share/qtcreator/debugger/lldbbridge.py11
-rw-r--r--src/plugins/debugger/watchdata.cpp3
-rw-r--r--src/plugins/debugger/watchhandler.cpp4
-rw-r--r--src/plugins/debugger/watchhandler.h3
6 files changed, 39 insertions, 16 deletions
diff --git a/share/qtcreator/debugger/dumper.py b/share/qtcreator/debugger/dumper.py
index 881f4c5ec2..86b8a263fe 100644
--- a/share/qtcreator/debugger/dumper.py
+++ b/share/qtcreator/debugger/dumper.py
@@ -53,8 +53,10 @@ Ucs4StringFormat, \
Array10Format, \
Array100Format, \
Array1000Format, \
-Array10000Format \
- = range(100, 110)
+Array10000Format, \
+SeparateLatin1StringFormat, \
+SeparateUtf8StringFormat \
+ = range(100, 112)
def hasPlot():
fileName = "/usr/bin/gnuplot"
@@ -781,6 +783,14 @@ class DumperBase:
self.put('",')
return True
+ def putDisplay(self, format, value = None, cmd = None):
+ self.put('editformat="%s",' % format)
+ if cmd is None:
+ if not value is None:
+ self.put('editvalue="%s",' % value)
+ else:
+ self.put('editvalue="%s|%s",' % (cmd, value))
+
def putFormattedPointer(self, value):
#warn("POINTER: %s" % value)
if self.isNull(value):
@@ -832,20 +842,24 @@ class DumperBase:
self.putItem(value.dereference())
return
- if format == Latin1StringFormat:
+ if format == Latin1StringFormat or format == SeparateLatin1StringFormat:
# Explicitly requested Latin1 formatting.
+ limit = self.displayStringLimit if format == Latin1StringFormat else 1000000
self.putType(typeName)
- (elided, data) = self.encodeCArray(value, "unsigned char", self.displayStringLimit)
+ (elided, data) = self.encodeCArray(value, "unsigned char", limit)
self.putValue(data, Hex2EncodedLatin1, elided=elided)
self.putNumChild(0)
+ self.putDisplay((StopDisplay if format == Latin1StringFormat else DisplayLatin1String), data)
return
- if format == Utf8StringFormat:
+ if format == Utf8StringFormat or format == SeparateUtf8StringFormat:
# Explicitly requested UTF-8 formatting.
+ limit = self.displayStringLimit if format == Utf8StringFormat else 1000000
self.putType(typeName)
- (elided, data) = self.encodeCArray(value, "unsigned char", self.displayStringLimit)
+ (elided, data) = self.encodeCArray(value, "unsigned char", limit)
self.putValue(data, Hex2EncodedUtf8, elided=elided)
self.putNumChild(0)
+ self.putDisplay((StopDisplay if format == Utf8StringFormat else DisplayUtf8String), data)
return
if format == Local8BitStringFormat:
diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py
index 24922b99e8..393ffcf759 100644
--- a/share/qtcreator/debugger/gdbbridge.py
+++ b/share/qtcreator/debugger/gdbbridge.py
@@ -904,14 +904,6 @@ class Dumper(DumperBase):
self.putValue("0x%x" % value.cast(
self.lookupType("unsigned long")), None, -1)
- def putDisplay(self, format, value = None, cmd = None):
- self.put('editformat="%s",' % format)
- if cmd is None:
- if not value is None:
- self.put('editvalue="%s",' % value)
- else:
- self.put('editvalue="%s|%s",' % (cmd, value))
-
def isExpandedSubItem(self, component):
iname = "%s.%s" % (self.currentIName, component)
#warn("IS EXPANDED: %s in %s" % (iname, self.expandedINames))
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py
index efab1358c7..3c9a8bd964 100644
--- a/share/qtcreator/debugger/lldbbridge.py
+++ b/share/qtcreator/debugger/lldbbridge.py
@@ -1551,6 +1551,17 @@ class Dumper(DumperBase):
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.reportVariables(args)
def disassemble(self, args):
diff --git a/src/plugins/debugger/watchdata.cpp b/src/plugins/debugger/watchdata.cpp
index 1fa786dd77..dc6ccfdb36 100644
--- a/src/plugins/debugger/watchdata.cpp
+++ b/src/plugins/debugger/watchdata.cpp
@@ -619,8 +619,7 @@ void parseWatchData(const QSet<QByteArray> &expandedINames,
data.editvalue = mi.data();
mi = item["editformat"];
- if (mi.isValid())
- data.editformat = mi.toInt();
+ data.editformat = mi.toInt();
mi = item["typeformats"];
if (mi.isValid())
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 8371d6ea7b..0e8f16bd72 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -1262,6 +1262,8 @@ QString WatchModel::nameForFormat(int format)
case Array100Format: return msgArrayFormat(100);
case Array1000Format: return msgArrayFormat(1000);
case Array10000Format: return msgArrayFormat(10000);
+ case SeparateLatin1StringFormat: return tr("Latin1 String in Separate Window");
+ case SeparateUtf8StringFormat: return tr("UTF-8 String in Separate Window");
case DecimalIntegerFormat: return tr("Decimal Integer");
case HexadecimalIntegerFormat: return tr("Hexadecimal Integer");
case BinaryIntegerFormat: return tr("Binary Integer");
@@ -1296,7 +1298,9 @@ TypeFormatList WatchModel::typeFormatList(const WatchData &data) const
if (data.origaddr || isPointerType(data.type)) {
formats.append(RawFormat);
formats.append(Latin1StringFormat);
+ formats.append(SeparateLatin1StringFormat);
formats.append(Utf8StringFormat);
+ formats.append(SeparateUtf8StringFormat);
formats.append(Local8BitStringFormat);
formats.append(Utf16StringFormat);
formats.append(Ucs4StringFormat);
diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h
index 3f446102ef..364aaa5c3f 100644
--- a/src/plugins/debugger/watchhandler.h
+++ b/src/plugins/debugger/watchhandler.h
@@ -62,6 +62,9 @@ enum DisplayFormat
Array1000Format,
Array10000Format,
+ SeparateLatin1StringFormat,
+ SeparateUtf8StringFormat,
+
// Values above 200 refer to format solely handled in the WatchHandler code
ArtificialFormatBase = 200,