From: Steve Harris (slharris_at_tpd.usa.alcatel.com)
Date: Wed Aug 06 2003 - 22:04:18 BST
Hi! The following program and its field structure is compiled with gnu's g++ on a Sun running Solaris 2.8 and brought up by UPS 3.37. UPS expands the structure and displays all of the bit fields. Problems: Editing the first bit field of a byte will change the entire byte (edited field + next 7 bits). Editing any other bit proves futile as it will not change. Not only editing but if left to run in UPS, the program cannot seem to manipulate the bit fields without altering a byte at a time. Outside of UPS or in another debugger such as ddd, the bit fields are handled properly. The bit fields worked fine when compiled with gcc under Solaris 2.6 using UPS 3.3 something. Perhaps this has been addressed? I could not find any similar problems in the archives or a general search of the web. UPS bug? Do I need a special compiler option? Solaris 2.8 issue? Any ideas would be greatly appreciated! Thanks! Steve typedef struct { unsigned long bit_1 : 1; unsigned long bit_2 : 1; unsigned long bit_3 : 1; unsigned long bit_4 : 1; unsigned long bit_5 : 1; unsigned long bit_6 : 1; unsigned long bit_7 : 1; unsigned long bit_8 : 1; unsigned long bit_9 : 1; unsigned long bit_10 : 1; unsigned long bit_11 : 1; unsigned long bit_12 : 1; unsigned long bit_13 : 1; unsigned long bit_14 : 1; unsigned long bit_15 : 1; unsigned long bit_16 : 1; unsigned long bit_17 : 1; unsigned long bit_18 : 1; unsigned long bit_19 : 1; unsigned long bit_20 : 1; unsigned long bit_21 : 1; unsigned long bit_22 : 1; unsigned long bit_23 : 1; unsigned long bit_24 : 1; unsigned long bit_25 : 1; unsigned long bit_26 : 1; unsigned long bit_27 : 1; unsigned long bit_28 : 1; unsigned long bit_29 : 1; unsigned long bit_30 : 1; unsigned long bit_31 : 1; unsigned long bit_32 : 1; } BIT_STRUCTURE; int main () { BIT_STRUCTURE bit_structure; bit_structure.bit_1 = 0; bit_structure.bit_1 = 1; bit_structure.bit_2 = 0; bit_structure.bit_2 = 1; bit_structure.bit_3 = 0; bit_structure.bit_3 = 1; bit_structure.bit_4 = 0; bit_structure.bit_4 = 1; bit_structure.bit_9 = 0; bit_structure.bit_9 = 1; }
This archive was generated by hypermail 2.1.4 : Fri Aug 08 2003 - 11:25:34 BST