Re: gdb support for unnamed union/structure fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




--- Mathew Spencer <mvyacc1029@xxxxxxxxx> wrote:

> Yes, the code was compiled with "-g" option, but when
> I dump foo structure in gdb, gdb only prints values of
> "int a; int d", but not "int b; int c" which happen to
> be inside unnamed structure.
> 

It prints for me. My gdb version is 

GNU gdb Red Hat Linux (6.3.0.0-1.122rh)

#include<stdio.h>

typedef struct {
       int a;
       struct {
         int b;
         int c;
       };
       int d;
 } foo;

main()
{
foo amit;
amit.a = 10;
printf("amit.a = %d\n", amit.a);
printf("amit.b = %d\n", amit.b);
}


(gdb) p amit
$1 = {a = 10, {b = -1074995640, c = 134513646}, d = 1279667776}


Regards,
Amit Choudhary


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux