diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-11-01 15:24:17 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2018-11-08 15:12:10 +0000 |
commit | de32a631c3b80bb8d444e7c505eb7dc1a909a5af (patch) | |
tree | bebd7aae4051958f10cde76cef28a0695df58e78 | |
parent | 9b1e7e440a217f70d2cbd6df3582efcfc3e4d341 (diff) | |
download | qt-creator-de32a631c3b80bb8d444e7c505eb7dc1a909a5af.tar.gz |
[Debugger] Fix bitfield values to show up correctly using lldbengine
The bitpos value returned by lldb is the bit offset relative to the
beginning of the type, there is no need to do an extra modulus
operation.
Adjust dumper test to add the previously failing case.
The failing case happens when the class containing the bitfield has
more members in front of the bitfield.
Change-Id: I93678f78e6799843558ec53342a0ed49cac74f48
Reviewed-by: hjk <hjk@qt.io>
-rw-r--r-- | share/qtcreator/debugger/lldbbridge.py | 5 | ||||
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/share/qtcreator/debugger/lldbbridge.py b/share/qtcreator/debugger/lldbbridge.py index 70a682a1a9..3701a4c1ff 100644 --- a/share/qtcreator/debugger/lldbbridge.py +++ b/share/qtcreator/debugger/lldbbridge.py @@ -252,8 +252,9 @@ class Dumper(DumperBase): # Correction for some bitfields. Size 0 can occur for # types without debug information. if bitsize > 0: + pass #bitpos = bitpos % bitsize - bitpos = bitpos % 8 # Reported type is always wrapping type! + #bitpos = bitpos % 8 # Reported type is always wrapping type! fieldBits[f.name] = (bitsize, bitpos, f.IsBitfield()) # Normal members and non-empty base classes. @@ -269,7 +270,7 @@ class Dumper(DumperBase): (fieldBitsize, fieldBitpos, isBitfield) = fieldBits[fieldName] else: fieldBitsize = nativeFieldType.GetByteSize() * 8 - fieldBitpost = None + fieldBitpos = None isBitfield = False if isBitfield: # Bit fields diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index ea90617b02..b3754c90e5 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -5520,7 +5520,9 @@ void tst_Dumpers::dumper_data() "enum E { V1, V2 };" "struct S\n" "{\n" - " S() : x(2), y(3), z(39), e(V2), c(1), b(0), f(5), d(6), i(7) {}\n" + " S() : front(13), x(2), y(3), z(39), e(V2), c(1), b(0), f(5)," + " d(6), i(7) {}\n" + " unsigned int front;\n" " unsigned int x : 3;\n" " unsigned int y : 4;\n" " unsigned int z : 18;\n" @@ -5547,6 +5549,7 @@ void tst_Dumpers::dumper_data() + Check("s.x", "2", "unsigned int") % CdbEngine + Check("s.y", "3", "unsigned int") % CdbEngine + Check("s.z", "39", "unsigned int") % CdbEngine + + Check("s.front", "13", "unsigned int") + Check("s.e", "V2 (1)", TypePattern("main::[a-zA-Z0-9_]*::E")) % CdbEngine; |