aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/btf/btf-anonymous-struct-1.c
blob: 05996fe195adea76a4fbd8d3f1f2cfeb8f0e8cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Test BTF generation of anonymous struct.

   We expect two BTF struct records:
   - struct foo, with two fields "a" and "bar"
   - struct <anonymous> with one field "b"

   The anonymous struct should have a name of 0, pointing to the null string
   at the start of the string table.  */

/* { dg-do compile } */
/* { dg-options "-O0 -gbtf -dA" } */

/* Struct type with 2 members (struct foo).  */
/* { dg-final { scan-assembler-times " BTF_KIND_STRUCT 'foo'" 1 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x4000002\[\t \]+\[^\n\]*btt_info" 1 } } */
/* Struct type with 1 member (anon struct).  */
/* { dg-final { scan-assembler-times " BTF_KIND_STRUCT ''" 1 } } */
/* { dg-final { scan-assembler-times "\[\t \]0x4000001\[\t \]+\[^\n\]*btt_info" 1 } } */

struct foo
{
  int a;
  struct { int b; } bar;
} myfoo;