Identify struct members present after directives

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

 



Hi,

Suppose there exists a struct foo such that:

=== test.c ===

struct foo {
  int a;
  int b;
#ifndef BAR
  int c;
#endif
  int d;
};

int
main (void)
{
  struct foo x;

  return 0;
}

=== END ===

I want to be able to find using a tool/parser if there exists a struct
member after the #ifndef BAR ... #endif directive.

If I use:

  $ gcc -g -c test.c
  $ readelf -w test.o

I am able to identify DW_TAG_members for a, b, and c. And when I use:

  $ gcc -DBAR -g -c test.c
  $ readelf -w test.o

I get the DW_TAG_member details only for a and c, and can tell the
difference. Is there any other way by which this can be checked?

Appreciate any inputs in this regard.

Thanks!

SK

-- 
Shakthi Kannan
http://www.shakthimaan.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