Variable Debug View Errors

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Variable Debug View Errors

Jump to solution
1,968 Views
Toe
Contributor IV

I have a structure with a few layers and it seems that the debugger has a difficult time showing the memory at specific structure members.  Is it a problem with viewing unions?  Any thoughts?

15032_15032.pngkds_var_view.png

The error that runs off the screen is "Type struct{...} has no component named floats.  Unable to create variable object".

 

It can obviously parse it at some level since you can see all of the data in the "details" below.

Labels (1)
0 Kudos
1 Solution
1,717 Views
BlackNight
NXP Employee
NXP Employee

Did some digging, and this seems to be a generic GDB problem. I see it in other GDB IDE's too.

typedef struct {

  union {

    int i[16];

    char c[32];

  } a;

} U;

It fails for for named unions (name 'a' above) with arrays in it. it works if I use anyonmous unions like this:

typedef struct {

  union {

    int i[16];

    char c[32];

  };

} U;

I don't know if that workaround will help you. It would be to use anonymouse unions like this:

typedef struct {

    union {

        float calDatafloats[38];

        uint32 calDatalongs[38];

        uint16 calDatawords[76];

        uint8 calDatabytes[152];

    } ;

    union {

        float usrDatafloats[38];

        uint32 usrDatalongs[38];

        uint16 usrDatawords[76];

        uint8 usrDatabytes[152];

    } ;

    union {

        float netDatafloats[35];

        uint32 netDatalongs[35];

        uint16 netDatawords[70];

        uint8 netDatabytes[140];

    } ;

    float version;

    uint8 state;

    uint8 dataType;

    uint8 hasUsrData;  // both user and net data were downloaded

    uint8 pad[3];

    uint16 crc;

} TRG_DATA_TYPE;

Erich

View solution in original post

0 Kudos
5 Replies
1,717 Views
BlackNight
NXP Employee
NXP Employee

Hi Ryan,

would it be possible to post that data structure typedef so I can try to reproduce it?

Thanks,

Erich

0 Kudos
1,717 Views
Toe
Contributor IV

No problem:

#pragma options align=packed

typedef struct {

    union {

        float floats[38];

        uint32 longs[38];

        uint16 words[76];

        uint8 bytes[152];

    } calData;

    union {

        float floats[38];

        uint32 longs[38];

        uint16 words[76];

        uint8 bytes[152];

    } usrData;

    union {

        float floats[35];

        uint32 longs[35];

        uint16 words[70];

        uint8 bytes[140];

    } netData;

    float version;

    uint8 state;

    uint8 dataType;

    uint8 hasUsrData;  // both user and net data were downloaded

    uint8 pad[3];

    uint16 crc;

} TRG_DATA_TYPE;

#pragma options align=reset

And the data types are pretty standard:

typedef unsigned char           uint8;

typedef unsigned short int      uint16;

typedef unsigned long int       uint32;

0 Kudos
1,717 Views
BlackNight
NXP Employee
NXP Employee

thanks for sharing. I confirm that I'm able to reproduce the problem. I see what I can find out.

0 Kudos
1,718 Views
BlackNight
NXP Employee
NXP Employee

Did some digging, and this seems to be a generic GDB problem. I see it in other GDB IDE's too.

typedef struct {

  union {

    int i[16];

    char c[32];

  } a;

} U;

It fails for for named unions (name 'a' above) with arrays in it. it works if I use anyonmous unions like this:

typedef struct {

  union {

    int i[16];

    char c[32];

  };

} U;

I don't know if that workaround will help you. It would be to use anonymouse unions like this:

typedef struct {

    union {

        float calDatafloats[38];

        uint32 calDatalongs[38];

        uint16 calDatawords[76];

        uint8 calDatabytes[152];

    } ;

    union {

        float usrDatafloats[38];

        uint32 usrDatalongs[38];

        uint16 usrDatawords[76];

        uint8 usrDatabytes[152];

    } ;

    union {

        float netDatafloats[35];

        uint32 netDatalongs[35];

        uint16 netDatawords[70];

        uint8 netDatabytes[140];

    } ;

    float version;

    uint8 state;

    uint8 dataType;

    uint8 hasUsrData;  // both user and net data were downloaded

    uint8 pad[3];

    uint16 crc;

} TRG_DATA_TYPE;

Erich

0 Kudos
1,719 Views
Toe
Contributor IV

I have no problem with that suggestion.  Thanks for looking into it!

0 Kudos