Variable Debug View Errors

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Variable Debug View Errors

跳至解决方案
3,929 次查看
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.

标签 (1)
0 项奖励
回复
1 解答
3,678 次查看
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 项奖励
回复
5 回复数
3,678 次查看
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 项奖励
回复
3,678 次查看
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 项奖励
回复
3,678 次查看
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 项奖励
回复
3,679 次查看
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 项奖励
回复
3,680 次查看
Toe
Contributor IV

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

0 项奖励
回复