Changeset View
Changeset View
Standalone View
Standalone View
debuggers/lldb/controllers/variable.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 43 | { | |||
---|---|---|---|---|---|
44 | if (!topLevel() || varobj_.isEmpty()) { | 44 | if (!topLevel() || varobj_.isEmpty()) { | ||
45 | return; | 45 | return; | ||
46 | } | 46 | } | ||
47 | 47 | | |||
48 | if (!sessionIsAlive()) { | 48 | if (!sessionIsAlive()) { | ||
49 | return; | 49 | return; | ||
50 | } | 50 | } | ||
51 | 51 | | |||
52 | | ||||
53 | // update the value itself | 52 | // update the value itself | ||
54 | QPointer<LldbVariable> guarded_this(this); | 53 | QPointer<LldbVariable> guarded_this(this); | ||
55 | debugSession->addCommand(VarEvaluateExpression, varobj_, [guarded_this](const ResultRecord &r){ | 54 | debugSession->addCommand(VarEvaluateExpression, varobj_, [guarded_this](const ResultRecord &r){ | ||
56 | if (guarded_this && r.reason == "done" && r.hasField("value")) { | 55 | if (guarded_this && r.reason == "done" && r.hasField("value")) { | ||
57 | guarded_this->setValue(r["value"].literal()); | 56 | guarded_this->setValue(guarded_this->formatValue(r["value"].literal())); | ||
58 | } | 57 | } | ||
59 | }); | 58 | }); | ||
60 | 59 | | |||
61 | // update children | 60 | // update children | ||
62 | // remove all children first, this will cause some gliches in the UI, but there's no good way | 61 | // remove all children first, this will cause some gliches in the UI, but there's no good way | ||
63 | // that we can know if there's anything changed | 62 | // that we can know if there's anything changed | ||
64 | if (isExpanded()) { | 63 | if (isExpanded() || !childCount()) { | ||
65 | deleteChildren(); | 64 | deleteChildren(); | ||
66 | fetchMoreChildren(); | 65 | fetchMoreChildren(); | ||
67 | } | 66 | } | ||
68 | } | 67 | } | ||
69 | 68 | | |||
70 | void LldbVariable::handleRawUpdate(const ResultRecord& r) | 69 | void LldbVariable::handleRawUpdate(const ResultRecord& r) | ||
71 | { | 70 | { | ||
72 | qCDebug(DEBUGGERLLDB) << "handleRawUpdate for variable" << varobj(); | 71 | qCDebug(DEBUGGERLLDB) << "handleRawUpdate for variable" << varobj(); | ||
Show All 36 Lines | |||||
109 | { | 108 | { | ||
110 | // Data formatter emits value with unicode escape sequence for string and char, | 109 | // Data formatter emits value with unicode escape sequence for string and char, | ||
111 | // translate them back. | 110 | // translate them back. | ||
112 | // Only check with first char is enough, as unquote will do the rest check | 111 | // Only check with first char is enough, as unquote will do the rest check | ||
113 | if (value.startsWith('"')) { | 112 | if (value.startsWith('"')) { | ||
114 | return Utils::quote(Utils::unquote(value, true)); | 113 | return Utils::quote(Utils::unquote(value, true)); | ||
115 | } else if (value.startsWith('\'')) { | 114 | } else if (value.startsWith('\'')) { | ||
116 | return Utils::quote(Utils::unquote(value, true, '\''), '\''); | 115 | return Utils::quote(Utils::unquote(value, true, '\''), '\''); | ||
116 | } else if (value.startsWith('b')) { | ||||
117 | // this is a byte array, don't translate unicode, simply return without 'b' prefix | ||||
118 | return value.mid(1); | ||||
117 | } | 119 | } | ||
118 | return value; | 120 | return value; | ||
119 | } | 121 | } |