Debugger watch - structure bitfield adresses and content

Comments

10 comments

  • Avatar
    Michael Johnson

    Try expanding the Address column - it will show the bitfield sizes.

    0
    Comment actions Permalink
  • Avatar
    Tomas Hamouz

    Hello,

    see attached screenshot. It seems the bitfield sizes are completely incorrect  - spare0 is 4 bits, the Size column reads 4 bytes. And bool types are all 0 bytes.

    Tomas

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Please supply definitions of

    t_cns_data
    t_time_short
    t_datim
    tDiveHandle
    t_mode

    is it a c or cpp file?

    0
    Comment actions Permalink
  • Avatar
    Tomas Hamouz

    Here you are

    The file is a C++ file.

    #define _packed  __attribute__((packed))

    typedef struct {
        double          cns;              
        t_datim         last_cns;    
    } _packed t_cns_data;   

    typedef uint16_t  t_time_short;   

    typedef uint32_t  t_datim;     

    typedef   uint32_t  tDiveHandle;

    typedef enum {
        MODE_SURFACE, 
        MODE_OC,          
        MODE_FREE, 
        MODE_CCR,   
    } _packed t_mode;

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Are you using clang or gcc?

    0
    Comment actions Permalink
  • Avatar
    Tomas Hamouz

    This issue is using clang.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Yes I can reproduce - thanks.

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    Can you see if this

    http://www.rowleydownload.co.uk/snapshots/arm_crossworks_v4_win_x64_setup.exe

    fixes it?

    0
    Comment actions Permalink
  • Avatar
    Tomas Hamouz

    Yes, it fixes the problem, thanks.

    There remains a small cosmetic problem, the Size column shows size of the base type, not the size of the bitfield.There is a discrepancy between size and address columns for bitfields, the Address and Size do not match.

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Michael Johnson

    That's the size of the underlying data type of the bitfield i.e. the data size the compiler will perform to load/store. Quite useful that it looks wrong/odd...

    If you want "spare0:4" to be byte sized then make it

    unsigned char spare0:4

    0
    Comment actions Permalink

Please sign in to leave a comment.