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