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