aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c
blob: 0b086a5af3df1062383dabd9c46e293ea2c97294 (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
25
26
27
28
29
30
31
32
33
34
/* CTF generation for functions with varargs or otherwise.

   In this testcase, it is expected to see one CTF_K_FUNCTION record with two
   function arguments.  The second function argument with a value of 0
   corresponds to the ellipsis.

   Example CTF section excerpt on x86_64 :

    .long   0x5     # ctt_name		    (name = format)
    .long   0x16000002      # ctt_info	    (CTF_K_FUNCTION with 2 arguments)
    .long   0x2     # ctt_size or ctt_type  (return typeID)
    .long   0x2     # dtu_argv		    (TypeID of the First argument)
    .long   0       # dtu_argv		    (TypeID of the second argument)
    .ascii "\0"     # ctf_string
    .ascii "int\0"  # ctf_string
    .ascii "format\0"       # ctf_string

    */

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

/* { dg-final { scan-assembler-times "\[\t \]0x16000002\[\t \]+\[^\n\]*ctt_info" 1 } } */
/* { dg-final { scan-assembler-times "dtu_argv" 2 } } */
/* { dg-final { scan-assembler-times "\[\t \]0\[\t \]+\[^\n\]*dtu_argv" 1 } } */

int foo (void);

int bar (int);

int * format (int * fmt, ...)
{
  return fmt;
}