12159047fSniklas /* 2*c074d1c9Sdrahn * Copyright (c) 1983, 1993 36e421504Sfgsch * The Regents of the University of California. All rights reserved. 42159047fSniklas * 56e421504Sfgsch * Redistribution and use in source and binary forms, with or without 66e421504Sfgsch * modification, are permitted provided that the following conditions 76e421504Sfgsch * are met: 86e421504Sfgsch * 1. Redistributions of source code must retain the above copyright 96e421504Sfgsch * notice, this list of conditions and the following disclaimer. 106e421504Sfgsch * 2. Redistributions in binary form must reproduce the above copyright 116e421504Sfgsch * notice, this list of conditions and the following disclaimer in the 126e421504Sfgsch * documentation and/or other materials provided with the distribution. 136e421504Sfgsch * 3. Neither the name of the University nor the names of its contributors 146e421504Sfgsch * may be used to endorse or promote products derived from this software 156e421504Sfgsch * without specific prior written permission. 162159047fSniklas * 176e421504Sfgsch * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 186e421504Sfgsch * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 196e421504Sfgsch * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 206e421504Sfgsch * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 216e421504Sfgsch * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 226e421504Sfgsch * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 236e421504Sfgsch * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 246e421504Sfgsch * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 256e421504Sfgsch * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 266e421504Sfgsch * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 276e421504Sfgsch * SUCH DAMAGE. 282159047fSniklas */ 292159047fSniklas #ifndef gprof_h 302159047fSniklas #define gprof_h 312159047fSniklas 32b305b0f1Sespie /* Include the BFD sysdep.h file. */ 332159047fSniklas #include "sysdep.h" 34*c074d1c9Sdrahn #include "bfd.h" 352159047fSniklas 36b305b0f1Sespie /* Undefine the BFD PACKAGE and VERSION macros before including the 37b305b0f1Sespie gprof config.h file. */ 38b305b0f1Sespie #undef PACKAGE 39b305b0f1Sespie #undef VERSION 40b305b0f1Sespie 41b305b0f1Sespie #include "gconfig.h" 42b305b0f1Sespie 432159047fSniklas #ifndef MIN 442159047fSniklas #define MIN(a,b) ((a) < (b) ? (a) : (b)) 452159047fSniklas #endif 462159047fSniklas #ifndef MAX 472159047fSniklas #define MAX(a,b) ((a) > (b) ? (a) : (b)) 482159047fSniklas #endif 492159047fSniklas 502159047fSniklas /* AIX defines hz as a macro. */ 512159047fSniklas #undef hz 522159047fSniklas 532159047fSniklas #ifndef PATH_MAX 542159047fSniklas #define PATH_MAX 1024 552159047fSniklas #endif 562159047fSniklas 572159047fSniklas #define A_OUTNAME "a.out" /* default core filename */ 582159047fSniklas #define GMONNAME "gmon.out" /* default profile filename */ 592159047fSniklas #define GMONSUM "gmon.sum" /* profile summary filename */ 602159047fSniklas 61b305b0f1Sespie #ifdef HAVE_LOCALE_H 62b305b0f1Sespie # include <locale.h> 63b305b0f1Sespie #endif 64b305b0f1Sespie 65b305b0f1Sespie #ifdef ENABLE_NLS 66b305b0f1Sespie /* Undefine BFD's `_' macro - it uses dgetext() and we want to use gettext(). */ 67b305b0f1Sespie #undef _ 68b305b0f1Sespie #define _(String) gettext (String) 69b305b0f1Sespie #endif 70b305b0f1Sespie 71b305b0f1Sespie #include "bin-bugs.h" 72b305b0f1Sespie 732159047fSniklas #define STYLE_FLAT_PROFILE (1<<0) 742159047fSniklas #define STYLE_CALL_GRAPH (1<<1) 752159047fSniklas #define STYLE_SUMMARY_FILE (1<<2) 762159047fSniklas #define STYLE_EXEC_COUNTS (1<<3) 772159047fSniklas #define STYLE_ANNOTATED_SOURCE (1<<4) 782159047fSniklas #define STYLE_GMON_INFO (1<<5) 79191aa565Sniklas #define STYLE_FUNCTION_ORDER (1<<6) 80191aa565Sniklas #define STYLE_FILE_ORDER (1<<7) 812159047fSniklas 822159047fSniklas #define ANYDEBUG (1<<0) /* 1 */ 832159047fSniklas #define DFNDEBUG (1<<1) /* 2 */ 842159047fSniklas #define CYCLEDEBUG (1<<2) /* 4 */ 852159047fSniklas #define ARCDEBUG (1<<3) /* 8 */ 862159047fSniklas #define TALLYDEBUG (1<<4) /* 16 */ 872159047fSniklas #define TIMEDEBUG (1<<5) /* 32 */ 882159047fSniklas #define SAMPLEDEBUG (1<<6) /* 64 */ 892159047fSniklas #define AOUTDEBUG (1<<7) /* 128 */ 902159047fSniklas #define CALLDEBUG (1<<8) /* 256 */ 912159047fSniklas #define LOOKUPDEBUG (1<<9) /* 512 */ 922159047fSniklas #define PROPDEBUG (1<<10) /* 1024 */ 932159047fSniklas #define BBDEBUG (1<<11) /* 2048 */ 942159047fSniklas #define IDDEBUG (1<<12) /* 4096 */ 952159047fSniklas #define SRCDEBUG (1<<13) /* 8192 */ 962159047fSniklas 972159047fSniklas #ifdef DEBUG 982159047fSniklas #define DBG(l,s) if (debug_level & (l)) {s;} 992159047fSniklas #else 1002159047fSniklas #define DBG(l,s) 1012159047fSniklas #endif 1022159047fSniklas 1032159047fSniklas typedef enum 1042159047fSniklas { 105b305b0f1Sespie FF_AUTO = 0, FF_MAGIC, FF_BSD, FF_BSD44, FF_PROF 1062159047fSniklas } 1072159047fSniklas File_Format; 1082159047fSniklas 1092159047fSniklas typedef unsigned char UNIT[2]; /* unit of profiling */ 1102159047fSniklas 1112159047fSniklas extern const char *whoami; /* command-name, for error messages */ 112191aa565Sniklas extern const char *function_mapping_file; /* file mapping functions to files */ 1132159047fSniklas extern const char *a_out_name; /* core filename */ 1142159047fSniklas extern long hz; /* ticks per second */ 1152159047fSniklas 1162159047fSniklas /* 1172159047fSniklas * Command-line options: 1182159047fSniklas */ 1192159047fSniklas extern int debug_level; /* debug level */ 1202159047fSniklas extern int output_style; 1212159047fSniklas extern int output_width; /* controls column width in index */ 122*c074d1c9Sdrahn extern bfd_boolean bsd_style_output; /* as opposed to FSF style output */ 123*c074d1c9Sdrahn extern bfd_boolean demangle; /* demangle symbol names? */ 124*c074d1c9Sdrahn extern bfd_boolean discard_underscores; /* discard leading underscores? */ 125*c074d1c9Sdrahn extern bfd_boolean ignore_direct_calls; /* don't count direct calls */ 126*c074d1c9Sdrahn extern bfd_boolean ignore_static_funcs; /* suppress static functions */ 127*c074d1c9Sdrahn extern bfd_boolean ignore_zeros; /* ignore unused symbols/files */ 128*c074d1c9Sdrahn extern bfd_boolean line_granularity; /* function or line granularity? */ 129*c074d1c9Sdrahn extern bfd_boolean print_descriptions; /* output profile description */ 130*c074d1c9Sdrahn extern bfd_boolean print_path; /* print path or just filename? */ 131*c074d1c9Sdrahn extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols. */ 132191aa565Sniklas 1332159047fSniklas extern File_Format file_format; /* requested file format */ 1342159047fSniklas 135*c074d1c9Sdrahn extern bfd_boolean first_output; /* no output so far? */ 1362159047fSniklas 137*c074d1c9Sdrahn extern void done PARAMS ((int status)) ATTRIBUTE_NORETURN; 1382159047fSniklas 1392159047fSniklas #endif /* gprof_h */ 140