8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / tools / ctf / cvt / compare.c
blob26037f8a537aafb14dac8a9f00d11f17fb93fbef
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * This is a test program designed to catch mismerges and mistranslations from
31 * stabs to CTF.
33 * Given a file with stabs data and a file with CTF data, determine whether
34 * or not all of the data structures and objects described by the stabs data
35 * are present in the CTF data.
38 #include <stdio.h>
39 #include <stdlib.h>
40 #include <assert.h>
42 #include "ctftools.h"
44 char *progname;
45 int debug_level = DEBUG_LEVEL;
47 static void
48 usage(void)
50 fprintf(stderr, "Usage: %s ctf_file stab_file\n", progname);
53 int
54 main(int argc, char **argv)
56 tdata_t *ctftd, *stabrtd, *stabtd, *difftd;
57 char *ctfname, *stabname;
58 int new;
60 progname = argv[0];
62 if (argc != 3) {
63 usage();
64 exit(2);
67 ctfname = argv[1];
68 stabname = argv[2];
70 stabrtd = tdata_new();
71 stabtd = tdata_new();
72 difftd = tdata_new();
74 if (read_stabs(stabrtd, stabname, 0) != 0)
75 merge_into_master(stabrtd, stabtd, NULL, 1);
76 else if (read_ctf(&stabname, 1, NULL, read_ctf_save_cb, &stabtd, 0)
77 == 0)
78 terminate("%s doesn't have stabs or CTF\n", stabname);
80 if (read_ctf(&ctfname, 1, NULL, read_ctf_save_cb, &ctftd, 0) == 0)
81 terminate("%s doesn't contain CTF data\n", ctfname);
83 merge_into_master(stabtd, ctftd, difftd, 0);
85 if ((new = hash_count(difftd->td_iihash)) != 0) {
86 (void) hash_iter(difftd->td_iihash, (int (*)())iidesc_dump,
87 NULL);
88 terminate("%s grew by %d\n", stabname, new);
91 return (0);