xref: /netbsd-src/external/gpl3/binutils/dist/gprof/gprof.h (revision 6d322f2f4598f0d8a138f10ea648ec4fabe41f8b)
1 /*
2  * Copyright (c) 1983, 1993
3  *      The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 #ifndef gprof_h
30 #define gprof_h
31 
32 #include "gconfig.h"
33 
34 #undef PACKAGE
35 
36 /* Include the BFD sysdep.h file.  */
37 #include "sysdep.h"
38 #include "bfd.h"
39 
40 /* Undefine the BFD PACKAGE and VERSION macros before including the
41    gprof config.h file.  */
42 #undef PACKAGE
43 #undef VERSION
44 
45 #include "gconfig.h"
46 
47 #ifndef MIN
48 #define MIN(a,b)	((a) < (b) ? (a) : (b))
49 #endif
50 #ifndef MAX
51 #define MAX(a,b)	((a) > (b) ? (a) : (b))
52 #endif
53 
54 /* AIX defines hz as a macro.  */
55 #undef hz
56 
57 #ifndef PATH_MAX
58 #define PATH_MAX	1024
59 #endif
60 
61 #define	A_OUTNAME	"a.out"		/* default core filename */
62 #define	GMONNAME	"gmon.out"	/* default profile filename */
63 #define	GMONSUM		"gmon.sum"	/* profile summary filename */
64 
65 #ifdef HAVE_LOCALE_H
66 # include <locale.h>
67 #endif
68 
69 #ifdef ENABLE_NLS
70 /* Undefine BFD's `_' macro - it uses dgetext() and we want to use gettext().  */
71 #undef  _
72 #define _(String) gettext (String)
73 #endif
74 
75 #define STYLE_FLAT_PROFILE	(1<<0)
76 #define STYLE_CALL_GRAPH	(1<<1)
77 #define STYLE_SUMMARY_FILE	(1<<2)
78 #define STYLE_EXEC_COUNTS	(1<<3)
79 #define STYLE_ANNOTATED_SOURCE	(1<<4)
80 #define STYLE_GMON_INFO		(1<<5)
81 #define STYLE_FUNCTION_ORDER	(1<<6)
82 #define STYLE_FILE_ORDER	(1<<7)
83 
84 #define	ANYDEBUG	(1<<0)	/*    1 */
85 #define	DFNDEBUG	(1<<1)	/*    2 */
86 #define	CYCLEDEBUG	(1<<2)	/*    4 */
87 #define	ARCDEBUG	(1<<3)	/*    8 */
88 #define	TALLYDEBUG	(1<<4)	/*   16 */
89 #define	TIMEDEBUG	(1<<5)	/*   32 */
90 #define	SAMPLEDEBUG	(1<<6)	/*   64 */
91 #define	AOUTDEBUG	(1<<7)	/*  128 */
92 #define	CALLDEBUG	(1<<8)	/*  256 */
93 #define	LOOKUPDEBUG	(1<<9)	/*  512 */
94 #define	PROPDEBUG	(1<<10)	/* 1024 */
95 #define BBDEBUG		(1<<11)	/* 2048 */
96 #define IDDEBUG		(1<<12)	/* 4096 */
97 #define SRCDEBUG	(1<<13)	/* 8192 */
98 
99 #ifdef DEBUG
100 #define DBG(l,s)	if (debug_level & (l)) {s;}
101 #else
102 #define DBG(l,s)
103 #endif
104 
105 typedef enum
106   {
107     FF_AUTO = 0, FF_MAGIC, FF_BSD, FF_BSD44, FF_PROF
108   }
109 File_Format;
110 
111 typedef unsigned char UNIT[2];	/* unit of profiling */
112 
113 extern const char *whoami;	/* command-name, for error messages */
114 extern const char *function_mapping_file; /* file mapping functions to files */
115 extern const char *a_out_name;	/* core filename */
116 extern long hz;			/* ticks per second */
117 
118 /*
119  * Command-line options:
120  */
121 extern int debug_level;			/* debug level */
122 extern int output_style;
123 extern int output_width;		/* controls column width in index */
124 extern bfd_boolean bsd_style_output;	/* as opposed to FSF style output */
125 extern bfd_boolean demangle;		/* demangle symbol names? */
126 extern bfd_boolean ignore_direct_calls;	/* don't count direct calls */
127 extern bfd_boolean ignore_static_funcs;	/* suppress static functions */
128 extern bfd_boolean ignore_zeros;	/* ignore unused symbols/files */
129 extern bfd_boolean line_granularity;	/* function or line granularity? */
130 extern bfd_boolean print_descriptions;	/* output profile description */
131 extern bfd_boolean print_path;		/* print path or just filename? */
132 extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols.  */
133 
134 extern File_Format file_format;		/* requested file format */
135 
136 extern bfd_boolean first_output;	/* no output so far? */
137 
138 extern void done (int status) ATTRIBUTE_NORETURN;
139 
140 #endif /* gprof_h */
141