forked from qt-creator/qt-creator
Debugger: Robustify QRegExp dumper
The capturesTexts cache may or may not be warm, and we may or may not be able to warm it. Make the dumper work in as much cases as possible. Change-Id: I9d9e0ec0c6a1bcf7288352c2834fedd42071d068 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1062,7 +1062,11 @@ def qdump__QRegExp(d, value):
|
|||||||
d.putNumChild(1)
|
d.putNumChild(1)
|
||||||
if d.isExpanded():
|
if d.isExpanded():
|
||||||
with Children(d):
|
with Children(d):
|
||||||
d.call('void', value, 'capturedTexts') # Warm up internal cache.
|
try:
|
||||||
|
d.call('void', value, 'capturedTexts') # Warm up internal cache.
|
||||||
|
except:
|
||||||
|
# Might fail (LLDB, Core files, ...), still cache might be warm.
|
||||||
|
pass
|
||||||
(patternSyntax, caseSensitive, minimal, pad, t, captures) \
|
(patternSyntax, caseSensitive, minimal, pad, t, captures) \
|
||||||
= d.split('{int}{int}B@{QString}{QStringList}', privAddress + 2 * d.ptrSize())
|
= d.split('{int}{int}B@{QString}{QStringList}', privAddress + 2 * d.ptrSize())
|
||||||
d.putSubItem('syntax', patternSyntax.cast(d.qtNamespace() + 'QRegExp::PatternSyntax'))
|
d.putSubItem('syntax', patternSyntax.cast(d.qtNamespace() + 'QRegExp::PatternSyntax'))
|
||||||
|
|||||||
@@ -2748,12 +2748,14 @@ void tst_Dumpers::dumper_data()
|
|||||||
|
|
||||||
|
|
||||||
QTest::newRow("QRegExp")
|
QTest::newRow("QRegExp")
|
||||||
<< Data("#include <QRegExp>\n",
|
<< Data("#include <QRegExp>\n"
|
||||||
|
"#include <QStringList>\n",
|
||||||
"QRegExp re(QString(\"a(.*)b(.*)c\"));\n"
|
"QRegExp re(QString(\"a(.*)b(.*)c\"));\n"
|
||||||
"QString str1 = \"a1121b344c\";\n"
|
"QString str1 = \"a1121b344c\";\n"
|
||||||
"QString str2 = \"Xa1121b344c\";\n"
|
"QString str2 = \"Xa1121b344c\";\n"
|
||||||
"int pos1 = re.indexIn(str1); unused(&pos1);\n"
|
"int pos1 = re.indexIn(str1); unused(&pos1);\n"
|
||||||
"int pos2 = re.indexIn(str2); unused(&pos2);\n")
|
"int pos2 = re.indexIn(str2); unused(&pos2);\n"
|
||||||
|
"QStringList caps = re.capturedTexts(); unused(&caps);\n")
|
||||||
+ CoreProfile()
|
+ CoreProfile()
|
||||||
+ UseDebugImage()
|
+ UseDebugImage()
|
||||||
+ Check("re", "\"a(.*)b(.*)c\"", "@QRegExp")
|
+ Check("re", "\"a(.*)b(.*)c\"", "@QRegExp")
|
||||||
@@ -2762,7 +2764,8 @@ void tst_Dumpers::dumper_data()
|
|||||||
+ Check("re.captures.2", "[2]", "\"344\"", "@QString")
|
+ Check("re.captures.2", "[2]", "\"344\"", "@QString")
|
||||||
+ Check("str2", "\"Xa1121b344c\"", "@QString")
|
+ Check("str2", "\"Xa1121b344c\"", "@QString")
|
||||||
+ Check("pos1", "0", "int")
|
+ Check("pos1", "0", "int")
|
||||||
+ Check("pos2", "1", "int");
|
+ Check("pos2", "1", "int")
|
||||||
|
+ Check("caps", "<3 items>", "@QStringList");
|
||||||
|
|
||||||
|
|
||||||
QTest::newRow("QRect")
|
QTest::newRow("QRect")
|
||||||
|
|||||||
Reference in New Issue
Block a user