O
omkar pangarkar
For a simple code as follows :
typedef enum {
apple,
banana,
grape
} fruit;
typedef unsigned short fruitkind;
when I have this in code :
fruitkind = apple;
and see the value through GDB while debugging, I get fruitkind = 0
(obviously). What if I want to print the symbol "apple" when I ask for
value of fruitkind. Is there some GDB trick/setting, to do so. This
will be very helpful with enums having large number of members. When
you have large number of predefined states, its represented with this
style and stored in shorts. These enum assigned variables (like
fruitkind) are used widely in code, making it difficult to understand
it when walking through a debugger. Is there any other way to achieve
this without using this style, so that its easy for debugging?
I am posting this on comp.lang.c, as some of you might have solved
this problem while working with C.
Thanks,
Omkarenator.
typedef enum {
apple,
banana,
grape
} fruit;
typedef unsigned short fruitkind;
when I have this in code :
fruitkind = apple;
and see the value through GDB while debugging, I get fruitkind = 0
(obviously). What if I want to print the symbol "apple" when I ask for
value of fruitkind. Is there some GDB trick/setting, to do so. This
will be very helpful with enums having large number of members. When
you have large number of predefined states, its represented with this
style and stored in shorts. These enum assigned variables (like
fruitkind) are used widely in code, making it difficult to understand
it when walking through a debugger. Is there any other way to achieve
this without using this style, so that its easy for debugging?
I am posting this on comp.lang.c, as some of you might have solved
this problem while working with C.
Thanks,
Omkarenator.