2009-03-14 17:50:36 +01:00
|
|
|
/*
|
2019-01-15 18:28:24 +01:00
|
|
|
SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
|
2006-12-28 17:03:42 +01:00
|
|
|
Copyright (C) 2006 Mandriva Conectiva S.A.
|
|
|
|
Copyright (C) 2006 Arnaldo Carvalho de Melo <acme@mandriva.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
|
2007-01-11 19:07:05 +01:00
|
|
|
#include "dwarves.h"
|
2007-12-16 17:47:59 +01:00
|
|
|
#include "dutil.h"
|
2006-12-28 17:03:42 +01:00
|
|
|
|
|
|
|
static void print_malloc_stats(void)
|
|
|
|
{
|
|
|
|
struct mallinfo m = mallinfo();
|
|
|
|
|
|
|
|
fprintf(stderr, "size: %u\n", m.uordblks);
|
|
|
|
}
|
|
|
|
|
2012-08-17 23:47:15 +02:00
|
|
|
static int class__tag_name(struct tag *tag, struct cu *cu __unused,
|
2007-01-29 13:42:03 +01:00
|
|
|
void *cookie __unused)
|
2006-12-28 17:03:42 +01:00
|
|
|
{
|
2012-08-17 23:47:15 +02:00
|
|
|
puts(dwarf_tag_name(tag->tag));
|
2006-12-28 17:03:42 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-17 23:47:15 +02:00
|
|
|
static int cu__dump_class_tag_names(struct cu *cu, void *cookie __unused)
|
2006-12-28 17:03:42 +01:00
|
|
|
{
|
2012-08-17 23:47:15 +02:00
|
|
|
cu__for_all_tags(cu, class__tag_name, NULL);
|
2006-12-28 17:03:42 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-17 23:47:15 +02:00
|
|
|
static void cus__dump_class_tag_names(struct cus *cus)
|
2006-12-28 17:03:42 +01:00
|
|
|
{
|
2012-08-17 23:47:15 +02:00
|
|
|
cus__for_each_cu(cus, cu__dump_class_tag_names, NULL, NULL);
|
2006-12-28 17:03:42 +01:00
|
|
|
}
|
|
|
|
|
2009-02-10 00:43:56 +01:00
|
|
|
int main(int argc __unused, char *argv[])
|
2006-12-28 17:03:42 +01:00
|
|
|
{
|
2009-03-11 16:31:17 +01:00
|
|
|
int err, rc = EXIT_FAILURE;
|
2008-10-01 17:47:42 +02:00
|
|
|
struct cus *cus = cus__new();
|
2006-12-28 17:03:42 +01:00
|
|
|
|
2008-10-02 19:34:42 +02:00
|
|
|
if (dwarves__init(0) || cus == NULL) {
|
2006-12-28 17:03:42 +01:00
|
|
|
fputs("dtagnames: insufficient memory\n", stderr);
|
2009-03-11 16:31:17 +01:00
|
|
|
goto out;
|
2006-12-28 17:03:42 +01:00
|
|
|
}
|
|
|
|
|
2009-03-13 14:49:01 +01:00
|
|
|
err = cus__load_files(cus, NULL, argv + 1);
|
2016-03-15 18:29:57 +01:00
|
|
|
if (err != 0) {
|
|
|
|
cus__fprintf_load_files_err(cus, "dtagnames", argv + 1, err, stderr);
|
2009-03-11 16:31:17 +01:00
|
|
|
goto out;
|
2016-03-15 18:29:57 +01:00
|
|
|
}
|
2007-03-30 19:00:36 +02:00
|
|
|
|
2006-12-28 17:03:42 +01:00
|
|
|
cus__dump_class_tag_names(cus);
|
|
|
|
print_malloc_stats();
|
2009-03-11 16:31:17 +01:00
|
|
|
rc = EXIT_SUCCESS;
|
|
|
|
out:
|
|
|
|
cus__delete(cus);
|
|
|
|
dwarves__exit();
|
|
|
|
return rc;
|
2006-12-28 17:03:42 +01:00
|
|
|
}
|