?? demangle.h
字號:
/* Defs for interface to demanglers. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. In addition to the permissions in the GNU Library General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The Library Public License restrictions do apply in other respects; for example, they cover modification of the file, and distribution when not linked into a combined executable.) This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */#if !defined (DEMANGLE_H)#define DEMANGLE_H#ifdef __cplusplusextern "C" {#endif /* __cplusplus */#define ATTRIBUTE_NORETURN#define ATTRIBUTE_UNUSED#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))#define XNEW(T) ((T *) xmalloc (sizeof (T)))#define XNEWVEC(T, N) ((T *) xmalloc (sizeof (T) * (N)))#define XRESIZEVAR(T, P, S) ((T *) xrealloc ((P), (S)))#define XRESIZEVEC(T, P, N) ((T *) xrealloc ((void *) (P), sizeof (T) * (N)))/* Options passed to cplus_demangle (in 2nd parameter). */#define DMGL_NO_OPTS 0 /* For readability... */#define DMGL_PARAMS (1 << 0) /* Include function args */#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */#define DMGL_JAVA (1 << 2) /* Demangle as Java rather than C++. */#define DMGL_VERBOSE (1 << 3) /* Include implementation details. */#define DMGL_TYPES (1 << 4) /* Also try to demangle type encodings. */#define DMGL_RET_POSTFIX (1 << 5) /* Print function return types (when present) after function signature */#define DMGL_AUTO (1 << 8)#define DMGL_GNU (1 << 9)#define DMGL_LUCID (1 << 10)#define DMGL_ARM (1 << 11)#define DMGL_HP (1 << 12) /* For the HP aCC compiler; same as ARM except for template arguments, etc. */#define DMGL_EDG (1 << 13)#define DMGL_GNU_V3 (1 << 14)#define DMGL_GNAT (1 << 15)/* If none of these are set, use 'current_demangling_style' as the default. */#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT)/* Enumeration of possible demangling styles. Lucid and ARM styles are still kept logically distinct, even though they now both behave identically. The resulting style is actual the union of both. I.E. either style recognizes both "__pt__" and "__rf__" for operator "->", even though the first is lucid style and the second is ARM style. (FIXME?) */extern enum demangling_styles{ no_demangling = -1, unknown_demangling = 0, auto_demangling = DMGL_AUTO, gnu_demangling = DMGL_GNU, lucid_demangling = DMGL_LUCID, arm_demangling = DMGL_ARM, hp_demangling = DMGL_HP, edg_demangling = DMGL_EDG, gnu_v3_demangling = DMGL_GNU_V3, java_demangling = DMGL_JAVA, gnat_demangling = DMGL_GNAT} current_demangling_style;/* Define string names for the various demangling styles. */#define NO_DEMANGLING_STYLE_STRING "none"#define AUTO_DEMANGLING_STYLE_STRING "auto"#define GNU_DEMANGLING_STYLE_STRING "gnu"#define LUCID_DEMANGLING_STYLE_STRING "lucid"#define ARM_DEMANGLING_STYLE_STRING "arm"#define HP_DEMANGLING_STYLE_STRING "hp"#define EDG_DEMANGLING_STYLE_STRING "edg"#define GNU_V3_DEMANGLING_STYLE_STRING "gnu-v3"#define JAVA_DEMANGLING_STYLE_STRING "java"#define GNAT_DEMANGLING_STYLE_STRING "gnat"/* Some macros to test what demangling style is active. */#define CURRENT_DEMANGLING_STYLE current_demangling_style#define AUTO_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_AUTO)#define GNU_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU)#define LUCID_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_LUCID)#define ARM_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_ARM)#define HP_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_HP)#define EDG_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_EDG)#define GNU_V3_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNU_V3)#define JAVA_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_JAVA)#define GNAT_DEMANGLING (((int) CURRENT_DEMANGLING_STYLE) & DMGL_GNAT)/* Provide information about the available demangle styles. This code is pulled from gdb into libiberty because it is useful to binutils also. */extern const struct demangler_engine{ const char *const demangling_style_name; const enum demangling_styles demangling_style; const char *const demangling_style_doc;} libiberty_demanglers[];extern char *cplus_demangle (const char *mangled, int options);extern intcplus_demangle_opname (const char *opname, char *result, int options);extern const char *cplus_mangle_opname (const char *opname, int options);/* Note: This sets global state. FIXME if you care about multi-threading. */extern voidset_cplus_marker_for_demangling (int ch);extern enum demangling_styles cplus_demangle_set_style (enum demangling_styles style);extern enum demangling_styles cplus_demangle_name_to_style (const char *name);/* Callback typedef for allocation-less demangler interfaces. */typedef void (*demangle_callbackref) (const char *, size_t, void *);/* V3 ABI demangling entry points, defined in cp-demangle.c. Callback variants return non-zero on success, zero on error. char* variants return a string allocated by malloc on success, NULL on error. */extern intcplus_demangle_v3_callback (const char *mangled, int options, demangle_callbackref callback, void *opaque);extern char*cplus_demangle_v3 (const char *mangled, int options);extern intjava_demangle_v3_callback (const char *mangled, demangle_callbackref callback, void *opaque);extern char*java_demangle_v3 (const char *mangled);enum gnu_v3_ctor_kinds { gnu_v3_complete_object_ctor = 1, gnu_v3_base_object_ctor, gnu_v3_complete_object_allocating_ctor};/* Return non-zero iff NAME is the mangled form of a constructor name in the G++ V3 ABI demangling style. Specifically, return an `enum gnu_v3_ctor_kinds' value indicating what kind of constructor it is. */extern enum gnu_v3_ctor_kinds is_gnu_v3_mangled_ctor (const char *name);enum gnu_v3_dtor_kinds { gnu_v3_deleting_dtor = 1, gnu_v3_complete_object_dtor, gnu_v3_base_object_dtor};/* Return non-zero iff NAME is the mangled form of a destructor name in the G++ V3 ABI demangling style. Specifically, return an `enum gnu_v3_dtor_kinds' value, indicating what kind of destructor it is. */extern enum gnu_v3_dtor_kinds is_gnu_v3_mangled_dtor (const char *name);/* The V3 demangler works in two passes. The first pass builds a tree representation of the mangled name, and the second pass turns the tree representation into a demangled string. Here we define an interface to permit a caller to build their own tree representation, which they can pass to the demangler to get a demangled string. This can be used to canonicalize user input into something which the demangler might output. It could also be used by other demanglers in the future. *//* These are the component types which may be found in the tree. Many component types have one or two subtrees, referred to as left and right (a component type with only one subtree puts it in the left subtree). */enum demangle_component_type{ /* A name, with a length and a pointer to a string. */ DEMANGLE_COMPONENT_NAME, /* A qualified name. The left subtree is a class or namespace or some such thing, and the right subtree is a name qualified by that class. */ DEMANGLE_COMPONENT_QUAL_NAME, /* A local name. The left subtree describes a function, and the right subtree is a name which is local to that function. */ DEMANGLE_COMPONENT_LOCAL_NAME, /* A typed name. The left subtree is a name, and the right subtree describes that name as a function. */ DEMANGLE_COMPONENT_TYPED_NAME, /* A template. The left subtree is a template name, and the right subtree is a template argument list. */ DEMANGLE_COMPONENT_TEMPLATE, /* A template parameter. This holds a number, which is the template parameter index. */ DEMANGLE_COMPONENT_TEMPLATE_PARAM, /* A constructor. This holds a name and the kind of constructor. */ DEMANGLE_COMPONENT_CTOR, /* A destructor. This holds a name and the kind of destructor. */ DEMANGLE_COMPONENT_DTOR, /* A vtable. This has one subtree, the type for which this is a vtable. */ DEMANGLE_COMPONENT_VTABLE, /* A VTT structure. This has one subtree, the type for which this is a VTT. */ DEMANGLE_COMPONENT_VTT, /* A construction vtable. The left subtree is the type for which this is a vtable, and the right subtree is the derived type for which this vtable is built. */ DEMANGLE_COMPONENT_CONSTRUCTION_VTABLE, /* A typeinfo structure. This has one subtree, the type for which this is the tpeinfo structure. */ DEMANGLE_COMPONENT_TYPEINFO, /* A typeinfo name. This has one subtree, the type for which this is the typeinfo name. */ DEMANGLE_COMPONENT_TYPEINFO_NAME, /* A typeinfo function. This has one subtree, the type for which this is the tpyeinfo function. */ DEMANGLE_COMPONENT_TYPEINFO_FN, /* A thunk. This has one subtree, the name for which this is a thunk. */ DEMANGLE_COMPONENT_THUNK, /* A virtual thunk. This has one subtree, the name for which this is a virtual thunk. */ DEMANGLE_COMPONENT_VIRTUAL_THUNK, /* A covariant thunk. This has one subtree, the name for which this is a covariant thunk. */ DEMANGLE_COMPONENT_COVARIANT_THUNK, /* A Java class. This has one subtree, the type. */ DEMANGLE_COMPONENT_JAVA_CLASS, /* A guard variable. This has one subtree, the name for which this is a guard variable. */ /* A reference temporary. This has one subtree, the name for which this is a temporary. */ DEMANGLE_COMPONENT_REFTEMP, /* A hidden alias. This has one subtree, the encoding for which it is providing alternative linkage. */ DEMANGLE_COMPONENT_HIDDEN_ALIAS, /* A standard substitution. This holds the name of the substitution. */ DEMANGLE_COMPONENT_SUB_STD, /* The restrict qualifier. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_RESTRICT, /* The volatile qualifier. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_VOLATILE, /* The const qualifier. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_CONST, /* The restrict qualifier modifying a member function. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_RESTRICT_THIS, /* The volatile qualifier modifying a member function. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_VOLATILE_THIS, /* The const qualifier modifying a member function. The one subtree is the type which is being qualified. */ DEMANGLE_COMPONENT_CONST_THIS, /* A vendor qualifier. The left subtree is the type which is being qualified, and the right subtree is the name of the qualifier. */ DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL, /* A pointer. The one subtree is the type which is being pointed to. */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -