forked from qt-creator/qt-creator
When adding expressions for bitfield members in the debugger's expression view, their corresponding 'gdb.Value' does not expose the fact that those are actually bitfields, so e.g. an 'int : 3' is exposed like a "normal" 'int'. Previously, this would result in wrong values being retrieved in the 'DumperBase::Value::integer()' function, when trying to read the value from the corresponding memory address. To avoid this, retrieve the actual int representation for numeric values from the corresponding native 'gdb.Value', remember them and return that one, similar to how it is already done for known bitfield members (s. 'Dumper::memberFromNativeFieldAndValue'). The conversion from the 'gdb.Value' does not work for integers of a size larger than 64 bits (like '__int128' used in the "Int128" dumper test). Therefore, just ignore conversion failures and don't remember any value explicitly for those cases, so the same handling as previously used is applied. (At a quick glance, the reason seems to be that this is because GDB's corresponding functions use 'int64' as a return value of the relevant functions [1] [2], but I did not look closer into what GDB does internally.) Corresponding tests will be added in a separate commit. [1] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdbsupport/common-types.h;h=f5b2f3d249177acea77231c21c5601f959c18d2f;hb=f3034e25fa98d44b775970f40c9ec85eeae096e6#l33 [2] https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/python/py-value.c;h=6e29284aad11ff344789152a4f601b3474d86bb5;hb=f3034e25fa98d44b775970f40c9ec85eeae096e6#l1706 Fixes: QTCREATORBUG-24693 Change-Id: Idfc3390115e8796f3c778070c23424c3dbdfeddd Reviewed-by: hjk <hjk@qt.io>
58 KiB
58 KiB