I am debugging in the Eclipse CDT and am working with some opaque pointers. In order to see the value in memory the pointers point to I recast the opaque pointers to the real datatypes. eg. struct Chunk {...} ty开发者_运维百科pdef Chunk * Chunk_T
In eclipse I recast the Chunk_T back to Chunk * but it reset everytime I restart debugging. How can I maintain the variables as Chunk *?
I'm answering this myself. After looking around and asking about for quite awhile about this, it does not seem like there is an easy way of doing this in Eclipse.
A workaround would be to change the type of the variable you are debugging to the actual type you want to see everytime you debug. Same for arrays. If you don't specify in the code the actual size of the array, you will have to change it every time you debug. So the declaration of an array should be like this (stack allocated):
char temp[200];
You would have to change it back after debugging process.
I'm not sure if it works with constants. I think it does.
I don't know what happens if the array is dynamically allocated, either by using magic-numbers, constants, or an int variable for the size.
精彩评论