Topic : Debug bug with unions

Forum : 8051

Original Post
Post Information Post
July 10, 2007 - 10:28pm
Guest

There appears to be a bug with the XDATA display, incorrectly decoding unions when reporting variable names (in the grey text box, bottom right).

I have a structure declared as

typedef unsigned char DISCSECTOR[512];
typedef union {
struct{
struct FlashHeader header;
unsigned int rLBA[CLUSTERS+1];
unsigned char Freespace;
}Block0;
DISCSECTOR DiscSectors[CLUSTERS+1];
} FLASHPAGE;

xdata at 0x8000 FLASHPAGE FlashSector;

This is a header of a flash disk page. It compiles correctly, and does what it should.
The Block0 structure is 84h bytes long and therefore resides entirely within the first of the DISCSECTOR arrays.

Using the RIDE debugger and displaying the XDATA window, if I click on address 8084h it indicates in the bottom of that window that I am at FlashSector.Block0.Freespace. (Where ... represents the name of the instance.) That is correct. But if I click on 8085h it says I am at FlashSector.DiscSectors, and 8086h is describes as FlashSector.DiscSectors[0][1].

This is obviously wrong, it is decoding the addresses as if the union were a struct.

Doing Inspect shows the addresses correctly, showing FlashSector.DiscSectors based at 8000h, where is certainly is. However it confusingly describes it as "unsigned char[512][64]" when it is actually declared as unsigned char[64][512], but nonetheless correctly displays FlashSector.DiscSectors[1][0] at 8200h

Tim Jackson

Replies
Post Information Post
+1
0
-1
July 11, 2007 - 10:41am
Guest

Thanks for the report. We will fix the "type display" in the debugger.
Francis