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?
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.
Solved! Go to Solution.
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
Hi Ryan,
would it be possible to post that data structure typedef so I can try to reproduce it?
Thanks,
Erich
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;
thanks for sharing. I confirm that I'm able to reproduce the problem. I see what I can find out.
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
I have no problem with that suggestion. Thanks for looking into it!