diff options
author | DJ Delorie <dj@redhat.com> | 2003-12-01 23:54:49 +0000 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2003-12-01 23:54:49 +0000 |
commit | 24afc00d03499454655395f80cf0edd5d6adfb05 (patch) | |
tree | 89058c0edee55657f2ff59d2753aff52c2ed0502 /libiberty | |
parent | 13570a3db56e082b75bfe548c6f16194bdd7518b (diff) | |
download | gdb-24afc00d03499454655395f80cf0edd5d6adfb05.zip gdb-24afc00d03499454655395f80cf0edd5d6adfb05.tar.gz gdb-24afc00d03499454655395f80cf0edd5d6adfb05.tar.bz2 |
merge from gcc
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 10 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 9 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 15 |
3 files changed, 30 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 329e1f3..6d4c0dc 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,13 @@ +2003-11-29 Ian Lance Taylor <ian@wasabisystems.com> + + * cp-demangle.c (d_demangle): Only return success if we consumed + the entire demangled string. + (is_ctor_or_dtor): Likewise. + + * testsuite/demangle-expected: Revert one part of 2003-06-26 patch + to restore expected result of EDG test case to original expected + result. + 2003-11-26 Ian Lance Taylor <ian@wasabisystems.com> * cp-demangle.c (struct d_print_mod): Add templates field. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index bd67958..0fe568f 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3324,7 +3324,7 @@ d_print_cast (dpi, dc) /* It appears that for a templated cast operator, we need to put the template parameters in scope for the operator name, but not for the parameters. The effect is that we need to handle - the template printing here. FIXME: Verify this. */ + the template printing here. */ hold_dpm = dpi->modifiers; dpi->modifiers = NULL; @@ -3456,6 +3456,11 @@ d_demangle (mangled, options, palc) else dc = d_type (&di); + /* If we didn't consume the entire mangled string, then we didn't + successfully demangle it. */ + if (d_peek_char (&di) != '\0') + dc = NULL; + #ifdef CP_DEMANGLE_DEBUG if (dc == NULL) printf ("failed demangling\n"); @@ -3657,7 +3662,7 @@ is_ctor_or_dtor (mangled, ctor_kind, dtor_kind) dc = d_mangled_name (&di, 1); - if (dc == NULL) + if (dc == NULL || d_peek_char (&di) != '\0') return 0; while (dc != NULL) diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index bfe9253..bb90aa0 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2889,10 +2889,21 @@ _Z1fP1cIPFiiEE f(c<int (*)(int)>*) # # This caused an infinite loop. -# We still don't demangle this correctly, but at least we don't hang. +# +# This is generated by an EDG compiler (kcc 4.0). To demangle it +# correctly, I believe that we have to understand that the J37J deep +# in the string somehow refers back to the type starting 37 characters +# in from some starting point, so that it winds up being the type +# starting with 41THandle.... However, lacking a spec for EDG +# demangling, it's hard to implement this. +# +# In the meantime, this symbol can be successfully demangled in GNU +# mode. Of course the result is more or less nonsense, but an older +# version of g++ would indeed generate this mangled name given the +# appropriate input, so the demangling is correct. --format=auto __CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator -__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm__7_Z1ZZ2Z8iterator +_Z1ZZ2Z::__CPR212____ct__Q3_3std141list__tm__128_Q2_3edm41THandle__tm__26_Q2_4emid15EMparticleChunkQ2_3std68allocator__tm__51_Q2_3edmJ37J14const_iteratorFRCQ3_3std18list__tm(iterator) # # This used to cause a crash. It doesn't follow the C++ encoding so # the demangled name should be identical to the original symbol name. |