Em Tue, Oct 15, 2019 at 09:38:28PM -0700, Charles Machalow escreveu: > Hello all, > > I've built Pahole 1.15 from source on WSL Ubuntu. Though I have is a > very simple example of a C struct that doesn't seem to work correctly > if compiled as C++ via g++, though works fine when compiled as C via > gcc. > > Is Pahole intended to work with code compiled as C++ (as opposed to > C)? If so, take a look at the simple test.c file (can be compiled via It should work with C++ as well, albeit the support that is there was mostly in response to reports from users, notably from the guys at CERN's ATLAS project, long ago. > gcc or g++). Also take a look at the output from running pahole > against the created executable. via both g++/gcc builds It seems like > the nested struct is duplicated if compiled on C++. Does this seem > like a bug? I'll check, thanks for the report. - Arnaldo > In both cases, GCC is version 7.4.0. > > test.c: > #include <stdint.h> > > typedef struct _INNER { > long myLong; > } INNER; > > typedef struct _MY_STRUCT { > struct > { > char a; > int b; > uint64_t ccc; > uint8_t _8_1 : 1; > uint8_t _8_4 : 4; > uint8_t _8_3 : 3; > INNER i; > }; > > } MY_STRUCT; > > int main() > { > MY_STRUCT m; > return 0; > } > > pahole_g++: > csm10495@csm10495-desk:~$ g++ -g test.c && pahole a.out -q > struct _INNER { > long int myLong; > }; > struct _MY_STRUCT { > struct { > char a; > int b; > uint64_t ccc; > uint8_t _8_1:1; > uint8_t _8_4:4; > uint8_t _8_3:3; > INNER i; > }; > > struct { > char a; > int b; > uint64_t ccc; > uint8_t _8_1:1; > uint8_t _8_4:4; > uint8_t _8_3:3; > INNER i; > }; > }; > > pahole_gcc: > csm10495@csm10495-desk:~$ gcc -g test.c && pahole a.out -q > struct _INNER { > long int myLong; > }; > struct _MY_STRUCT { > struct { > char a; > int b; > uint64_t ccc; > uint8_t _8_1:1; > uint8_t _8_4:4; > uint8_t _8_3:3; > INNER i; > }; > }; > > > Thanks all. > > - Charlie Scott Machalow -- - Arnaldo