You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
| 2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
| 2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
| 2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
| 2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
| 2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
| 2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
| 2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
| 2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
| 2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
| 2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
| 2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
| 2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
| 2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
| 2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
| 2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
| 2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
| 2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
| 2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
| 2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
| 2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(19) |
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
(4) |
2
(1) |
3
|
|
4
|
5
(6) |
6
|
7
(7) |
8
(2) |
9
(1) |
10
(2) |
|
11
(4) |
12
(1) |
13
(4) |
14
(5) |
15
(2) |
16
(5) |
17
(2) |
|
18
(3) |
19
(12) |
20
(10) |
21
(3) |
22
(7) |
23
(4) |
24
(5) |
|
25
(3) |
26
(2) |
27
(1) |
28
|
29
(1) |
30
(1) |
|
|
From: <sv...@va...> - 2016-09-13 19:18:43
|
Author: mjw
Date: Tue Sep 13 20:18:36 2016
New Revision: 15952
Log:
Correct an Altivec configure think-o.
An earlier change introduced a think-o in the altivec capability
check, allowing a false positive if the compiler supported altivec
but the hardware did not.
Resolves bug #368412 - False positive result for altivec capability check
Patch by Will Schmidt <wil...@vn...>
Modified:
trunk/NEWS
trunk/configure.ac
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Sep 13 20:18:36 2016
@@ -155,6 +155,7 @@
363858 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 4/5
364948 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 5/5
366138 Fix configure errors out when using Xcode 8 (clang 8.0.0)
+368412 False positive result for altivec capability check
368461 mmapunmap test fails on ppc64
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Sep 13 20:18:36 2016
@@ -1379,8 +1379,6 @@
]])], [
ac_have_altivec=yes
AC_MSG_RESULT([yes])
-AC_DEFINE([HAS_ALTIVEC], 1,
- [Define to 1 if gcc/as can do Altivec.])
], [
ac_have_altivec=no
AC_MSG_RESULT([no])
|
|
From: Mark W. <mj...@re...> - 2016-09-13 19:08:54
|
On Mon, 2016-09-12 at 09:43 +0000, Aman Ahuja wrote: > I no longer want to receive the mails from Valgrind. Please remove me > from the district. Please see the footer of this email, you'll have to go to the URL below to unsubscribe from this mailinglist > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: <sv...@va...> - 2016-09-13 19:06:35
|
Author: mjw
Date: Tue Sep 13 20:06:23 2016
New Revision: 15951
Log:
Update libiberty demangler.
Update the libiberty demangler using the auxprogs/update-demangler
script. There were various extensions and bug fixes since our last
import. Add new D language demangler file d-demangle.c and update
the vg_libciface.h header with some new constructs used (strtol,
xmalloc_failed, xmemdup, XDELETEVEC, XDUPVEC).
Resolves bug #359181 - Buffer Overflow during Demangling.
Added:
trunk/coregrind/m_demangle/d-demangle.c
Modified:
trunk/NEWS
trunk/auxprogs/update-demangler
trunk/coregrind/Makefile.am
trunk/coregrind/m_demangle/ansidecl.h
trunk/coregrind/m_demangle/cp-demangle.c
trunk/coregrind/m_demangle/cp-demangle.h
trunk/coregrind/m_demangle/cplus-dem.c
trunk/coregrind/m_demangle/demangle.h
trunk/coregrind/m_demangle/dyn-string.h
trunk/coregrind/m_demangle/safe-ctype.h
trunk/coregrind/m_demangle/vg_libciface.h
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Sep 13 20:06:23 2016
@@ -105,6 +105,7 @@
358030 support direct socket calls on x86 32bit (new in linux 4.3)
358478 drd/tests/std_thread.cpp doesn't build with GCC6
359133 Assertion 'eltSzB <= ddpa->poolSzB' failed
+359181 Buffer Overflow during Demangling
359201 futex syscall "skips" argument 5 if op is FUTEX_WAIT_BITSET
359289 s390x: popcnt (B9E1) not implemented
359472 The Power PC vsubuqm instruction doesn't always give the correct result
Modified: trunk/auxprogs/update-demangler
==============================================================================
--- trunk/auxprogs/update-demangler (original)
+++ trunk/auxprogs/update-demangler Tue Sep 13 20:06:23 2016
@@ -17,8 +17,8 @@
#---------------------------------------------------------------------
# You need to modify these revision numbers for your update.
-old_gcc_revision=r181975 # the revision of the previous update
-new_gcc_revision=r212125 # the revision for this update
+old_gcc_revision=r212125 # the revision of the previous update
+new_gcc_revision=r240068 # the revision for this update
# Unless the organization of demangler related files has changed, no
# changes below this line should be necessary.
@@ -55,6 +55,7 @@
cp ../gcc-$old_gcc_revision/libiberty/cp-demangle.h .
cp ../gcc-$old_gcc_revision/libiberty/cplus-dem.c .
cp ../gcc-$old_gcc_revision/libiberty/dyn-string.c .
+cp ../gcc-$old_gcc_revision/libiberty/d-demangle.c .
cp ../gcc-$old_gcc_revision/libiberty/safe-ctype.c .
cd ..
@@ -81,6 +82,7 @@
cp ../gcc-$new_gcc_revision/libiberty/cp-demangle.h .
cp ../gcc-$new_gcc_revision/libiberty/cplus-dem.c .
cp ../gcc-$new_gcc_revision/libiberty/dyn-string.c .
+cp ../gcc-$new_gcc_revision/libiberty/d-demangle.c .
cp ../gcc-$new_gcc_revision/libiberty/safe-ctype.c .
cd ..
Modified: trunk/coregrind/Makefile.am
==============================================================================
--- trunk/coregrind/Makefile.am (original)
+++ trunk/coregrind/Makefile.am Tue Sep 13 20:06:23 2016
@@ -357,6 +357,7 @@
m_demangle/cplus-dem.c \
m_demangle/demangle.c \
m_demangle/dyn-string.c \
+ m_demangle/d-demangle.c \
m_demangle/safe-ctype.c \
m_dispatch/dispatch-x86-linux.S \
m_dispatch/dispatch-amd64-linux.S \
Modified: trunk/coregrind/m_demangle/ansidecl.h
==============================================================================
--- trunk/coregrind/m_demangle/ansidecl.h (original)
+++ trunk/coregrind/m_demangle/ansidecl.h Tue Sep 13 20:06:23 2016
@@ -1,7 +1,5 @@
/* ANSI and traditional C compatability macros
- Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2013
- Free Software Foundation, Inc.
+ Copyright (C) 1991-2015 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
@@ -276,6 +274,15 @@
# endif /* GNUC >= 4.3 */
#endif /* ATTRIBUTE_HOT */
+/* Attribute 'no_sanitize_undefined' was valid as of gcc 4.9. */
+#ifndef ATTRIBUTE_NO_SANITIZE_UNDEFINED
+# if (GCC_VERSION >= 4009)
+# define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined))
+# else
+# define ATTRIBUTE_NO_SANITIZE_UNDEFINED
+# endif /* GNUC >= 4.9 */
+#endif /* ATTRIBUTE_NO_SANITIZE_UNDEFINED */
+
/* We use __extension__ in some places to suppress -pedantic warnings
about GCC extensions. This feature didn't work properly before
gcc 2.8. */
@@ -306,6 +313,15 @@
#define ENUM_BITFIELD(TYPE) unsigned int
#endif
+ /* This is used to mark a class or virtual function as final. */
+#if __cplusplus >= 201103L
+#define GCC_FINAL final
+#elif GCC_VERSION >= 4007
+#define GCC_FINAL __final
+#else
+#define GCC_FINAL
+#endif
+
#ifdef __cplusplus
}
#endif
Modified: trunk/coregrind/m_demangle/cp-demangle.c
==============================================================================
--- trunk/coregrind/m_demangle/cp-demangle.c (original)
+++ trunk/coregrind/m_demangle/cp-demangle.c Tue Sep 13 20:06:23 2016
@@ -93,7 +93,11 @@
CP_DEMANGLE_DEBUG
If defined, turns on debugging mode, which prints information on
stdout about the mangled string. This is not generally useful.
-*/
+
+ CHECK_DEMANGLER
+ If defined, additional sanity checks will be performed. It will
+ cause some slowdown, but will allow to catch out-of-bound access
+ errors earlier. This macro is intended for testing and debugging. */
#if 0 /* in valgrind */
#if defined (_AIX) && !defined (__GNUC__)
@@ -135,6 +139,15 @@
#endif /* ! in valgrind */
#if 0 /* in valgrind */
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#endif /* ! in valgrind */
+#ifndef INT_MAX
+# define INT_MAX (int)(((unsigned int) ~0) >> 1) /* 0x7FFFFFFF */
+#endif
+
+#if 0 /* in valgrind */
#include "ansidecl.h"
#include "libiberty.h"
#endif /* ! in valgrind */
@@ -348,7 +361,7 @@
/* Set to 1 if we saw a demangling error. */
int demangle_failure;
/* The current index into any template argument packs we are using
- for printing. */
+ for printing, or -1 to print the whole pack. */
int pack_index;
/* Number of d_print_flush calls so far. */
unsigned long int flush_count;
@@ -409,7 +422,7 @@
struct demangle_component *);
static struct demangle_component *
-d_make_template_param (struct d_info *, long);
+d_make_template_param (struct d_info *, int);
static struct demangle_component *
d_make_sub (struct d_info *, const char *, int);
@@ -432,7 +445,7 @@
static struct demangle_component *d_source_name (struct d_info *);
-static long d_number (struct d_info *);
+static int d_number (struct d_info *);
static struct demangle_component *d_identifier (struct d_info *, int);
@@ -470,6 +483,7 @@
d_template_param (struct d_info *);
static struct demangle_component *d_template_args (struct d_info *);
+static struct demangle_component *d_template_args_1 (struct d_info *);
static struct demangle_component *
d_template_arg (struct d_info *);
@@ -553,8 +567,10 @@
static void
d_print_expr_op (struct d_print_info *, int, const struct demangle_component *);
-static void
-d_print_cast (struct d_print_info *, int, const struct demangle_component *);
+static void d_print_cast (struct d_print_info *, int,
+ const struct demangle_component *);
+static void d_print_conversion (struct d_print_info *, int,
+ const struct demangle_component *);
static int d_demangle_callback (const char *, int,
demangle_callbackref, void *);
@@ -697,6 +713,9 @@
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
printf ("rvalue reference this\n");
break;
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
+ printf ("transaction_safe this\n");
+ break;
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
printf ("vendor type qualifier\n");
break;
@@ -728,7 +747,9 @@
printf ("pointer to member type\n");
break;
case DEMANGLE_COMPONENT_FIXED_TYPE:
- printf ("fixed-point type\n");
+ printf ("fixed-point type, accum? %d, sat? %d\n",
+ dc->u.s_fixed.accum, dc->u.s_fixed.sat);
+ d_dump (dc->u.s_fixed.length, indent + 2);
break;
case DEMANGLE_COMPONENT_ARGLIST:
printf ("argument list\n");
@@ -742,6 +763,9 @@
case DEMANGLE_COMPONENT_CAST:
printf ("cast\n");
break;
+ case DEMANGLE_COMPONENT_CONVERSION:
+ printf ("conversion operator\n");
+ break;
case DEMANGLE_COMPONENT_NULLARY:
printf ("nullary operator\n");
break;
@@ -951,6 +975,7 @@
case DEMANGLE_COMPONENT_IMAGINARY:
case DEMANGLE_COMPONENT_VENDOR_TYPE:
case DEMANGLE_COMPONENT_CAST:
+ case DEMANGLE_COMPONENT_CONVERSION:
case DEMANGLE_COMPONENT_JAVA_RESOURCE:
case DEMANGLE_COMPONENT_DECLTYPE:
case DEMANGLE_COMPONENT_PACK_EXPANSION:
@@ -979,6 +1004,7 @@
case DEMANGLE_COMPONENT_RESTRICT_THIS:
case DEMANGLE_COMPONENT_VOLATILE_THIS:
case DEMANGLE_COMPONENT_CONST_THIS:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
case DEMANGLE_COMPONENT_ARGLIST:
@@ -1118,7 +1144,7 @@
/* Add a new template parameter. */
static struct demangle_component *
-d_make_template_param (struct d_info *di, long i)
+d_make_template_param (struct d_info *di, int i)
{
struct demangle_component *p;
@@ -1134,7 +1160,7 @@
/* Add a new function parameter. */
static struct demangle_component *
-d_make_function_param (struct d_info *di, long i)
+d_make_function_param (struct d_info *di, int i)
{
struct demangle_component *p;
@@ -1221,6 +1247,7 @@
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
return has_return_type (d_left (dc));
}
}
@@ -1242,7 +1269,7 @@
return is_ctor_dtor_or_conversion (d_right (dc));
case DEMANGLE_COMPONENT_CTOR:
case DEMANGLE_COMPONENT_DTOR:
- case DEMANGLE_COMPONENT_CAST:
+ case DEMANGLE_COMPONENT_CONVERSION:
return 1;
}
}
@@ -1277,6 +1304,7 @@
while (dc->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dc->type == DEMANGLE_COMPONENT_CONST_THIS
+ || dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dc = d_left (dc);
@@ -1293,6 +1321,7 @@
while (dcr->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| dcr->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dcr->type == DEMANGLE_COMPONENT_CONST_THIS
+ || dcr->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dcr->type == DEMANGLE_COMPONENT_REFERENCE_THIS
|| dcr->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dcr = d_left (dcr);
@@ -1315,7 +1344,12 @@
static struct demangle_component *
d_abi_tags (struct d_info *di, struct demangle_component *dc)
{
+ struct demangle_component *hold_last_name;
char peek;
+
+ /* Preserve the last name, so the ABI tag doesn't clobber it. */
+ hold_last_name = di->last_name;
+
while (peek = d_peek_char (di),
peek == 'B')
{
@@ -1324,6 +1358,9 @@
tag = d_source_name (di);
dc = d_make_comp (di, DEMANGLE_COMPONENT_TAGGED_NAME, dc, tag);
}
+
+ di->last_name = hold_last_name;
+
return dc;
}
@@ -1608,7 +1645,7 @@
static struct demangle_component *
d_source_name (struct d_info *di)
{
- long len;
+ int len;
struct demangle_component *ret;
len = d_number (di);
@@ -1621,12 +1658,12 @@
/* number ::= [n] <(non-negative decimal integer)> */
-static long
+static int
d_number (struct d_info *di)
{
int negative;
char peek;
- long ret;
+ int ret;
negative = 0;
peek = d_peek_char (di);
@@ -1742,6 +1779,10 @@
{ "eO", NL ("^="), 2 },
{ "eo", NL ("^"), 2 },
{ "eq", NL ("=="), 2 },
+ { "fL", NL ("..."), 3 },
+ { "fR", NL ("..."), 3 },
+ { "fl", NL ("..."), 2 },
+ { "fr", NL ("..."), 2 },
{ "ge", NL (">="), 2 },
{ "gs", NL ("::"), 1 },
{ "gt", NL (">"), 2 },
@@ -1776,6 +1817,8 @@
{ "rc", NL ("reinterpret_cast"), 2 },
{ "rm", NL ("%"), 2 },
{ "rs", NL (">>"), 2 },
+ { "sP", NL ("sizeof..."), 1 },
+ { "sZ", NL ("sizeof..."), 1 },
{ "sc", NL ("static_cast"), 2 },
{ "st", NL ("sizeof "), 1 },
{ "sz", NL ("sizeof "), 1 },
@@ -1798,11 +1841,16 @@
{
struct demangle_component *type;
int was_conversion = di->is_conversion;
+ struct demangle_component *res;
di->is_conversion = ! di->is_expression;
type = cplus_demangle_type (di);
+ if (di->is_conversion)
+ res = d_make_comp (di, DEMANGLE_COMPONENT_CONVERSION, type, NULL);
+ else
+ res = d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
di->is_conversion = was_conversion;
- return d_make_comp (di, DEMANGLE_COMPONENT_CAST, type, NULL);
+ return res;
}
else
{
@@ -1853,7 +1901,7 @@
{
struct demangle_component *p = NULL;
struct demangle_component *next = NULL;
- long len, i;
+ int len, i;
char c;
const char *str;
@@ -1995,7 +2043,7 @@
case 'C':
{
struct demangle_component *derived_type;
- long offset;
+ int offset;
struct demangle_component *base_type;
derived_type = cplus_demangle_type (di);
@@ -2282,7 +2330,8 @@
names. */
peek = d_peek_char (di);
- if (peek == 'r' || peek == 'V' || peek == 'K')
+ if (peek == 'r' || peek == 'V' || peek == 'K'
+ || (peek == 'D' && d_peek_next_char (di) == 'x'))
{
struct demangle_component **pret;
@@ -2483,6 +2532,9 @@
case 'U':
d_advance (di, 1);
ret = d_source_name (di);
+ if (d_peek_char (di) == 'I')
+ ret = d_make_comp (di, DEMANGLE_COMPONENT_TEMPLATE, ret,
+ d_template_args (di));
ret = d_make_comp (di, DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL,
cplus_demangle_type (di), ret);
break;
@@ -2590,7 +2642,7 @@
return ret;
}
-/* <CV-qualifiers> ::= [r] [V] [K] */
+/* <CV-qualifiers> ::= [r] [V] [K] [Dx] */
static struct demangle_component **
d_cv_qualifiers (struct d_info *di,
@@ -2601,7 +2653,8 @@
pstart = pret;
peek = d_peek_char (di);
- while (peek == 'r' || peek == 'V' || peek == 'K')
+ while (peek == 'r' || peek == 'V' || peek == 'K'
+ || (peek == 'D' && d_peek_next_char (di) == 'x'))
{
enum demangle_component_type t;
@@ -2620,13 +2673,19 @@
: DEMANGLE_COMPONENT_VOLATILE);
di->expansion += sizeof "volatile";
}
- else
+ else if (peek == 'K')
{
t = (member_fn
? DEMANGLE_COMPONENT_CONST_THIS
: DEMANGLE_COMPONENT_CONST);
di->expansion += sizeof "const";
}
+ else
+ {
+ t = DEMANGLE_COMPONENT_TRANSACTION_SAFE;
+ di->expansion += sizeof "transaction_safe";
+ d_advance (di, 1);
+ }
*pret = d_make_comp (di, t, NULL, NULL);
if (*pret == NULL)
@@ -2692,7 +2751,7 @@
return ret;
}
-/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] E */
+/* <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] [T] E */
static struct demangle_component *
d_function_type (struct d_info *di)
@@ -2918,10 +2977,10 @@
/* <non-negative number> _ */
-static long
+static int
d_compact_number (struct d_info *di)
{
- long num;
+ int num;
if (d_peek_char (di) == '_')
num = 0;
else if (d_peek_char (di) == 'n')
@@ -2929,7 +2988,7 @@
else
num = d_number (di) + 1;
- if (! d_check_char (di, '_'))
+ if (num < 0 || ! d_check_char (di, '_'))
return -1;
return num;
}
@@ -2941,7 +3000,7 @@
static struct demangle_component *
d_template_param (struct d_info *di)
{
- long param;
+ int param;
if (! d_check_char (di, 'T'))
return NULL;
@@ -2960,6 +3019,19 @@
static struct demangle_component *
d_template_args (struct d_info *di)
{
+ if (d_peek_char (di) != 'I'
+ && d_peek_char (di) != 'J')
+ return NULL;
+ d_advance (di, 1);
+
+ return d_template_args_1 (di);
+}
+
+/* <template-arg>* E */
+
+static struct demangle_component *
+d_template_args_1 (struct d_info *di)
+{
struct demangle_component *hold_last_name;
struct demangle_component *al;
struct demangle_component **pal;
@@ -2969,11 +3041,6 @@
constructor or destructor. */
hold_last_name = di->last_name;
- if (d_peek_char (di) != 'I'
- && d_peek_char (di) != 'J')
- return NULL;
- d_advance (di, 1);
-
if (d_peek_char (di) == 'E')
{
/* An argument pack can be empty. */
@@ -3143,9 +3210,10 @@
}
else
{
- index = d_compact_number (di) + 1;
- if (index == 0)
+ index = d_compact_number (di);
+ if (index == INT_MAX || index == -1)
return NULL;
+ index++;
}
return d_make_function_param (di, index);
}
@@ -3176,6 +3244,8 @@
struct demangle_component *type = NULL;
if (peek == 't')
type = cplus_demangle_type (di);
+ if (!d_peek_next_char (di))
+ return NULL;
d_advance (di, 2);
return d_make_comp (di, DEMANGLE_COMPONENT_INITIALIZER_LIST,
type, d_exprlist (di, 'E'));
@@ -3232,6 +3302,8 @@
if (op->type == DEMANGLE_COMPONENT_CAST
&& d_check_char (di, '_'))
operand = d_exprlist (di, 'E');
+ else if (code && !strcmp (code, "sP"))
+ operand = d_template_args_1 (di);
else
operand = d_expression_1 (di);
@@ -3250,8 +3322,13 @@
struct demangle_component *left;
struct demangle_component *right;
+ if (code == NULL)
+ return NULL;
if (op_is_new_cast (op))
left = cplus_demangle_type (di);
+ else if (code[0] == 'f')
+ /* fold-expression. */
+ left = d_operator_name (di);
else
left = d_expression_1 (di);
if (!strcmp (code, "cl"))
@@ -3277,13 +3354,22 @@
struct demangle_component *second;
struct demangle_component *third;
- if (!strcmp (code, "qu"))
+ if (code == NULL)
+ return NULL;
+ else if (!strcmp (code, "qu"))
{
/* ?: expression. */
first = d_expression_1 (di);
second = d_expression_1 (di);
third = d_expression_1 (di);
}
+ else if (code[0] == 'f')
+ {
+ /* fold-expression. */
+ first = d_operator_name (di);
+ second = d_expression_1 (di);
+ third = d_expression_1 (di);
+ }
else if (code[0] == 'n')
{
/* new-expression. */
@@ -3468,7 +3554,7 @@
static int
d_discriminator (struct d_info *di)
{
- long discrim;
+ int discrim;
if (d_peek_char (di) != '_')
return 1;
@@ -3524,7 +3610,7 @@
d_unnamed_type (struct d_info *di)
{
struct demangle_component *ret;
- long num;
+ int num;
if (! d_check_char (di, 'U'))
return NULL;
@@ -3700,6 +3786,7 @@
{
const char *s;
int len;
+ struct demangle_component *dc;
if (p->set_last_name != NULL)
di->last_name = d_make_sub (di, p->set_last_name,
@@ -3715,7 +3802,15 @@
len = p->simple_len;
}
di->expansion += len;
- return d_make_sub (di, s, len);
+ dc = d_make_sub (di, s, len);
+ if (d_peek_char (di) == 'B')
+ {
+ /* If there are ABI tags on the abbreviation, it becomes
+ a substitution candidate. */
+ dc = d_abi_tags (di, dc);
+ d_add_substitution (di, dc);
+ }
+ return dc;
}
}
@@ -3882,6 +3977,7 @@
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
case DEMANGLE_COMPONENT_POINTER:
case DEMANGLE_COMPONENT_COMPLEX:
@@ -3890,12 +3986,12 @@
case DEMANGLE_COMPONENT_FUNCTION_TYPE:
case DEMANGLE_COMPONENT_ARRAY_TYPE:
case DEMANGLE_COMPONENT_PTRMEM_TYPE:
- case DEMANGLE_COMPONENT_FIXED_TYPE:
case DEMANGLE_COMPONENT_VECTOR_TYPE:
case DEMANGLE_COMPONENT_ARGLIST:
case DEMANGLE_COMPONENT_TEMPLATE_ARGLIST:
case DEMANGLE_COMPONENT_INITIALIZER_LIST:
case DEMANGLE_COMPONENT_CAST:
+ case DEMANGLE_COMPONENT_CONVERSION:
case DEMANGLE_COMPONENT_NULLARY:
case DEMANGLE_COMPONENT_UNARY:
case DEMANGLE_COMPONENT_BINARY:
@@ -3935,6 +4031,11 @@
dc->u.s_extended_operator.name);
break;
+ case DEMANGLE_COMPONENT_FIXED_TYPE:
+ d_count_templates_scopes (num_templates, num_scopes,
+ dc->u.s_fixed.length);
+ break;
+
case DEMANGLE_COMPONENT_GLOBAL_CONSTRUCTORS:
case DEMANGLE_COMPONENT_GLOBAL_DESTRUCTORS:
d_count_templates_scopes (num_templates, num_scopes,
@@ -4037,10 +4138,10 @@
}
static inline void
-d_append_num (struct d_print_info *dpi, long l)
+d_append_num (struct d_print_info *dpi, int l)
{
char buf[25];
- sprintf (buf,"%ld", l);
+ sprintf (buf,"%d", l);
d_append_string (dpi, buf);
}
@@ -4072,8 +4173,12 @@
{
#if 0 /* in valgrind */
#ifdef CP_DYNAMIC_ARRAYS
- __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes ?: 1];
- __extension__ struct d_print_template temps[dpi.num_copy_templates ?: 1];
+ /* Avoid zero-length VLAs, which are prohibited by the C99 standard
+ and flagged as errors by Address Sanitizer. */
+ __extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0)
+ ? dpi.num_saved_scopes : 1];
+ __extension__ struct d_print_template temps[(dpi.num_copy_templates > 0)
+ ? dpi.num_copy_templates : 1];
dpi.saved_scopes = scopes;
dpi.copy_templates = temps;
@@ -4138,13 +4243,17 @@
}
/* Returns the I'th element of the template arglist ARGS, or NULL on
- failure. */
+ failure. If I is negative, return the entire arglist. */
static struct demangle_component *
d_index_template_argument (struct demangle_component *args, int i)
{
struct demangle_component *a;
+ if (i < 0)
+ /* Print the whole argument pack. */
+ return args;
+
for (a = args;
a != NULL;
a = d_right (a))
@@ -4209,6 +4318,9 @@
case DEMANGLE_COMPONENT_CHARACTER:
case DEMANGLE_COMPONENT_FUNCTION_PARAM:
case DEMANGLE_COMPONENT_UNNAMED_TYPE:
+ case DEMANGLE_COMPONENT_FIXED_TYPE:
+ case DEMANGLE_COMPONENT_DEFAULT_ARG:
+ case DEMANGLE_COMPONENT_NUMBER:
return NULL;
case DEMANGLE_COMPONENT_EXTENDED_OPERATOR:
@@ -4241,6 +4353,30 @@
return count;
}
+/* Returns the number of template args in DC, expanding any pack expansions
+ found there. */
+
+static int
+d_args_length (struct d_print_info *dpi, const struct demangle_component *dc)
+{
+ int count = 0;
+ for (; dc && dc->type == DEMANGLE_COMPONENT_TEMPLATE_ARGLIST;
+ dc = d_right (dc))
+ {
+ struct demangle_component *elt = d_left (dc);
+ if (elt == NULL)
+ break;
+ if (elt->type == DEMANGLE_COMPONENT_PACK_EXPANSION)
+ {
+ struct demangle_component *a = d_find_pack (dpi, d_left (elt));
+ count += d_pack_length (a);
+ }
+ else
+ ++count;
+ }
+ return count;
+}
+
/* DC is a component of a mangled expression. Print it, wrapped in parens
if needed. */
@@ -4317,6 +4453,70 @@
return NULL;
}
+/* If DC is a C++17 fold-expression, print it and return true; otherwise
+ return false. */
+
+static int
+d_maybe_print_fold_expression (struct d_print_info *dpi, int options,
+ const struct demangle_component *dc)
+{
+ const struct demangle_component *ops, *operator_, *op1, *op2;
+ int save_idx;
+
+ const char *fold_code = d_left (dc)->u.s_operator.op->code;
+ if (fold_code[0] != 'f')
+ return 0;
+
+ ops = d_right (dc);
+ operator_ = d_left (ops);
+ op1 = d_right (ops);
+ op2 = 0;
+ if (op1->type == DEMANGLE_COMPONENT_TRINARY_ARG2)
+ {
+ op2 = d_right (op1);
+ op1 = d_left (op1);
+ }
+
+ /* Print the whole pack. */
+ save_idx = dpi->pack_index;
+ dpi->pack_index = -1;
+
+ switch (fold_code[1])
+ {
+ /* Unary left fold, (... + X). */
+ case 'l':
+ d_append_string (dpi, "(...");
+ d_print_expr_op (dpi, options, operator_);
+ d_print_subexpr (dpi, options, op1);
+ d_append_char (dpi, ')');
+ break;
+
+ /* Unary right fold, (X + ...). */
+ case 'r':
+ d_append_char (dpi, '(');
+ d_print_subexpr (dpi, options, op1);
+ d_print_expr_op (dpi, options, operator_);
+ d_append_string (dpi, "...)");
+ break;
+
+ /* Binary left fold, (42 + ... + X). */
+ case 'L':
+ /* Binary right fold, (X + ... + 42). */
+ case 'R':
+ d_append_char (dpi, '(');
+ d_print_subexpr (dpi, options, op1);
+ d_print_expr_op (dpi, options, operator_);
+ d_append_string (dpi, "...");
+ d_print_expr_op (dpi, options, operator_);
+ d_print_subexpr (dpi, options, op2);
+ d_append_char (dpi, ')');
+ break;
+ }
+
+ dpi->pack_index = save_idx;
+ return 1;
+}
+
/* Subroutine to handle components. */
static void
@@ -4412,6 +4612,7 @@
&& typed_name->type != DEMANGLE_COMPONENT_VOLATILE_THIS
&& typed_name->type != DEMANGLE_COMPONENT_CONST_THIS
&& typed_name->type != DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS
+ && typed_name->type != DEMANGLE_COMPONENT_TRANSACTION_SAFE
&& typed_name->type != DEMANGLE_COMPONENT_REFERENCE_THIS)
break;
@@ -4444,10 +4645,16 @@
local_name = d_right (typed_name);
if (local_name->type == DEMANGLE_COMPONENT_DEFAULT_ARG)
local_name = local_name->u.s_unary_num.sub;
+ if (local_name == NULL)
+ {
+ d_print_error (dpi);
+ return;
+ }
while (local_name->type == DEMANGLE_COMPONENT_RESTRICT_THIS
|| local_name->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| local_name->type == DEMANGLE_COMPONENT_CONST_THIS
|| local_name->type == DEMANGLE_COMPONENT_REFERENCE_THIS
+ || local_name->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| (local_name->type
== DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS))
{
@@ -4783,6 +4990,7 @@
case DEMANGLE_COMPONENT_POINTER:
case DEMANGLE_COMPONENT_COMPLEX:
case DEMANGLE_COMPONENT_IMAGINARY:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
modifier:
{
/* We keep a list of modifiers on the stack. */
@@ -5032,9 +5240,9 @@
d_print_comp (dpi, options, dc->u.s_extended_operator.name);
return;
- case DEMANGLE_COMPONENT_CAST:
+ case DEMANGLE_COMPONENT_CONVERSION:
d_append_string (dpi, "operator ");
- d_print_cast (dpi, options, dc);
+ d_print_conversion (dpi, options, dc);
return;
case DEMANGLE_COMPONENT_NULLARY:
@@ -5069,6 +5277,21 @@
}
}
+ /* For sizeof..., just print the pack length. */
+ if (code && !strcmp (code, "sZ"))
+ {
+ struct demangle_component *a = d_find_pack (dpi, operand);
+ int len = d_pack_length (a);
+ d_append_num (dpi, len);
+ return;
+ }
+ else if (code && !strcmp (code, "sP"))
+ {
+ int len = d_args_length (dpi, operand);
+ d_append_num (dpi, len);
+ return;
+ }
+
if (op->type != DEMANGLE_COMPONENT_CAST)
d_print_expr_op (dpi, options, op);
else
@@ -5110,6 +5333,9 @@
return;
}
+ if (d_maybe_print_fold_expression (dpi, options, dc))
+ return;
+
/* We wrap an expression which uses the greater-than operator in
an extra layer of parens so that it does not get confused
with the '>' which ends the template parameters. */
@@ -5165,6 +5391,8 @@
d_print_error (dpi);
return;
}
+ if (d_maybe_print_fold_expression (dpi, options, dc))
+ return;
{
struct demangle_component *op = d_left (dc);
struct demangle_component *first = d_left (d_right (dc));
@@ -5471,6 +5699,7 @@
|| mods->mod->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| mods->mod->type == DEMANGLE_COMPONENT_CONST_THIS
|| mods->mod->type == DEMANGLE_COMPONENT_REFERENCE_THIS
+ || mods->mod->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| (mods->mod->type
== DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS))))
{
@@ -5529,6 +5758,7 @@
|| dc->type == DEMANGLE_COMPONENT_VOLATILE_THIS
|| dc->type == DEMANGLE_COMPONENT_CONST_THIS
|| dc->type == DEMANGLE_COMPONENT_REFERENCE_THIS
+ || dc->type == DEMANGLE_COMPONENT_TRANSACTION_SAFE
|| dc->type == DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS)
dc = d_left (dc);
@@ -5565,6 +5795,9 @@
case DEMANGLE_COMPONENT_CONST_THIS:
d_append_string (dpi, " const");
return;
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
+ d_append_string (dpi, " transaction_safe");
+ return;
case DEMANGLE_COMPONENT_VENDOR_TYPE_QUAL:
d_append_char (dpi, ' ');
d_print_comp (dpi, options, d_right (mod));
@@ -5577,11 +5810,13 @@
case DEMANGLE_COMPONENT_REFERENCE_THIS:
/* For the ref-qualifier, put a space before the &. */
d_append_char (dpi, ' ');
+ /* FALLTHRU */
case DEMANGLE_COMPONENT_REFERENCE:
d_append_char (dpi, '&');
return;
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
d_append_char (dpi, ' ');
+ /* FALLTHRU */
case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
d_append_string (dpi, "&&");
return;
@@ -5655,6 +5890,7 @@
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
break;
default:
break;
@@ -5767,11 +6003,20 @@
static void
d_print_cast (struct d_print_info *dpi, int options,
- const struct demangle_component *dc)
+ const struct demangle_component *dc)
+{
+ d_print_comp (dpi, options, d_left (dc));
+}
+
+/* Print a conversion operator. */
+
+static void
+d_print_conversion (struct d_print_info *dpi, int options,
+ const struct demangle_component *dc)
{
struct d_print_template dpt;
- /* For a cast operator, we need the template parameters from
+ /* For a conversion operator, we need the template parameters from
the enclosing template in scope for processing the type. */
if (dpi->current_template != NULL)
{
@@ -6206,6 +6451,7 @@
case DEMANGLE_COMPONENT_CONST_THIS:
case DEMANGLE_COMPONENT_REFERENCE_THIS:
case DEMANGLE_COMPONENT_RVALUE_REFERENCE_THIS:
+ case DEMANGLE_COMPONENT_TRANSACTION_SAFE:
default:
dc = NULL;
break;
Modified: trunk/coregrind/m_demangle/cp-demangle.h
==============================================================================
--- trunk/coregrind/m_demangle/cp-demangle.h (original)
+++ trunk/coregrind/m_demangle/cp-demangle.h Tue Sep 13 20:06:23 2016
@@ -135,12 +135,37 @@
- call d_check_char(di, '\0')
Everything else is safe. */
#define d_peek_char(di) (*((di)->n))
-#define d_peek_next_char(di) ((di)->n[1])
-#define d_advance(di, i) ((di)->n += (i))
+#ifndef CHECK_DEMANGLER
+# define d_peek_next_char(di) ((di)->n[1])
+# define d_advance(di, i) ((di)->n += (i))
+#endif
#define d_check_char(di, c) (d_peek_char(di) == c ? ((di)->n++, 1) : 0)
#define d_next_char(di) (d_peek_char(di) == '\0' ? '\0' : *((di)->n++))
#define d_str(di) ((di)->n)
+#ifdef CHECK_DEMANGLER
+static inline char
+d_peek_next_char (const struct d_info *di)
+{
+ if (!di->n[0])
+ abort ();
+ return di->n[1];
+}
+
+static inline void
+d_advance (struct d_info *di, int i)
+{
+ if (i < 0)
+ abort ();
+ while (i--)
+ {
+ if (!di->n[0])
+ abort ();
+ di->n++;
+ }
+}
+#endif
+
/* Functions and arrays in cp-demangle.c which are referenced by
functions in cp-demint.c. */
#ifdef IN_GLIBCPP_V3
Modified: trunk/coregrind/m_demangle/cplus-dem.c
==============================================================================
--- trunk/coregrind/m_demangle/cplus-dem.c (original)
+++ trunk/coregrind/m_demangle/cplus-dem.c Tue Sep 13 20:06:23 2016
@@ -65,6 +65,15 @@
#endif /* ! in valgrind */
#if 0 /* in valgrind */
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#endif /* ! in valgrind */
+#ifndef INT_MAX
+# define INT_MAX (int)(((unsigned int) ~0) >> 1) /* 0x7FFFFFFF */
+#endif
+
+#if 0 /* in valgrind */
#include <demangle.h>
#undef CURRENT_DEMANGLING_STYLE
#define CURRENT_DEMANGLING_STYLE work->options
@@ -155,6 +164,9 @@
string* previous_argument; /* The last function argument demangled. */
int nrepeats; /* The number of times to repeat the previous
argument. */
+ int *proctypevec; /* Indices of currently processed remembered typevecs. */
+ int proctypevec_size;
+ int nproctypes;
};
#define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI)
@@ -255,6 +267,7 @@
tk_none,
tk_pointer,
tk_reference,
+ tk_rvalue_reference,
tk_integral,
tk_bool,
tk_char,
@@ -324,6 +337,12 @@
}
,
{
+ DLANG_DEMANGLING_STYLE_STRING,
+ dlang_demangling,
+ "DLANG style demangling"
+ }
+ ,
+ {
NULL, unknown_demangling, NULL
}
};
@@ -439,6 +458,10 @@
static void remember_type (struct work_stuff *, const char *, int);
+static void push_processed_type (struct work_stuff *, int);
+
+static void pop_processed_type (struct work_stuff *);
+
static void remember_Btype (struct work_stuff *, const char *, int, int);
static int register_Btype (struct work_stuff *);
@@ -887,6 +910,13 @@
if (GNAT_DEMANGLING)
return ada_demangle (mangled, options);
+ if (DLANG_DEMANGLING)
+ {
+ ret = dlang_demangle (mangled, options);
+ if (ret)
+ return ret;
+ }
+
ret = internal_cplus_demangle (work, mangled);
squangle_mop_up (work);
return (ret);
@@ -1241,11 +1271,13 @@
{
free ((char *) work -> btypevec);
work->btypevec = NULL;
+ work->bsize = 0;
}
if (work -> ktypevec != NULL)
{
free ((char *) work -> ktypevec);
work->ktypevec = NULL;
+ work->ksize = 0;
}
}
@@ -1296,6 +1328,10 @@
memcpy (to->btypevec[i], from->btypevec[i], len);
}
+ if (from->proctypevec)
+ to->proctypevec =
+ XDUPVEC (int, from->proctypevec, from->proctypevec_size);
+
if (from->ntmpl_args)
to->tmpl_argvec = XNEWVEC (char *, from->ntmpl_args);
@@ -1324,11 +1360,17 @@
/* Discard the remembered types, if any. */
forget_types (work);
- if (work -> typevec != NULL)
+ if (work->typevec != NULL)
{
- free ((char *) work -> typevec);
- work -> typevec = NULL;
- work -> typevec_size = 0;
+ free ((char *) work->typevec);
+ work->typevec = NULL;
+ work->typevec_size = 0;
+ }
+ if (work->proctypevec != NULL)
+ {
+ free (work->proctypevec);
+ work->proctypevec = NULL;
+ work->proctypevec_size = 0;
}
if (work->tmpl_argvec)
{
@@ -2037,7 +2079,8 @@
}
else if (tk == tk_real)
success = demangle_real_value (work, mangled, s);
- else if (tk == tk_pointer || tk == tk_reference)
+ else if (tk == tk_pointer || tk == tk_reference
+ || tk == tk_rvalue_reference)
{
if (**mangled == 'Q')
success = demangle_qualified (work, mangled, s,
@@ -2046,7 +2089,8 @@
else
{
int symbol_len = consume_count (mangled);
- if (symbol_len == -1)
+ if (symbol_len == -1
+ || symbol_len > (long) strlen (*mangled))
return -1;
if (symbol_len == 0)
string_appendn (s, "0", 1);
@@ -3003,6 +3047,11 @@
success = 1;
break;
}
+ else if (n == -1)
+ {
+ success = 0;
+ break;
+ }
}
else
{
@@ -3542,6 +3591,8 @@
do_type (struct work_stuff *work, const char **mangled, string *result)
{
int n;
+ int i;
+ int is_proctypevec;
int done;
int success;
string decl;
@@ -3554,6 +3605,7 @@
done = 0;
success = 1;
+ is_proctypevec = 0;
while (success && !done)
{
int member;
@@ -3578,6 +3630,14 @@
tk = tk_reference;
break;
+ /* An rvalue reference type */
+ case 'O':
+ (*mangled)++;
+ string_prepend (&decl, "&&");
+ if (tk == tk_none)
+ tk = tk_rvalue_reference;
+ break;
+
/* An array */
case 'A':
{
@@ -3601,13 +3661,20 @@
/* A back reference to a previously seen type */
case 'T':
(*mangled)++;
- if (!get_count (mangled, &n) || n >= work -> ntypes)
+ if (!get_count (mangled, &n) || n < 0 || n >= work -> ntypes)
{
success = 0;
}
else
- {
- remembered_type = work -> typevec[n];
+ for (i = 0; i < work->nproctypes; i++)
+ if (work -> proctypevec [i] == n)
+ success = 0;
+
+ if (success)
+ {
+ is_proctypevec = 1;
+ push_processed_type (work, n);
+ remembered_type = work->typevec[n];
mangled = &remembered_type;
}
break;
@@ -3635,7 +3702,6 @@
break;
case 'M':
- case 'O':
{
type_quals = TYPE_UNQUALIFIED;
@@ -3779,7 +3845,7 @@
/* A back reference to a previously seen squangled type */
case 'B':
(*mangled)++;
- if (!get_count (mangled, &n) || n >= work -> numb)
+ if (!get_count (mangled, &n) || n < 0 || n >= work -> numb)
success = 0;
else
string_append (result, work->btypevec[n]);
@@ -3830,6 +3896,9 @@
string_delete (result);
string_delete (&decl);
+ if (is_proctypevec)
+ pop_processed_type (work);
+
if (success)
/* Assume an integral type, if we're not sure. */
return (int) ((tk == tk_none) ? tk_integral : tk);
@@ -4127,7 +4196,8 @@
literal_len = consume_count (mangled);
- if (literal_len <= 0)
+ if (literal_len <= 0
+ || literal_len > (long) strlen (*mangled))
return 0;
/* Literal parameters are names of arrays, functions, etc. and the
@@ -4249,6 +4319,41 @@
}
static void
+push_processed_type (struct work_stuff *work, int typevec_index)
+{
+ if (work->nproctypes >= work->proctypevec_size)
+ {
+ if (!work->proctypevec_size)
+ {
+ work->proctypevec_size = 4;
+ work->proctypevec = XNEWVEC (int, work->proctypevec_size);
+ }
+ else
+ {
+ if (work->proctypevec_size < 16)
+ /* Double when small. */
+ work->proctypevec_size *= 2;
+ else
+ {
+ /* Grow slower when large. */
+ if (work->proctypevec_size > (INT_MAX / 3) * 2)
+ xmalloc_failed (INT_MAX);
+ work->proctypevec_size = (work->proctypevec_size * 3 / 2);
+ }
+ work->proctypevec
+ = XRESIZEVEC (int, work->proctypevec, work->proctypevec_size);
+ }
+ }
+ work->proctypevec [work->nproctypes++] = typevec_index;
+}
+
+static void
+pop_processed_type (struct work_stuff *work)
+{
+ work->nproctypes--;
+}
+
+static void
remember_type (struct work_stuff *work, const char *start, int len)
{
char *tem;
@@ -4265,6 +4370,8 @@
}
else
{
+ if (work -> typevec_size > INT_MAX / 2)
+ xmalloc_failed (INT_MAX);
work -> typevec_size *= 2;
work -> typevec
= XRESIZEVEC (char *, work->typevec, work->typevec_size);
@@ -4292,6 +4399,8 @@
}
else
{
+ if (work -> ksize > INT_MAX / 2)
+ xmalloc_failed (INT_MAX);
work -> ksize *= 2;
work -> ktypevec
= XRESIZEVEC (char *, work->ktypevec, work->ksize);
@@ -4321,6 +4430,8 @@
}
else
{
+ if (work -> bsize > INT_MAX / 2)
+ xmalloc_failed (INT_MAX);
work -> bsize *= 2;
work -> btypevec
= XRESIZEVEC (char *, work->btypevec, work->bsize);
@@ -4506,10 +4617,13 @@
{
string_append (declp, ", ");
}
+ push_processed_type (work, t);
if (!do_arg (work, &tem, &arg))
{
+ pop_processed_type (work);
return (0);
}
+ pop_processed_type (work);
if (PRINT_ARG_TYPES)
{
string_appends (declp, &arg);
@@ -4791,6 +4905,8 @@
else if (s->e - s->p < n)
{
tem = s->p - s->b;
+ if (n > INT_MAX / 2 - tem)
+ xmalloc_failed (INT_MAX);
n += tem;
n *= 2;
s->b = XRESIZEVEC (char, s->b, n);
Added: trunk/coregrind/m_demangle/d-demangle.c
==============================================================================
--- trunk/coregrind/m_demangle/d-demangle.c (added)
+++ trunk/coregrind/m_demangle/d-demangle.c Tue Sep 13 20:06:23 2016
@@ -0,0 +1,1618 @@
+/* Demangler for the D programming language
+ Copyright 2014, 2015, 2016 Free Software Foundation, Inc.
+ Written by Iain Buclaw (ib...@gd...)
+
+This file is part of the libiberty library.
+Libiberty 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 of the License, 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.)
+
+Libiberty 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 libiberty; see the file COPYING.LIB.
+If not, see <http://www.gnu.org/licenses/>. */
+
+/* This file exports one function; dlang_demangle.
+
+ This file imports strtol for decoding mangled literals. */
+
+#if 0 /* in valgrind */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#endif /* ! in valgrind */
+
+#if 0 /* in valgrind */
+#include "safe-ctype.h"
+#endif /* ! in valgrind */
+
+#if 0 /* in valgrind */
+#include <sys/types.h>
+#include <string.h>
+#include <stdio.h>
+#endif /* ! in valgrind */
+
+#if 0 /* in valgrind */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern long strtol (const char *nptr, char **endptr, int base);
+#endif
+#endif /* ! in valgrind */
+
+#if 0 /* in valgrind */
+#include <demangle.h>
+#include "libiberty.h"
+#endif /* ! in valgrind */
+
+#include "vg_libciface.h"
+
+#include "ansidecl.h"
+#include "demangle.h"
+#include "safe-ctype.h"
+
+/* A mini string-handling package */
+
+typedef struct string /* Beware: these aren't required to be */
+{ /* '\0' terminated. */
+ char *b; /* pointer to start of string */
+ char *p; /* pointer after last character */
+ char *e; /* pointer after end of allocated space */
+} string;
+
+static void
+string_need (string *s, int n)
+{
+ int tem;
+
+ if (s->b == NULL)
+ {
+ if (n < 32)
+ {
+ n = 32;
+ }
+ s->p = s->b = XNEWVEC (char, n);
+ s->e = s->b + n;
+ }
+ else if (s->e - s->p < n)
+ {
+ tem = s->p - s->b;
+ n += tem;
+ n *= 2;
+ s->b = XRESIZEVEC (char, s->b, n);
+ s->p = s->b + tem;
+ s->e = s->b + n;
+ }
+}
+
+static void
+string_delete (string *s)
+{
+ if (s->b != NULL)
+ {
+ XDELETEVEC (s->b);
+ s->b = s->e = s->p = NULL;
+ }
+}
+
+static void
+string_init (string *s)
+{
+ s->b = s->p = s->e = NULL;
+}
+
+static int
+string_length (string *s)
+{
+ if (s->p == s->b)
+ {
+ return 0;
+ }
+ return s->p - s->b;
+}
+
+static void
+string_setlength (string *s, int n)
+{
+ if (n - string_length (s) < 0)
+ {
+ s->p = s->b + n;
+ }
+}
+
+static void
+string_append (string *p, const char *s)
+{
+ int n = strlen (s);
+ string_need (p, n);
+ memcpy (p->p, s, n);
+ p->p += n;
+}
+
+static void
+string_appendn (string *p, const char *s, int n)
+{
+ if (n != 0)
+ {
+ string_need (p, n);
+ memcpy (p->p, s, n);
+ p->p += n;
+ }
+}
+
+static void
+string_prependn (string *p, const char *s, int n)
+{
+ char *q;
+
+ if (n != 0)
+ {
+ string_need (p, n);
+ for (q = p->p - 1; q >= p->b; q--)
+ {
+ q[n] = q[0];
+ }
+ memcpy (p->b, s, n);
+ p->p += n;
+ }
+}
+
+static void
+string_prepend (string *p, const char *s)
+{
+ if (s != NULL && *s != '\0')
+ {
+ string_prependn (p, s, strlen (s));
+ }
+}
+
+/* What kinds of symbol we could be parsing. */
+enum dlang_symbol_kinds
+{
+ /* Top-level symbol, needs it's type checked. */
+ dlang_top_level,
+ /* Function symbol, needs it's type checked. */
+ dlang_function,
+ /* Strongly typed name, such as for classes, structs and enums. */
+ dlang_type_name,
+ /* Template identifier. */
+ dlang_template_ident,
+ /* Template symbol parameter. */
+ dlang_template_param
+};
+
+/* Prototypes for forward referenced functions */
+static const char *dlang_function_args (string *, const char *);
+
+static const char *dlang_type (string *, const char *);
+
+static const char *dlang_value (string *, const char *, const char *, char);
+
+static const char *dlang_parse_symbol (string *, const char *,
+ enum dlang_symbol_kinds);
+
+static const char *dlang_parse_tuple (string *, const char *);
+
+static const char *dlang_parse_template (string *, const char *, long);
+
+
+/* Demangle the calling convention from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_call_convention (string *decl, const char *mangled)
+{
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ switch (*mangled)
+ {
+ case 'F': /* (D) */
+ mangled++;
+ break;
+ case 'U': /* (C) */
+ mangled++;
+ string_append (decl, "extern(C) ");
+ break;
+ case 'W': /* (Windows) */
+ mangled++;
+ string_append (decl, "extern(Windows) ");
+ break;
+ case 'V': /* (Pascal) */
+ mangled++;
+ string_append (decl, "extern(Pascal) ");
+ break;
+ case 'R': /* (C++) */
+ mangled++;
+ string_append (decl, "extern(C++) ");
+ break;
+ case 'Y': /* (Objective-C) */
+ mangled++;
+ string_append (decl, "extern(Objective-C) ");
+ break;
+ default:
+ return NULL;
+ }
+
+ return mangled;
+}
+
+/* Extract the type modifiers from MANGLED and append them to DECL.
+ Returns the remaining signature on success or NULL on failure. */
+static const char *
+dlang_type_modifiers (string *decl, const char *mangled)
+{
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ switch (*mangled)
+ {
+ case 'x': /* const */
+ mangled++;
+ string_append (decl, " const");
+ return mangled;
+ case 'y': /* immutable */
+ mangled++;
+ string_append (decl, " immutable");
+ return mangled;
+ case 'O': /* shared */
+ mangled++;
+ string_append (decl, " shared");
+ return dlang_type_modifiers (decl, mangled);
+ case 'N':
+ mangled++;
+ if (*mangled == 'g') /* wild */
+ {
+ mangled++;
+ string_append (decl, " inout");
+ return dlang_type_modifiers (decl, mangled);
+ }
+ else
+ return NULL;
+
+ default:
+ return mangled;
+ }
+}
+
+/* Demangle the D function attributes from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_attributes (string *decl, const char *mangled)
+{
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ while (*mangled == 'N')
+ {
+ mangled++;
+ switch (*mangled)
+ {
+ case 'a': /* pure */
+ mangled++;
+ string_append (decl, "pure ");
+ continue;
+ case 'b': /* nothrow */
+ mangled++;
+ string_append (decl, "nothrow ");
+ continue;
+ case 'c': /* ref */
+ mangled++;
+ string_append (decl, "ref ");
+ continue;
+ case 'd': /* @property */
+ mangled++;
+ string_append (decl, "@property ");
+ continue;
+ case 'e': /* @trusted */
+ mangled++;
+ string_append (decl, "@trusted ");
+ continue;
+ case 'f': /* @safe */
+ mangled++;
+ string_append (decl, "@safe ");
+ continue;
+ case 'g':
+ case 'h':
+ case 'k':
+ /* inout parameter is represented as 'Ng'.
+ vector parameter is represented as 'Nh'.
+ return paramenter is represented as 'Nk'.
+ If we see this, then we know we're really in the
+ parameter list. Rewind and break. */
+ mangled--;
+ break;
+ case 'i': /* @nogc */
+ mangled++;
+ string_append (decl, "@nogc ");
+ continue;
+ case 'j': /* return */
+ mangled++;
+ string_append (decl, "return ");
+ continue;
+
+ default: /* unknown attribute */
+ return NULL;
+ }
+ break;
+ }
+
+ return mangled;
+}
+
+/* Demangle the function type from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_function_type (string *decl, const char *mangled)
+{
+ string attr, args, type;
+ size_t szattr, szargs, sztype;
+
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ /* The order of the mangled string is:
+ CallConvention FuncAttrs Arguments ArgClose Type
+
+ The demangled string is re-ordered as:
+ CallConvention Type Arguments FuncAttrs
+ */
+ string_init (&attr);
+ string_init (&args);
+ string_init (&type);
+
+ /* Function call convention. */
+ mangled = dlang_call_convention (decl, mangled);
+
+ /* Function attributes. */
+ mangled = dlang_attributes (&attr, mangled);
+ szattr = string_length (&attr);
+
+ /* Function arguments. */
+ mangled = dlang_function_args (&args, mangled);
+ szargs = string_length (&args);
+
+ /* Function return type. */
+ mangled = dlang_type (&type, mangled);
+ sztype = string_length (&type);
+
+ /* Append to decl in order. */
+ string_appendn (decl, type.b, sztype);
+ string_append (decl, "(");
+ string_appendn (decl, args.b, szargs);
+ string_append (decl, ") ");
+ string_appendn (decl, attr.b, szattr);
+
+ string_delete (&attr);
+ string_delete (&args);
+ string_delete (&type);
+ return mangled;
+}
+
+/* Demangle the argument list from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_function_args (string *decl, const char *mangled)
+{
+ size_t n = 0;
+
+ while (mangled && *mangled != '\0')
+ {
+ switch (*mangled)
+ {
+ case 'X': /* (variadic T t...) style. */
+ mangled++;
+ string_append (decl, "...");
+ return mangled;
+ case 'Y': /* (variadic T t, ...) style. */
+ mangled++;
+ if (n != 0)
+ string_append (decl, ", ");
+ string_append (decl, "...");
+ return mangled;
+ case 'Z': /* Normal function. */
+ mangled++;
+ return mangled;
+ }
+
+ if (n++)
+ string_append (decl, ", ");
+
+ if (*mangled == 'M') /* scope(T) */
+ {
+ mangled++;
+ string_append (decl, "scope ");
+ }
+
+ if (mangled[0] == 'N' && mangled[1] == 'k') /* return(T) */
+ {
+ mangled += 2;
+ string_append (decl, "return ");
+ }
+
+ switch (*mangled)
+ {
+ case 'J': /* out(T) */
+ mangled++;
+ string_append (decl, "out ");
+ break;
+ case 'K': /* ref(T) */
+ mangled++;
+ string_append (decl, "ref ");
+ break;
+ case 'L': /* lazy(T) */
+ mangled++;
+ string_append (decl, "lazy ");
+ break;
+ }
+ mangled = dlang_type (decl, mangled);
+ }
+
+ return mangled;
+}
+
+/* Demangle the type from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_type (string *decl, const char *mangled)
+{
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ switch (*mangled)
+ {
+ case 'O': /* shared(T) */
+ mangled++;
+ string_append (decl, "shared(");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, ")");
+ return mangled;
+ case 'x': /* const(T) */
+ mangled++;
+ string_append (decl, "const(");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, ")");
+ return mangled;
+ case 'y': /* immutable(T) */
+ mangled++;
+ string_append (decl, "immutable(");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, ")");
+ return mangled;
+ case 'N':
+ mangled++;
+ if (*mangled == 'g') /* wild(T) */
+ {
+ mangled++;
+ string_append (decl, "inout(");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, ")");
+ return mangled;
+ }
+ else if (*mangled == 'h') /* vector(T) */
+ {
+ mangled++;
+ string_append (decl, "__vector(");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, ")");
+ return mangled;
+ }
+ else
+ return NULL;
+ case 'A': /* dynamic array (T[]) */
+ mangled++;
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, "[]");
+ return mangled;
+ case 'G': /* static array (T[N]) */
+ {
+ const char *numptr;
+ size_t num = 0;
+ mangled++;
+
+ numptr = mangled;
+ while (ISDIGIT (*mangled))
+ {
+ num++;
+ mangled++;
+ }
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, "[");
+ string_appendn (decl, numptr, num);
+ string_append (decl, "]");
+ return mangled;
+ }
+ case 'H': /* associative array (T[T]) */
+ {
+ string type;
+ size_t sztype;
+ mangled++;
+
+ string_init (&type);
+ mangled = dlang_type (&type, mangled);
+ sztype = string_length (&type);
+
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, "[");
+ string_appendn (decl, type.b, sztype);
+ string_append (decl, "]");
+
+ string_delete (&type);
+ return mangled;
+ }
+ case 'P': /* pointer (T*) */
+ mangled++;
+ /* Function pointer types don't include the trailing asterisk. */
+ switch (*mangled)
+ {
+ case 'F': case 'U': case 'W':
+ case 'V': case 'R': case 'Y':
+ mangled = dlang_function_type (decl, mangled);
+ string_append (decl, "function");
+ return mangled;
+ }
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, "*");
+ return mangled;
+ case 'I': /* ident T */
+ case 'C': /* class T */
+ case 'S': /* struct T */
+ case 'E': /* enum T */
+ case 'T': /* typedef T */
+ mangled++;
+ return dlang_parse_symbol (decl, mangled, dlang_type_name);
+ case 'D': /* delegate T */
+ {
+ string mods;
+ size_t szmods;
+ mangled++;
+
+ string_init (&mods);
+ mangled = dlang_type_modifiers (&mods, mangled);
+ szmods = string_length (&mods);
+
+ mangled = dlang_function_type (decl, mangled);
+ string_append (decl, "delegate");
+ string_appendn (decl, mods.b, szmods);
+
+ string_delete (&mods);
+ return mangled;
+ }
+ case 'B': /* tuple T */
+ mangled++;
+ return dlang_parse_tuple (decl, mangled);
+
+ /* Basic types */
+ case 'n':
+ mangled++;
+ string_append (decl, "none");
+ return mangled;
+ case 'v':
+ mangled++;
+ string_append (decl, "void");
+ return mangled;
+ case 'g':
+ mangled++;
+ string_append (decl, "byte");
+ return mangled;
+ case 'h':
+ mangled++;
+ string_append (decl, "ubyte");
+ return mangled;
+ case 's':
+ mangled++;
+ string_append (decl, "short");
+ return mangled;
+ case 't':
+ mangled++;
+ string_append (decl, "ushort");
+ return mangled;
+ case 'i':
+ mangled++;
+ string_append (decl, "int");
+ return mangled;
+ case 'k':
+ mangled++;
+ string_append (decl, "uint");
+ return mangled;
+ case 'l':
+ mangled++;
+ string_append (decl, "long");
+ return mangled;
+ case 'm':
+ mangled++;
+ string_append (decl, "ulong");
+ return mangled;
+ case 'f':
+ mangled++;
+ string_append (decl, "float");
+ return mangled;
+ case 'd':
+ mangled++;
+ string_append (decl, "double");
+ return mangled;
+ case 'e':
+ mangled++;
+ string_append (decl, "real");
+ return mangled;
+
+ /* Imaginary and Complex types */
+ case 'o':
+ mangled++;
+ string_append (decl, "ifloat");
+ return mangled;
+ case 'p':
+ mangled++;
+ string_append (decl, "idouble");
+ return mangled;
+ case 'j':
+ mangled++;
+ string_append (decl, "ireal");
+ return mangled;
+ case 'q':
+ mangled++;
+ string_append (decl, "cfloat");
+ return mangled;
+ case 'r':
+ mangled++;
+ string_append (decl, "cdouble");
+ return mangled;
+ case 'c':
+ mangled++;
+ string_append (decl, "creal");
+ return mangled;
+
+ /* Other types */
+ case 'b':
+ mangled++;
+ string_append (decl, "bool");
+ return mangled;
+ case 'a':
+ mangled++;
+ string_append (decl, "char");
+ return mangled;
+ case 'u':
+ mangled++;
+ string_append (decl, "wchar");
+ return mangled;
+ case 'w':
+ mangled++;
+ string_append (decl, "dchar");
+ return mangled;
+ case 'z':
+ mangled++;
+ switch (*mangled)
+ {
+ case 'i':
+ mangled++;
+ string_append (decl, "cent");
+ return mangled;
+ case 'k':
+ mangled++;
+ string_append (decl, "ucent");
+ return mangled;
+ }
+ return NULL;
+
+ default: /* unhandled */
+ return NULL;
+ }
+}
+
+/* Extract the identifier from MANGLED and append it to DECL.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_identifier (string *decl, const char *mangled,
+ enum dlang_symbol_kinds kind)
+{
+ char *endptr;
+ long len;
+
+ if (mangled == NULL || *mangled == '\0')
+ return NULL;
+
+ len = strtol (mangled, &endptr, 10);
+
+ if (endptr == NULL || len <= 0)
+ return NULL;
+
+ /* In template parameter symbols, the first character of the mangled
+ name can be a digit. This causes ambiguity issues because the
+ digits of the two numbers are adjacent. */
+ if (kind == dlang_template_param)
+ {
+ long psize = len;
+ char *pend;
+ int saved = string_length (decl);
+
+ /* Work backwards until a match is found. */
+ for (pend = endptr; endptr != NULL; pend--)
+ {
+ mangled = pend;
+
+ /* Reached the beginning of the pointer to the name length,
+ try parsing the entire symbol. */
+ if (psize == 0)
+ {
+ psize = len;
+ pend = endptr;
+ endptr = NULL;
+ }
+
+ /* Check whether template parameter is a function with a valid
+ return type or an untyped identifier. */
+ if (ISDIGIT (*mangled))
+ mangled = dlang_parse_symbol (decl, mangled, dlang_template_ident);
+ else if (strncmp (mangled, "_D", 2) == 0)
+ {
+ mangled += 2;
+ mangled = dlang_parse_symbol (decl, mangled, dlang_function);
+ }
+
+ /* Check for name length mismatch. */
+ if (mangled && (mangled - pend) == psize)
+ return mangled;
+
+ psize /= 10;
+ string_setlength (decl, saved);
+ }
+
+ /* No match on any combinations. */
+ return NULL;
+ }
+ else
+ {
+ if (strlen (endptr) < (size_t) len)
+ return NULL;
+
+ mangled = endptr;
+
+ /* May be a template instance. */
+ if (len >= 5 && strncmp (mangled, "__T", 3) == 0)
+ {
+ /* Template symbol. */
+ if (ISDIGIT (mangled[3]) && mangled[3] != '0')
+ return dlang_parse_template (decl, mangled, len);
+
+ return NULL;
+ }
+
+ switch (len)
+ {
+ case 6:
+ if (strncmp (mangled, "__ctor", len) == 0)
+ {
+ /* Constructor symbol for a class/struct. */
+ string_append (decl, "this");
+ mangled += len;
+ return mangled;
+ }
+ else if (strncmp (mangled, "__dtor", len) == 0)
+ {
+ /* Destructor symbol for a class/struct. */
+ string_append (decl, "~this");
+ mangled += len;
+ return mangled;
+ }
+ else if (strncmp (mangled, "__initZ", len+1) == 0)
+ {
+ /* The static initialiser for a given symbol. */
+ string_append (decl, "init$");
+ mangled += len;
+ return mangled;
+ }
+ else if (strncmp (mangled, "__vtblZ", len+1) == 0)
+ {
+ /* The vtable symbol for a given class. */
+ ...
[truncated message content] |
|
From: <sv...@va...> - 2016-09-13 15:54:42
|
Author: carll
Date: Tue Sep 13 16:54:33 2016
New Revision: 15950
Log:
Adapt massif mmapunmap test to handle ppc64 backtrace
The reported backtrace on ppc64 platform reports "generic_start_main.isra.0"
in the backtrace, where other platforms typically see "main". Adjust the
vgtest file to handle this variation. This is similar to existing changes
as seen in deep-D.post.exp
Bugzilla 368461
Modified:
trunk/NEWS
trunk/massif/tests/Makefile.am
trunk/massif/tests/mmapunmap.vgtest
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Tue Sep 13 16:54:33 2016
@@ -154,6 +154,7 @@
363858 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 4/5
364948 Valgrind does not support the IBM POWER ISA 3.0 instructions, part 5/5
366138 Fix configure errors out when using Xcode 8 (clang 8.0.0)
+368461 mmapunmap test fails on ppc64
n-i-bz Fix incorrect (or infinite loop) unwind on RHEL7 x86 and amd64
n-i-bz massif --pages-as-heap=yes does not report peak caused by mmap+munmap
@@ -164,7 +165,6 @@
n-i-bz Bump allowed shift value for "add.w reg, sp, reg, lsl #N" [vex r3206]
n-i-bz amd64: memcheck false positive with shr %edx
-
Release 3.11.0 (22 September 2015)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/massif/tests/Makefile.am
==============================================================================
--- trunk/massif/tests/Makefile.am (original)
+++ trunk/massif/tests/Makefile.am Tue Sep 13 16:54:33 2016
@@ -24,7 +24,8 @@
long-names.post.exp long-names.stderr.exp long-names.vgtest \
long-time.post.exp long-time.stderr.exp long-time.vgtest \
malloc_usable.stderr.exp malloc_usable.vgtest \
- mmapunmap.post.exp mmapunmap.stderr.exp mmapunmap.vgtest \
+ mmapunmap.post.exp mmapunmap.post.exp-ppc64 \
+ mmapunmap.stderr.exp mmapunmap.vgtest \
new-cpp.post.exp new-cpp.stderr.exp new-cpp.vgtest \
no-stack-no-heap.post.exp no-stack-no-heap.stderr.exp no-stack-no-heap.vgtest \
null.post.exp null.stderr.exp null.vgtest \
Modified: trunk/massif/tests/mmapunmap.vgtest
==============================================================================
--- trunk/massif/tests/mmapunmap.vgtest (original)
+++ trunk/massif/tests/mmapunmap.vgtest Tue Sep 13 16:54:33 2016
@@ -2,5 +2,5 @@
vgopts: --pages-as-heap=yes --threshold=30.0 -q
vgopts: --stacks=no --time-unit=B --depth=8 --massif-out-file=massif.out
vgopts: --ignore-fn=__part_load_locale --ignore-fn=__time_load_locale --ignore-fn=dwarf2_unwind_dyld_add_image_hook --ignore-fn=get_or_create_key_element
-post: grep -A4 -e =peak massif.out | grep -e 'main (mmapunmap.c:16)' | tr -s ' ' | ../../tests/filter_addresses
+post: grep -A4 -e =peak massif.out | grep -e 'main (mmapunmap.c:16)\|generic_start_main.isra.0' | tr -s ' ' | ../../tests/filter_addresses | ../../tests/filter_libc
cleanup: rm massif.out
|