From 9934703b912c81702a1a74dd0337d5e3fd291a0f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 10 Jan 2012 19:29:12 +0000 Subject: [PATCH] gdb/ Fix regression after libiberty/ update for GCC PR 6057 and others. * c-exp.y (operator) (operator) : Add trailing space. * cp-name-parser.y (fill_comp, make_operator, make_dtor) (make_builtin_type, make_name): New variable i, add gdb_assert. (operator) : Update ARGS to 3. (operator) : Add trailing space. (operator) : Update ARGS to 3. (operator) : Add trailing space. * cp-support.c (cp_canonicalize_string): Check NULL from cp_comp_to_string, call warning and return. --- gdb/ChangeLog | 14 ++++++++++++++ gdb/c-exp.y | 4 ++-- gdb/cp-name-parser.y | 38 +++++++++++++++++++++++++++++--------- gdb/cp-support.c | 7 +++++++ 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4f8b4d3..e52c7a6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,19 @@ 2012-01-10 Jan Kratochvil + Fix regression after libiberty/ update for GCC PR 6057 and others. + * c-exp.y (operator) + (operator) : Add trailing space. + * cp-name-parser.y (fill_comp, make_operator, make_dtor) + (make_builtin_type, make_name): New variable i, add gdb_assert. + (operator) : Update ARGS to 3. + (operator) : Add trailing space. + (operator) : Update ARGS to 3. + (operator) : Add trailing space. + * cp-support.c (cp_canonicalize_string): Check NULL from + cp_comp_to_string, call warning and return. + +2012-01-10 Jan Kratochvil + Fix duplicate .o files after omitting libbfd.a. * Makefile.in (ALL_TARGET_OBS): Remove corelow.o. (SFILES): Add corelow.c. diff --git a/gdb/c-exp.y b/gdb/c-exp.y index bdcae33..24a4761 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1211,11 +1211,11 @@ const_or_volatile_noopt: const_and_volatile operator: OPERATOR NEW { $$ = operator_stoken (" new"); } | OPERATOR DELETE - { $$ = operator_stoken (" delete"); } + { $$ = operator_stoken (" delete "); } | OPERATOR NEW '[' ']' { $$ = operator_stoken (" new[]"); } | OPERATOR DELETE '[' ']' - { $$ = operator_stoken (" delete[]"); } + { $$ = operator_stoken (" delete[] "); } | OPERATOR '+' { $$ = operator_stoken ("+"); } | OPERATOR '-' diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 8b4a1b9..d85a5bf 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -188,7 +188,11 @@ fill_comp (enum demangle_component_type d_type, struct demangle_component *lhs, struct demangle_component *rhs) { struct demangle_component *ret = d_grab (); - cplus_demangle_fill_component (ret, d_type, lhs, rhs); + int i; + + i = cplus_demangle_fill_component (ret, d_type, lhs, rhs); + gdb_assert (i); + return ret; } @@ -204,7 +208,11 @@ static struct demangle_component * make_operator (const char *name, int args) { struct demangle_component *ret = d_grab (); - cplus_demangle_fill_operator (ret, name, args); + int i; + + i = cplus_demangle_fill_operator (ret, name, args); + gdb_assert (i); + return ret; } @@ -212,7 +220,11 @@ static struct demangle_component * make_dtor (enum gnu_v3_dtor_kinds kind, struct demangle_component *name) { struct demangle_component *ret = d_grab (); - cplus_demangle_fill_dtor (ret, kind, name); + int i; + + i = cplus_demangle_fill_dtor (ret, kind, name); + gdb_assert (i); + return ret; } @@ -220,7 +232,11 @@ static struct demangle_component * make_builtin_type (const char *name) { struct demangle_component *ret = d_grab (); - cplus_demangle_fill_builtin_type (ret, name); + int i; + + i = cplus_demangle_fill_builtin_type (ret, name); + gdb_assert (i); + return ret; } @@ -228,7 +244,11 @@ static struct demangle_component * make_name (const char *name, int len) { struct demangle_component *ret = d_grab (); - cplus_demangle_fill_name (ret, name, len); + int i; + + i = cplus_demangle_fill_name (ret, name, len); + gdb_assert (i); + return ret; } @@ -420,13 +440,13 @@ demangler_special ; operator : OPERATOR NEW - { $$ = make_operator ("new", 1); } + { $$ = make_operator ("new", 3); } | OPERATOR DELETE - { $$ = make_operator ("delete", 1); } + { $$ = make_operator ("delete ", 1); } | OPERATOR NEW '[' ']' - { $$ = make_operator ("new[]", 1); } + { $$ = make_operator ("new[]", 3); } | OPERATOR DELETE '[' ']' - { $$ = make_operator ("delete[]", 1); } + { $$ = make_operator ("delete[] ", 1); } | OPERATOR '+' { $$ = make_operator ("+", 2); } | OPERATOR '-' diff --git a/gdb/cp-support.c b/gdb/cp-support.c index 17f8237..4902e50 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -528,6 +528,13 @@ cp_canonicalize_string (const char *string) ret = cp_comp_to_string (info->tree, estimated_len); cp_demangled_name_parse_free (info); + if (ret == NULL) + { + warning (_("internal error: string \"%s\" failed to be canonicalized"), + string); + return NULL; + } + if (strcmp (string, ret) == 0) { xfree (ret); -- 2.7.4