Prep 1.29
[dwarves.git] / dtagnames.c
blob8bec2cd0e4574ff1c762b70056362cb2435421ad
1 /*
2 SPDX-License-Identifier: GPL-2.0-only
4 Copyright (C) 2006 Mandriva Conectiva S.A.
5 Copyright (C) 2006 Arnaldo Carvalho de Melo <acme@mandriva.com>
6 */
8 #include <stdio.h>
9 #include <stdlib.h>
11 #include "dwarves.h"
12 #include "dutil.h"
14 static struct conf_fprintf conf;
16 static struct conf_load conf_load = {
17 .conf_fprintf = &conf,
20 static int class__tag_name(struct tag *tag, struct cu *cu __maybe_unused,
21 void *cookie __maybe_unused)
23 puts(dwarf_tag_name(tag->tag));
24 return 0;
27 static int cu__dump_class_tag_names(struct cu *cu, void *cookie __maybe_unused)
29 cu__for_all_tags(cu, class__tag_name, NULL);
30 return 0;
33 static void cus__dump_class_tag_names(struct cus *cus)
35 cus__for_each_cu(cus, cu__dump_class_tag_names, NULL, NULL);
38 int main(int argc __maybe_unused, char *argv[])
40 int err, rc = EXIT_FAILURE;
41 struct cus *cus = cus__new();
43 if (dwarves__init() || cus == NULL) {
44 fputs("dtagnames: insufficient memory\n", stderr);
45 goto out;
47 dwarves__resolve_cacheline_size(NULL, 0);
49 err = cus__load_files(cus, &conf_load, argv + 1);
50 if (err != 0) {
51 cus__fprintf_load_files_err(cus, "dtagnames", argv + 1, err, stderr);
52 goto out;
55 cus__dump_class_tag_names(cus);
56 rc = EXIT_SUCCESS;
57 out:
58 cus__delete(cus);
59 dwarves__exit();
60 return rc;