52 static bool unescape(
const char **in,
char **out,
const char *seq,
char value);
80 size_t len, len_without_hash;
112 memset(seen,
false,
sizeof(seen));
113 for (end = str +
hash_len; str < end; str++)
114 if (*str >=
'0' && *str <=
'9')
115 seen[*str -
'0'] =
true;
116 else if (*str >=
'a' && *str <=
'f')
117 seen[*str -
'a' + 10] =
true;
123 for (i = 0; i < 16; i++)
127 return count >= 5 && count <= 15;
132 const char *end = str + len;
137 if (!strncmp(str,
"$C$", 3))
139 else if (!strncmp(str,
"$SP$", 4)
140 || !strncmp(str,
"$BP$", 4)
141 || !strncmp(str,
"$RF$", 4)
142 || !strncmp(str,
"$LT$", 4)
143 || !strncmp(str,
"$GT$", 4)
144 || !strncmp(str,
"$LP$", 4)
145 || !strncmp(str,
"$RP$", 4))
147 else if (!strncmp(str,
"$u20$", 5)
148 || !strncmp(str,
"$u27$", 5)
149 || !strncmp(str,
"$u5b$", 5)
150 || !strncmp(str,
"$u5d$", 5)
151 || !strncmp(str,
"$u7e$", 5))
158 if (!strncmp(str,
"...", 3))
199 if (!(
unescape(&in, &out,
"$C$",
',')
207 ||
unescape(&in, &out,
"$u20$",
' ')
208 ||
unescape(&in, &out,
"$u27$",
'\'')
209 ||
unescape(&in, &out,
"$u5b$",
'[')
210 ||
unescape(&in, &out,
"$u5d$",
']')
211 ||
unescape(&in, &out,
"$u7e$",
'~'))) {
212 pr_err(
"demangle-rust: unexpected escape sequence");
224 if ((in == sym || in[-1] ==
':') && in[1] ==
'$')
248 pr_err(
"demangle-rust: unexpected character '%c' in symbol\n",
257 static bool unescape(
const char **in,
char **out,
const char *seq,
char value)
259 size_t len = strlen(seq);
261 if (strncmp(*in, seq, len))
static const size_t hash_len
void rust_demangle_sym(char *sym)
static bool is_prefixed_hash(const char *start)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
static const char * hash_prefix
static int str(yyscan_t scanner, int token)
static bool unescape(const char **in, char **out, const char *seq, char value)
bool rust_is_mangled(const char *sym)
static bool looks_like_rust(const char *sym, size_t len)
static int sym(yyscan_t scanner, int type, int config)
static const size_t hash_prefix_len