sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | /* Defs for interface to demanglers. |
| 2 | Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 |
| 3 | Free Software Foundation, Inc. |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2, or (at your option) |
| 8 | any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 18 | Boston, MA 02111-1307, USA. */ |
| 19 | |
| 20 | |
| 21 | #if !defined (DEMANGLE_H) |
| 22 | #define DEMANGLE_H |
| 23 | |
| 24 | #include <ansidecl.h> |
| 25 | |
| 26 | #define current_demangling_style VG_(current_demangling_style) |
| 27 | |
| 28 | /* Options passed to cplus_demangle (in 2nd parameter). */ |
| 29 | |
| 30 | #define DMGL_NO_OPTS 0 /* For readability... */ |
| 31 | #define DMGL_PARAMS (1 << 0) /* Include function args */ |
| 32 | #define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ |
| 33 | #define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */ |
| 34 | |
| 35 | #define DMGL_AUTO (1 << 8) |
| 36 | #define DMGL_GNU (1 << 9) |
| 37 | #define DMGL_LUCID (1 << 10) |
| 38 | #define DMGL_ARM (1 << 11) |
| 39 | #define DMGL_HP (1 << 12) /* For the HP aCC compiler; |
| 40 | same as ARM except for |
| 41 | template arguments, etc. */ |
| 42 | #define DMGL_EDG (1 << 13) |
| 43 | #define DMGL_GNU_V3 (1 << 14) |
| 44 | #define DMGL_GNAT (1 << 15) |
| 45 | |
| 46 | /* If none of these are set, use 'current_demangling_style' as the default. */ |
| 47 | #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT) |
| 48 | |
| 49 | /* Enumeration of possible demangling styles. |
| 50 | |
| 51 | Lucid and ARM styles are still kept logically distinct, even though |
| 52 | they now both behave identically. The resulting style is actual the |
| 53 | union of both. I.E. either style recognizes both "__pt__" and "__rf__" |
| 54 | for operator "->", even though the first is lucid style and the second |
| 55 | is ARM style. (FIXME?) */ |
| 56 | |
| 57 | extern enum demangling_styles |
| 58 | { |
| 59 | no_demangling = -1, |
| 60 | unknown_demangling = 0, |
| 61 | auto_demangling = DMGL_AUTO, |
| 62 | gnu_demangling = DMGL_GNU, |
| 63 | lucid_demangling = DMGL_LUCID, |
| 64 | arm_demangling = DMGL_ARM, |
| 65 | hp_demangling = DMGL_HP, |
| 66 | edg_demangling = DMGL_EDG, |
| 67 | gnu_v3_demangling = DMGL_GNU_V3, |
| 68 | java_demangling = DMGL_JAVA, |
| 69 | gnat_demangling = DMGL_GNAT |
| 70 | } current_demangling_style; |
| 71 | |
| 72 | /* Define string names for the various demangling styles. */ |
| 73 | |
| 74 | #define NO_DEMANGLING_STYLE_STRING "none" |
| 75 | #define AUTO_DEMANGLING_STYLE_STRING "auto" |
| 76 | #define GNU_DEMANGLING_STYLE_STRING "gnu" |
| 77 | #define LUCID_DEMANGLING_STYLE_STRING "lucid" |
| 78 | #define ARM_DEMANGLING_STYLE_STRING "arm" |
| 79 | #define HP_DEMANGLING_STYLE_STRING "hp" |
| 80 | #define EDG_DEMANGLING_STYLE_STRING "edg" |
| 81 | #define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3" |
| 82 | #define JAVA_DEMANGLING_STYLE_STRING "java" |
| 83 | #define GNAT_DEMANGLING_STYLE_STRING "gnat" |
| 84 | |
| 85 | /* Some macros to test what demangling style is active. */ |
| 86 | |
| 87 | #define CURRENT_DEMANGLING_STYLE current_demangling_style |
| 88 | #define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO) |
| 89 | #define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU) |
| 90 | #define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID) |
| 91 | #define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM) |
| 92 | #define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP) |
| 93 | #define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG) |
| 94 | #define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3) |
| 95 | #define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA) |
| 96 | #define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT) |
| 97 | |
| 98 | /* Provide information about the available demangle styles. This code is |
| 99 | pulled from gdb into libiberty because it is useful to binutils also. */ |
| 100 | |
| 101 | extern const struct demangler_engine |
| 102 | { |
| 103 | const char *const demangling_style_name; |
| 104 | const enum demangling_styles demangling_style; |
| 105 | const char *const demangling_style_doc; |
| 106 | } libiberty_demanglers[]; |
| 107 | |
| 108 | extern char * |
| 109 | VG_(cplus_demangle) PARAMS ((const char *mangled, int options)); |
| 110 | |
| 111 | /* |
| 112 | extern int |
| 113 | cplus_demangle_opname PARAMS ((const char *opname, char *result, int options)); |
| 114 | */ |
| 115 | |
| 116 | /* |
| 117 | extern const char * |
| 118 | cplus_mangle_opname PARAMS ((const char *opname, int options)); |
| 119 | */ |
| 120 | |
| 121 | /* Note: This sets global state. FIXME if you care about multi-threading. */ |
| 122 | |
| 123 | /* |
| 124 | extern void |
| 125 | set_cplus_marker_for_demangling PARAMS ((int ch)); |
| 126 | */ |
| 127 | |
| 128 | /* |
| 129 | extern enum demangling_styles |
| 130 | cplus_demangle_set_style PARAMS ((enum demangling_styles style)); |
| 131 | */ |
| 132 | |
| 133 | /* |
| 134 | extern enum demangling_styles |
| 135 | cplus_demangle_name_to_style PARAMS ((const char *name)); |
| 136 | */ |
| 137 | |
| 138 | /* V3 ABI demangling entry points, defined in cp-demangle.c. */ |
| 139 | extern char* |
| 140 | VG_(cplus_demangle_v3) PARAMS ((const char* mangled)); |
| 141 | |
| 142 | extern char* |
| 143 | VG_(java_demangle_v3) PARAMS ((const char* mangled)); |
| 144 | |
| 145 | |
| 146 | enum gnu_v3_ctor_kinds { |
| 147 | gnu_v3_complete_object_ctor = 1, |
| 148 | gnu_v3_base_object_ctor, |
| 149 | gnu_v3_complete_object_allocating_ctor |
| 150 | }; |
| 151 | |
| 152 | /* Return non-zero iff NAME is the mangled form of a constructor name |
| 153 | in the G++ V3 ABI demangling style. Specifically, return an `enum |
| 154 | gnu_v3_ctor_kinds' value indicating what kind of constructor |
| 155 | it is. */ |
| 156 | /* |
| 157 | extern enum gnu_v3_ctor_kinds |
| 158 | is_gnu_v3_mangled_ctor PARAMS ((const char *name)); |
| 159 | */ |
| 160 | |
| 161 | |
| 162 | enum gnu_v3_dtor_kinds { |
| 163 | gnu_v3_deleting_dtor = 1, |
| 164 | gnu_v3_complete_object_dtor, |
| 165 | gnu_v3_base_object_dtor |
| 166 | }; |
| 167 | |
| 168 | /* Return non-zero iff NAME is the mangled form of a destructor name |
| 169 | in the G++ V3 ABI demangling style. Specifically, return an `enum |
| 170 | gnu_v3_dtor_kinds' value, indicating what kind of destructor |
| 171 | it is. */ |
| 172 | /* |
| 173 | extern enum gnu_v3_dtor_kinds |
| 174 | is_gnu_v3_mangled_dtor PARAMS ((const char *name)); |
| 175 | */ |
| 176 | |
| 177 | #endif /* DEMANGLE_H */ |