aboutsummaryrefslogtreecommitdiff
path: root/libctf/testsuite/libctf-lookup/multidim-array.c
blob: 790efc88c94176b8bc78008c66b3076653e58c51 (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
#include "config.h"
#include <ctf-api.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int
main (int argc, char *argv[])
{
  ctf_archive_t *ctf;
  ctf_dict_t *fp;
  int err;
  ctf_next_t *it = NULL;
  ctf_id_t type;

  if ((ctf = ctf_open (argv[1], NULL, &err)) == NULL)
    goto open_err;
  if ((fp = ctf_dict_open (ctf, NULL, &err)) == NULL)
    goto open_err;

  /* This is expected to fail with GCC prior to PR114186.  */
  while ((type = ctf_type_next (fp, &it, NULL, 1)) != -1)
    if (ctf_type_kind (fp, type) == CTF_K_ARRAY)
      printf ("%s\n", ctf_type_aname (fp, type));

  ctf_dict_close (fp);
  ctf_close (ctf);

  return 0;

open_err:
  fprintf (stderr, "%s: cannot open: %s\n", argv[0], ctf_errmsg (err));
  return 1;
}