diff options
Diffstat (limited to 'rtemstoolkit/libiberty/demangle.h')
-rw-r--r-- | rtemstoolkit/libiberty/demangle.h | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/rtemstoolkit/libiberty/demangle.h b/rtemstoolkit/libiberty/demangle.h index 996203b..f062d77 100644 --- a/rtemstoolkit/libiberty/demangle.h +++ b/rtemstoolkit/libiberty/demangle.h @@ -1,5 +1,5 @@ /* Defs for interface to demanglers. - Copyright (C) 1992-2017 Free Software Foundation, Inc. + Copyright (C) 1992-2023 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 @@ -53,21 +53,25 @@ extern "C" { */ #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) #define DMGL_DLANG (1 << 16) #define DMGL_RUST (1 << 17) /* Rust wraps GNU_V3 style mangling. */ /* 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|DMGL_DLANG|DMGL_RUST) - +#define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST) + +/* Disable a limit on the depth of recursion in mangled strings. + Note if this limit is disabled then stack exhaustion is possible when + demangling pathologically complicated strings. Bug reports about stack + exhaustion when the option is enabled will be rejected. */ +#define DMGL_NO_RECURSE_LIMIT (1 << 18) + +/* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as + the maximum depth of recursion allowed. It should be enough for any + real-world mangled name. */ +#define DEMANGLE_RECURSION_LIMIT 2048 + /* Enumeration of possible demangling styles. Lucid and ARM styles are still kept logically distinct, even though @@ -81,11 +85,6 @@ 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, @@ -97,11 +96,6 @@ extern enum 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" @@ -112,11 +106,6 @@ extern enum demangling_styles #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) @@ -136,17 +125,8 @@ extern const struct demangler_engine extern char * cplus_demangle (const char *mangled, int options); -extern int -cplus_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 void -set_cplus_marker_for_demangling (int ch); - extern enum demangling_styles cplus_demangle_set_style (enum demangling_styles style); @@ -179,24 +159,11 @@ ada_demangle (const char *mangled, int options); extern char * dlang_demangle (const char *mangled, int options); -/* Returns non-zero iff MANGLED is a rust mangled symbol. MANGLED must - already have been demangled through cplus_demangle_v3. If this function - returns non-zero then MANGLED can be demangled (in-place) using - RUST_DEMANGLE_SYM. */ extern int -rust_is_mangled (const char *mangled); - -/* Demangles SYM (in-place) if RUST_IS_MANGLED returned non-zero for SYM. - If RUST_IS_MANGLED returned zero for SYM then RUST_DEMANGLE_SYM might - replace characters that cannot be demangled with '?' and might truncate - SYM. After calling RUST_DEMANGLE_SYM SYM might be shorter, but never - larger. */ -extern void -rust_demangle_sym (char *sym); - -/* Demangles MANGLED if it was GNU_V3 and then RUST mangled, otherwise - returns NULL. Uses CPLUS_DEMANGLE_V3, RUST_IS_MANGLED and - RUST_DEMANGLE_SYM. Returns a new string that is owned by the caller. */ +rust_demangle_callback (const char *mangled, int options, + demangle_callbackref callback, void *opaque); + + extern char * rust_demangle (const char *mangled, int options); @@ -392,6 +359,9 @@ enum demangle_component_type template argument, and the right subtree is either NULL or another TEMPLATE_ARGLIST node. */ DEMANGLE_COMPONENT_TEMPLATE_ARGLIST, + /* A template parameter object (C++20). The left subtree is the + corresponding template argument. */ + DEMANGLE_COMPONENT_TPARM_OBJ, /* An initializer list. The left subtree is either an explicit type or NULL, and the right subtree is a DEMANGLE_COMPONENT_ARGLIST. */ DEMANGLE_COMPONENT_INITIALIZER_LIST, @@ -438,6 +408,9 @@ enum demangle_component_type number which involves neither modifying the mangled string nor allocating a new copy of the literal in memory. */ DEMANGLE_COMPONENT_LITERAL_NEG, + /* A vendor's builtin expression. The left subtree holds the + expression's name, and the right subtree is a argument list. */ + DEMANGLE_COMPONENT_VENDOR_EXPR, /* A libgcj compiled resource. The left subtree is the name of the resource. */ DEMANGLE_COMPONENT_JAVA_RESOURCE, @@ -475,8 +448,28 @@ enum demangle_component_type DEMANGLE_COMPONENT_TRANSACTION_SAFE, /* A cloned function. */ DEMANGLE_COMPONENT_CLONE, + /* A member-like friend function. */ + DEMANGLE_COMPONENT_FRIEND, DEMANGLE_COMPONENT_NOEXCEPT, - DEMANGLE_COMPONENT_THROW_SPEC + DEMANGLE_COMPONENT_THROW_SPEC, + + DEMANGLE_COMPONENT_STRUCTURED_BINDING, + + DEMANGLE_COMPONENT_MODULE_NAME, + DEMANGLE_COMPONENT_MODULE_PARTITION, + DEMANGLE_COMPONENT_MODULE_ENTITY, + DEMANGLE_COMPONENT_MODULE_INIT, + + DEMANGLE_COMPONENT_TEMPLATE_HEAD, + DEMANGLE_COMPONENT_TEMPLATE_TYPE_PARM, + DEMANGLE_COMPONENT_TEMPLATE_NON_TYPE_PARM, + DEMANGLE_COMPONENT_TEMPLATE_TEMPLATE_PARM, + DEMANGLE_COMPONENT_TEMPLATE_PACK_PARM, + + /* A builtin type with argument. This holds the builtin type + information. */ + DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE + }; /* Types which are only used internally. */ @@ -498,6 +491,7 @@ struct demangle_component Initialize to zero. Private to d_print_comp. All other fields are final after initialization. */ int d_printing; + int d_counting; union { @@ -562,6 +556,15 @@ struct demangle_component const struct demangle_builtin_type_info *type; } s_builtin; + /* For DEMANGLE_COMPONENT_EXTENDED_BUILTIN_TYPE. */ + struct + { + /* Builtin type. */ + const struct demangle_builtin_type_info *type; + short arg; + char suffix; + } s_extended_builtin; + /* For DEMANGLE_COMPONENT_SUB_STD. */ struct { |