Commit 758e50fa authored by hjk's avatar hjk
Browse files

Debugger: Catch some exceptions related to optimized out values



These could be triggered by declared but undefined and unused
static data members.

Task-number: QTCREATORBUG-18030
Change-Id: I941e8cbe8ce18dca737e59472ed0ee19ace44072
Reviewed-by: David Schulz's avatarDavid Schulz <david.schulz@qt.io>
parent 893d4407
......@@ -264,7 +264,10 @@ class Dumper(DumperBase):
y = nativeValue.cast(chars.array(0, int(nativeType.sizeof - 1)))
buf = bytearray(struct.pack('x' * size))
for i in range(size):
buf[i] = int(y[i])
try:
buf[i] = int(y[i])
except:
pass
val.ldata = bytes(buf)
val.type = self.fromNativeType(nativeType)
......
......@@ -6706,6 +6706,13 @@ void tst_Dumpers::dumper_data()
+ Check("tc.2.bar", "15", "int")
+ Check("tc.3.bar", "15", "int");
QTest::newRow("UndefinedStaticMembers")
<< Data("struct Foo { int a = 15; static int b; }; \n",
"Foo f; unused(&f);\n")
+ Check("f.a", "15", "int")
+ Check("f.b", "<optimized out>", "") % NoCdbEngine
+ Check("f.b", "", "<Value unavailable error>") % CdbEngine;
QTest::newRow("ArrayOfFunctionPointers")
<< Data("typedef int (*FP)(int *); \n"
"int func(int *param) { unused(param); return 0; } \n",
......
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