forked from acmel/dwarves
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dtagnames.c
55 lines (45 loc) · 1.16 KB
/
dtagnames.c
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
SPDX-License-Identifier: GPL-2.0-only
Copyright (C) 2006 Mandriva Conectiva S.A.
Copyright (C) 2006 Arnaldo Carvalho de Melo <[email protected]>
*/
#include <stdio.h>
#include <stdlib.h>
#include "dwarves.h"
#include "dutil.h"
static int class__tag_name(struct tag *tag, struct cu *cu __maybe_unused,
void *cookie __maybe_unused)
{
puts(dwarf_tag_name(tag->tag));
return 0;
}
static int cu__dump_class_tag_names(struct cu *cu, void *cookie __maybe_unused)
{
cu__for_all_tags(cu, class__tag_name, NULL);
return 0;
}
static void cus__dump_class_tag_names(struct cus *cus)
{
cus__for_each_cu(cus, cu__dump_class_tag_names, NULL, NULL);
}
int main(int argc __maybe_unused, char *argv[])
{
int err, rc = EXIT_FAILURE;
struct cus *cus = cus__new();
if (dwarves__init() || cus == NULL) {
fputs("dtagnames: insufficient memory\n", stderr);
goto out;
}
dwarves__resolve_cacheline_size(NULL, 0);
err = cus__load_files(cus, NULL, argv + 1);
if (err != 0) {
cus__fprintf_load_files_err(cus, "dtagnames", argv + 1, err, stderr);
goto out;
}
cus__dump_class_tag_names(cus);
rc = EXIT_SUCCESS;
out:
cus__delete(cus);
dwarves__exit();
return rc;
}