xref: /openbsd/gnu/usr.bin/binutils/gprof/gprof.h (revision e5dd7070)
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 the BFD sysdep.h file.  */
33 #include "sysdep.h"
34 #include "bfd.h"
35 
36 /* Undefine the BFD PACKAGE and VERSION macros before including the
37    gprof config.h file.  */
38 #undef PACKAGE
39 #undef VERSION
40 
41 #include "gconfig.h"
42 
43 #ifndef MIN
44 #define MIN(a,b)	((a) < (b) ? (a) : (b))
45 #endif
46 #ifndef MAX
47 #define MAX(a,b)	((a) > (b) ? (a) : (b))
48 #endif
49 
50 /* AIX defines hz as a macro.  */
51 #undef hz
52 
53 #ifndef PATH_MAX
54 #define PATH_MAX	1024
55 #endif
56 
57 #define	A_OUTNAME	"a.out"		/* default core filename */
58 #define	GMONNAME	"gmon.out"	/* default profile filename */
59 #define	GMONSUM		"gmon.sum"	/* profile summary filename */
60 
61 #ifdef HAVE_LOCALE_H
62 # include <locale.h>
63 #endif
64 
65 #ifdef ENABLE_NLS
66 /* Undefine BFD's `_' macro - it uses dgetext() and we want to use gettext().  */
67 #undef  _
68 #define _(String) gettext (String)
69 #endif
70 
71 #include "bin-bugs.h"
72 
73 #define STYLE_FLAT_PROFILE	(1<<0)
74 #define STYLE_CALL_GRAPH	(1<<1)
75 #define STYLE_SUMMARY_FILE	(1<<2)
76 #define STYLE_EXEC_COUNTS	(1<<3)
77 #define STYLE_ANNOTATED_SOURCE	(1<<4)
78 #define STYLE_GMON_INFO		(1<<5)
79 #define STYLE_FUNCTION_ORDER	(1<<6)
80 #define STYLE_FILE_ORDER	(1<<7)
81 
82 #define	ANYDEBUG	(1<<0)	/*    1 */
83 #define	DFNDEBUG	(1<<1)	/*    2 */
84 #define	CYCLEDEBUG	(1<<2)	/*    4 */
85 #define	ARCDEBUG	(1<<3)	/*    8 */
86 #define	TALLYDEBUG	(1<<4)	/*   16 */
87 #define	TIMEDEBUG	(1<<5)	/*   32 */
88 #define	SAMPLEDEBUG	(1<<6)	/*   64 */
89 #define	AOUTDEBUG	(1<<7)	/*  128 */
90 #define	CALLDEBUG	(1<<8)	/*  256 */
91 #define	LOOKUPDEBUG	(1<<9)	/*  512 */
92 #define	PROPDEBUG	(1<<10)	/* 1024 */
93 #define BBDEBUG		(1<<11)	/* 2048 */
94 #define IDDEBUG		(1<<12)	/* 4096 */
95 #define SRCDEBUG	(1<<13)	/* 8192 */
96 
97 #ifdef DEBUG
98 #define DBG(l,s)	if (debug_level & (l)) {s;}
99 #else
100 #define DBG(l,s)
101 #endif
102 
103 typedef enum
104   {
105     FF_AUTO = 0, FF_MAGIC, FF_BSD, FF_BSD44, FF_PROF
106   }
107 File_Format;
108 
109 typedef unsigned char UNIT[2];	/* unit of profiling */
110 
111 extern const char *whoami;	/* command-name, for error messages */
112 extern const char *function_mapping_file; /* file mapping functions to files */
113 extern const char *a_out_name;	/* core filename */
114 extern long hz;			/* ticks per second */
115 
116 /*
117  * Command-line options:
118  */
119 extern int debug_level;			/* debug level */
120 extern int output_style;
121 extern int output_width;		/* controls column width in index */
122 extern bfd_boolean bsd_style_output;	/* as opposed to FSF style output */
123 extern bfd_boolean demangle;		/* demangle symbol names? */
124 extern bfd_boolean discard_underscores;	/* discard leading underscores? */
125 extern bfd_boolean ignore_direct_calls;	/* don't count direct calls */
126 extern bfd_boolean ignore_static_funcs;	/* suppress static functions */
127 extern bfd_boolean ignore_zeros;	/* ignore unused symbols/files */
128 extern bfd_boolean line_granularity;	/* function or line granularity? */
129 extern bfd_boolean print_descriptions;	/* output profile description */
130 extern bfd_boolean print_path;		/* print path or just filename? */
131 extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols.  */
132 
133 extern File_Format file_format;		/* requested file format */
134 
135 extern bfd_boolean first_output;	/* no output so far? */
136 
137 extern void done PARAMS ((int status)) ATTRIBUTE_NORETURN;
138 
139 #endif /* gprof_h */
140