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#undef PACKAGE
37#undef PACKAGE_NAME
38#undef PACKAGE_STRING
39#undef PACKAGE_TARNAME
40#undef PACKAGE_VERSION
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#define STYLE_FLAT_PROFILE	(1<<0)
72#define STYLE_CALL_GRAPH	(1<<1)
73#define STYLE_SUMMARY_FILE	(1<<2)
74#define STYLE_EXEC_COUNTS	(1<<3)
75#define STYLE_ANNOTATED_SOURCE	(1<<4)
76#define STYLE_GMON_INFO		(1<<5)
77#define STYLE_FUNCTION_ORDER	(1<<6)
78#define STYLE_FILE_ORDER	(1<<7)
79
80#define	ANYDEBUG	(1<<0)	/*    1 */
81#define	DFNDEBUG	(1<<1)	/*    2 */
82#define	CYCLEDEBUG	(1<<2)	/*    4 */
83#define	ARCDEBUG	(1<<3)	/*    8 */
84#define	TALLYDEBUG	(1<<4)	/*   16 */
85#define	TIMEDEBUG	(1<<5)	/*   32 */
86#define	SAMPLEDEBUG	(1<<6)	/*   64 */
87#define	AOUTDEBUG	(1<<7)	/*  128 */
88#define	CALLDEBUG	(1<<8)	/*  256 */
89#define	LOOKUPDEBUG	(1<<9)	/*  512 */
90#define	PROPDEBUG	(1<<10)	/* 1024 */
91#define BBDEBUG		(1<<11)	/* 2048 */
92#define IDDEBUG		(1<<12)	/* 4096 */
93#define SRCDEBUG	(1<<13)	/* 8192 */
94
95#ifdef DEBUG
96#define DBG(l,s)	if (debug_level & (l)) {s;}
97#else
98#define DBG(l,s)
99#endif
100
101typedef enum
102  {
103    FF_AUTO = 0, FF_MAGIC, FF_BSD, FF_BSD44, FF_PROF
104  }
105File_Format;
106
107typedef unsigned char UNIT[2];	/* unit of profiling */
108
109extern const char *whoami;	/* command-name, for error messages */
110extern const char *function_mapping_file; /* file mapping functions to files */
111extern const char *a_out_name;	/* core filename */
112extern long hz;			/* ticks per second */
113
114/*
115 * Command-line options:
116 */
117extern int debug_level;			/* debug level */
118extern int output_style;
119extern int output_width;		/* controls column width in index */
120extern bfd_boolean bsd_style_output;	/* as opposed to FSF style output */
121extern bfd_boolean demangle;		/* demangle symbol names? */
122extern bfd_boolean ignore_direct_calls;	/* don't count direct calls */
123extern bfd_boolean ignore_static_funcs;	/* suppress static functions */
124extern bfd_boolean ignore_zeros;	/* ignore unused symbols/files */
125extern bfd_boolean line_granularity;	/* function or line granularity? */
126extern bfd_boolean print_descriptions;	/* output profile description */
127extern bfd_boolean print_path;		/* print path or just filename? */
128extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols.  */
129extern bfd_boolean inline_file_names;	/* print file names after symbols */
130
131extern File_Format file_format;		/* requested file format */
132
133extern bfd_boolean first_output;	/* no output so far? */
134
135extern void done (int status) ATTRIBUTE_NORETURN;
136
137#endif /* gprof_h */
138