| 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 | |
| 101 | typedef enum |
| 102 | { |
| 103 | FF_AUTO = 0, FF_MAGIC, FF_BSD, FF_BSD44, FF_PROF |
| 104 | } |
| 105 | File_Format; |
| 106 | |
| 107 | typedef unsigned char UNIT[2]; /* unit of profiling */ |
| 108 | |
| 109 | extern const char *whoami; /* command-name, for error messages */ |
| 110 | extern const char *function_mapping_file; /* file mapping functions to files */ |
| 111 | extern const char *a_out_name; /* core filename */ |
| 112 | extern long hz; /* ticks per second */ |
| 113 | |
| 114 | /* |
| 115 | * Command-line options: |
| 116 | */ |
| 117 | extern int debug_level; /* debug level */ |
| 118 | extern int output_style; |
| 119 | extern int output_width; /* controls column width in index */ |
| 120 | extern bfd_boolean bsd_style_output; /* as opposed to FSF style output */ |
| 121 | extern bfd_boolean demangle; /* demangle symbol names? */ |
| 122 | extern bfd_boolean ignore_direct_calls; /* don't count direct calls */ |
| 123 | extern bfd_boolean ignore_static_funcs; /* suppress static functions */ |
| 124 | extern bfd_boolean ignore_zeros; /* ignore unused symbols/files */ |
| 125 | extern bfd_boolean line_granularity; /* function or line granularity? */ |
| 126 | extern bfd_boolean print_descriptions; /* output profile description */ |
| 127 | extern bfd_boolean print_path; /* print path or just filename? */ |
| 128 | extern bfd_boolean ignore_non_functions; /* Ignore non-function symbols. */ |
| 129 | extern bfd_boolean inline_file_names; /* print file names after symbols */ |
| 130 | |
| 131 | extern File_Format file_format; /* requested file format */ |
| 132 | |
| 133 | extern bfd_boolean first_output; /* no output so far? */ |
| 134 | |
| 135 | extern void done (int status) ATTRIBUTE_NORETURN; |
| 136 | |
| 137 | #endif /* gprof_h */ |