mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
Update libiberty demangler
Update the libiberty demangler using the auxprogs/update-demangler script to gcc git commit d3b2ead595467166c849950ecd3710501a5094d9. This update includes: - libiberty rust-demangle, ignore .suffix - libiberty: Fix infinite recursion in rust demangler - Update copyright years - libiberty: support digits in cpp mangled clone names - d-demangle: properly skip anonymous symbols - d-demangle: remove parenthesis where it is not needed
This commit is contained in:
parent
df214356db
commit
e0b62fe055
@ -17,8 +17,8 @@ set -e
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
# You need to modify these revision numbers for your update.
|
||||
old_gcc_revision=01d92cfd79872e4cffc78bf233bb9b767336beb8 # the revision of the previous update
|
||||
new_gcc_revision=b3585c0836e729bed56b9afd4292177673a25ca0 # the revision for this update
|
||||
old_gcc_revision=b3585c0836e729bed56b9afd4292177673a25ca0 # the revision of the previous update
|
||||
new_gcc_revision=d3b2ead595467166c849950ecd3710501a5094d9 # the revision for this update
|
||||
|
||||
# Unless the organization of demangler related files has changed, no
|
||||
# changes below this line should be necessary.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* ANSI and traditional C compatibility macros
|
||||
Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
||||
/* ANSI and traditional C compatability macros
|
||||
Copyright (C) 1991-2022 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Demangler for g++ V3 ABI.
|
||||
Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@wasabisystems.com>.
|
||||
|
||||
This file is part of the libiberty library, which is part of GCC.
|
||||
@ -3901,10 +3901,11 @@ d_clone_suffix (struct d_info *di, struct demangle_component *encoding)
|
||||
const char *pend = suffix;
|
||||
struct demangle_component *n;
|
||||
|
||||
if (*pend == '.' && (IS_LOWER (pend[1]) || pend[1] == '_'))
|
||||
if (*pend == '.' && (IS_LOWER (pend[1]) || IS_DIGIT (pend[1])
|
||||
|| pend[1] == '_'))
|
||||
{
|
||||
pend += 2;
|
||||
while (IS_LOWER (*pend) || *pend == '_')
|
||||
while (IS_LOWER (*pend) || IS_DIGIT (*pend) || *pend == '_')
|
||||
++pend;
|
||||
}
|
||||
while (*pend == '.' && IS_DIGIT (pend[1]))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Internal demangler interface for g++ V3 ABI.
|
||||
Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2022 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor <ian@wasabisystems.com>.
|
||||
|
||||
This file is part of the libiberty library, which is part of GCC.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Demangler for GNU C++
|
||||
Copyright (C) 1989-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 1989-2022 Free Software Foundation, Inc.
|
||||
Written by James Clark (jjc@jclark.uucp)
|
||||
Rewritten by Fred Fish (fnf@cygnus.com) for ARM and Lucid demangling
|
||||
Modified by Satish Pai (pai@apollo.hp.com) for HP demangling
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Demangler for the D programming language
|
||||
Copyright (C) 2014-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2014-2022 Free Software Foundation, Inc.
|
||||
Written by Iain Buclaw (ibuclaw@gdcproject.org)
|
||||
|
||||
This file is part of the libiberty library.
|
||||
@ -269,15 +269,15 @@ dlang_hexdigit (const char *mangled, char *ret)
|
||||
|
||||
c = mangled[0];
|
||||
if (!ISDIGIT (c))
|
||||
(*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
|
||||
*ret = c - (ISUPPER (c) ? 'A' : 'a') + 10;
|
||||
else
|
||||
(*ret) = (c - '0');
|
||||
*ret = c - '0';
|
||||
|
||||
c = mangled[1];
|
||||
if (!ISDIGIT (c))
|
||||
(*ret) = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
|
||||
*ret = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
|
||||
else
|
||||
(*ret) = (*ret << 4) | (c - '0');
|
||||
*ret = (*ret << 4) | (c - '0');
|
||||
|
||||
mangled += 2;
|
||||
|
||||
@ -354,7 +354,7 @@ dlang_decode_backref (const char *mangled, long *ret)
|
||||
static const char *
|
||||
dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
|
||||
{
|
||||
(*ret) = NULL;
|
||||
*ret = NULL;
|
||||
|
||||
if (mangled == NULL || *mangled != 'Q')
|
||||
return NULL;
|
||||
@ -372,7 +372,7 @@ dlang_backref (const char *mangled, const char **ret, struct dlang_info *info)
|
||||
return NULL;
|
||||
|
||||
/* Set the position of the back reference. */
|
||||
(*ret) = qpos - refpos;
|
||||
*ret = qpos - refpos;
|
||||
|
||||
return mangled;
|
||||
}
|
||||
@ -1666,13 +1666,19 @@ dlang_parse_qualified (string *decl, const char *mangled,
|
||||
size_t n = 0;
|
||||
do
|
||||
{
|
||||
/* Skip over anonymous symbols. */
|
||||
if (*mangled == '0')
|
||||
{
|
||||
do
|
||||
mangled++;
|
||||
while (*mangled == '0');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (n++)
|
||||
string_append (decl, ".");
|
||||
|
||||
/* Skip over anonymous symbols. */
|
||||
while (*mangled == '0')
|
||||
mangled++;
|
||||
|
||||
mangled = dlang_identifier (decl, mangled, info);
|
||||
|
||||
/* Consume the encoded arguments. However if this is not followed by the
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Defs for interface to demanglers.
|
||||
Copyright (C) 1992-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992-2022 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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* An abstract string datatype.
|
||||
Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* An abstract string datatype.
|
||||
Copyright (C) 1998-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2022 Free Software Foundation, Inc.
|
||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
||||
|
||||
This file is part of GCC.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/* Demangler for the Rust programming language
|
||||
Copyright (C) 2016-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2016-2022 Free Software Foundation, Inc.
|
||||
Written by David Tolnay (dtolnay@gmail.com).
|
||||
Rewritten by Eduard-Mihai Burtescu (eddyb@lyken.rs) for v0 support.
|
||||
|
||||
@ -101,6 +101,12 @@ struct rust_demangler
|
||||
/* Rust mangling version, with legacy mangling being -1. */
|
||||
int version;
|
||||
|
||||
/* Recursion depth. */
|
||||
unsigned int recursion;
|
||||
/* Maximum number of times demangle_path may be called recursively. */
|
||||
#define RUST_MAX_RECURSION_COUNT 1024
|
||||
#define RUST_NO_RECURSION_LIMIT ((unsigned int) -1)
|
||||
|
||||
uint64_t bound_lifetime_depth;
|
||||
};
|
||||
|
||||
@ -698,6 +704,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
|
||||
if (rdm->errored)
|
||||
return;
|
||||
|
||||
if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
|
||||
{
|
||||
++ rdm->recursion;
|
||||
if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
|
||||
/* FIXME: There ought to be a way to report
|
||||
that the recursion limit has been reached. */
|
||||
goto fail_return;
|
||||
}
|
||||
|
||||
switch (tag = next (rdm))
|
||||
{
|
||||
case 'C':
|
||||
@ -715,10 +730,7 @@ demangle_path (struct rust_demangler *rdm, int in_value)
|
||||
case 'N':
|
||||
ns = next (rdm);
|
||||
if (!ISLOWER (ns) && !ISUPPER (ns))
|
||||
{
|
||||
rdm->errored = 1;
|
||||
return;
|
||||
}
|
||||
goto fail_return;
|
||||
|
||||
demangle_path (rdm, in_value);
|
||||
|
||||
@ -803,9 +815,15 @@ demangle_path (struct rust_demangler *rdm, int in_value)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
rdm->errored = 1;
|
||||
return;
|
||||
goto fail_return;
|
||||
}
|
||||
goto pass_return;
|
||||
|
||||
fail_return:
|
||||
rdm->errored = 1;
|
||||
pass_return:
|
||||
if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
|
||||
-- rdm->recursion;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -897,6 +915,19 @@ demangle_type (struct rust_demangler *rdm)
|
||||
return;
|
||||
}
|
||||
|
||||
if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
|
||||
{
|
||||
++ rdm->recursion;
|
||||
if (rdm->recursion > RUST_MAX_RECURSION_COUNT)
|
||||
/* FIXME: There ought to be a way to report
|
||||
that the recursion limit has been reached. */
|
||||
{
|
||||
rdm->errored = 1;
|
||||
-- rdm->recursion;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case 'R':
|
||||
@ -1057,6 +1088,9 @@ demangle_type (struct rust_demangler *rdm)
|
||||
rdm->next--;
|
||||
demangle_path (rdm, 0);
|
||||
}
|
||||
|
||||
if (rdm->recursion != RUST_NO_RECURSION_LIMIT)
|
||||
-- rdm->recursion;
|
||||
}
|
||||
|
||||
/* A trait in a trait object may have some "existential projections"
|
||||
@ -1347,6 +1381,7 @@ rust_demangle_callback (const char *mangled, int options,
|
||||
rdm.skipping_printing = 0;
|
||||
rdm.verbose = (options & DMGL_VERBOSE) != 0;
|
||||
rdm.version = 0;
|
||||
rdm.recursion = (options & DMGL_NO_RECURSE_LIMIT) ? RUST_NO_RECURSION_LIMIT : 0;
|
||||
rdm.bound_lifetime_depth = 0;
|
||||
|
||||
/* Rust symbols always start with _R (v0) or _ZN (legacy). */
|
||||
@ -1367,13 +1402,19 @@ rust_demangle_callback (const char *mangled, int options,
|
||||
/* Rust symbols (v0) use only [_0-9a-zA-Z] characters. */
|
||||
for (p = rdm.sym; *p; p++)
|
||||
{
|
||||
/* Rust v0 symbols can have '.' suffixes, ignore those. */
|
||||
if (rdm.version == 0 && *p == '.')
|
||||
break;
|
||||
|
||||
rdm.sym_len++;
|
||||
|
||||
if (*p == '_' || ISALNUM (*p))
|
||||
continue;
|
||||
|
||||
/* Legacy Rust symbols can also contain [.:$] characters. */
|
||||
if (rdm.version == -1 && (*p == '$' || *p == '.' || *p == ':'))
|
||||
/* Legacy Rust symbols can also contain [.:$] characters.
|
||||
Or @ in the .suffix (which will be skipped, see below). */
|
||||
if (rdm.version == -1 && (*p == '$' || *p == '.' || *p == ':'
|
||||
|| *p == '@'))
|
||||
continue;
|
||||
|
||||
return 0;
|
||||
@ -1382,7 +1423,16 @@ rust_demangle_callback (const char *mangled, int options,
|
||||
/* Legacy Rust symbols need to be handled separately. */
|
||||
if (rdm.version == -1)
|
||||
{
|
||||
/* Legacy Rust symbols always end with E. */
|
||||
/* Legacy Rust symbols always end with E. But can be followed by a
|
||||
.suffix (which we want to ignore). */
|
||||
int dot_suffix = 1;
|
||||
while (rdm.sym_len > 0 &&
|
||||
!(dot_suffix && rdm.sym[rdm.sym_len - 1] == 'E'))
|
||||
{
|
||||
dot_suffix = rdm.sym[rdm.sym_len - 1] == '.';
|
||||
rdm.sym_len--;
|
||||
}
|
||||
|
||||
if (!(rdm.sym_len > 0 && rdm.sym[rdm.sym_len - 1] == 'E'))
|
||||
return 0;
|
||||
rdm.sym_len--;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* <ctype.h> replacement macros.
|
||||
|
||||
Copyright (C) 2000-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
||||
Contributed by Zack Weinberg <zackw@stanford.edu>.
|
||||
|
||||
This file is part of the libiberty library.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* <ctype.h> replacement macros.
|
||||
|
||||
Copyright (C) 2000-2021 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2022 Free Software Foundation, Inc.
|
||||
Contributed by Zack Weinberg <zackw@stanford.edu>.
|
||||
|
||||
This file is part of the libiberty library.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user