From 7f6c793f756042b801aba321dcfc946560a4700a Mon Sep 17 00:00:00 2001 From: hjk <hjk121@nokiamail.com> Date: Sun, 17 Nov 2013 18:24:25 +0100 Subject: [PATCH] Debugger: Fix passing of maximum string length Change-Id: I96498b93bb1632de8ca960ae24ec54e31f8c0897 Reviewed-by: hjk <hjk121@nokiamail.com> --- share/qtcreator/debugger/gdbbridge.py | 2 ++ src/plugins/debugger/gdb/gdbengine.cpp | 4 ---- src/plugins/debugger/gdb/pythongdbengine.cpp | 6 +++++- tests/manual/debugger/simple/simple_test_app.cpp | 13 +++++++++++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/share/qtcreator/debugger/gdbbridge.py b/share/qtcreator/debugger/gdbbridge.py index c7270045e6a..4fb782d8fa1 100644 --- a/share/qtcreator/debugger/gdbbridge.py +++ b/share/qtcreator/debugger/gdbbridge.py @@ -492,6 +492,8 @@ class Dumper(DumperBase): resultVarName = arg[pos:] elif arg.startswith("expanded:"): self.expandedINames = set(arg[pos:].split(",")) + elif arg.startswith("stringcutoff:"): + self.stringCutOff = int(arg[pos:]) elif arg.startswith("typeformats:"): for f in arg[pos:].split(","): pos = f.find("=") diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 05978ecbc14..ae83e0801f1 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -1829,10 +1829,6 @@ void GdbEngine::handlePythonSetup(const GdbResponse &response) postCommand("bbsetup"); } - postCommand("python qqStringCutOff = " - + debuggerCore()->action(MaximalStringLength)->value().toByteArray(), - ConsoleCommand|NonCriticalResponse); - m_hasPython = true; GdbMi data; data.fromStringMultiple(response.consoleStreamOutput); diff --git a/src/plugins/debugger/gdb/pythongdbengine.cpp b/src/plugins/debugger/gdb/pythongdbengine.cpp index 1c79150c40d..3fd1283799f 100644 --- a/src/plugins/debugger/gdb/pythongdbengine.cpp +++ b/src/plugins/debugger/gdb/pythongdbengine.cpp @@ -37,6 +37,7 @@ #include <debugger/stackhandler.h> +#include <utils/savedaction.h> #include <utils/qtcassert.h> #define PRECONDITION QTC_CHECK(hasPython()) @@ -58,6 +59,9 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) expanded += "typeformats:" + handler->typeFormatRequests() + ' '; expanded += "formats:" + handler->individualFormatRequests(); + QByteArray cutOff = " stringcutoff:" + + debuggerCore()->action(MaximalStringLength)->value().toByteArray(); + QByteArray watchers; const QString fileName = stackHandler()->currentFrame().file; const QString function = stackHandler()->currentFrame().function; @@ -127,7 +131,7 @@ void GdbEngine::updateLocalsPython(const UpdateParameters ¶ms) resultVar = "resultvarname:" + m_resultVarName + ' '; postCommand("bb options:" + options + " vars:" + params.varList + ' ' - + resultVar + expanded + " watchers:" + watchers.toHex(), + + resultVar + expanded + " watchers:" + watchers.toHex() + cutOff, Discardable, CB(handleStackFramePython), QVariant(params.tryPartial)); } diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 88facd246c8..8259122f88d 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -3748,6 +3748,18 @@ namespace qstring { dummyStatement(&str, &string, pstring); } + void testQString4() + { + QString str; + for (int i = 0; i < 1000000; ++i) + str += QString::fromLatin1("%1 ").arg(i); + BREAK_HERE; + BREAK_HERE; + BREAK_HERE; + BREAK_HERE; + dummyStatement(&str); + } + void testQStringRef() { QString str = "Hello"; @@ -3763,6 +3775,7 @@ namespace qstring { testQString1(); testQString2(); testQString3(); + testQString4(); testQStringRef(); testQStringQuotes(); } -- GitLab