From: Keith Seitz Date: Tue, 11 Apr 2017 20:10:28 +0000 (-0700) Subject: New cplus_add_input. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3a38f5607af314335dfba84c9b27752f136b501;p=thirdparty%2Fbinutils-gdb.git New cplus_add_input. --- diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c index 02421f054d5..bc25008408d 100644 --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c @@ -487,18 +487,23 @@ struct cplus_add_input { switch (type) { - case COMPILE_I_PRINT_ADDRESS_SCOPE: case COMPILE_I_PRINT_VALUE_SCOPE: + case COMPILE_I_PRINT_ADDRESS_SCOPE: fprintf_unfiltered (buf, + /* "auto" strips ref- and cv- qualifiers, so we need to also strip + those from COMPILE_I_EXPR_PTR_TYPE. */ "auto " COMPILE_I_EXPR_VAL " = %s;\n" - "decltype ( %s ) *" COMPILE_I_EXPR_PTR_TYPE ";\n" + "typedef " + "std::add_pointer::type>::type " + " __gdb_expr_ptr;\n" + "__gdb_expr_ptr " COMPILE_I_EXPR_PTR_TYPE ";\n" "std::memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s (" COMPILE_I_EXPR_VAL "),\n" - "sizeof (decltype(%s)));\n" + "\tsizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n" ,input, input, (type == COMPILE_I_PRINT_ADDRESS_SCOPE - ? "std::__addressof" : ""), input); + ? "std::__addressof" : "")); break; default: @@ -512,7 +517,7 @@ struct cplus_add_input /* A host class representing a compile program. CompileInstanceType is the type of the compile_instance for the - langauge. + language. PushUserExpressionPolicy and PopUserExpressionPolicy are used to push and pop user expression pragmas to the compile plug-in. diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c index 52655246199..151c35e2523 100644 --- a/gdb/compile/compile-cplus-types.c +++ b/gdb/compile/compile-cplus-types.c @@ -1298,7 +1298,7 @@ ccp_convert_struct_or_union (compile_cplus_instance *instance, /* Get the decl name of this type. */ if (TYPE_NAME (type) != NULL) - name = decl_name (TYPE_NAME (type)); + name = decl_name (TYPE_NAME (type)); /* First things first: If this type has any templates in it, make sure that we collect default arguments and get those types defined BEFORE diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 8dbc7547afa..fd6661c3967 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -478,7 +478,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile, gdb_ptr_type = check_typedef (gdb_ptr_type); if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR) error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE); - gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_ptr_type); + gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type)); if (types_deeply_equal (gdb_type, gdb_type_from_ptr)) { diff --git a/gdb/testsuite/gdb.compile/cp-array-decay.exp b/gdb/testsuite/gdb.compile/cp-array-decay.exp index 8baeef4484a..5a3ec521bdc 100644 --- a/gdb/testsuite/gdb.compile/cp-array-decay.exp +++ b/gdb/testsuite/gdb.compile/cp-array-decay.exp @@ -45,6 +45,6 @@ gdb_continue_to_breakpoint "testing location" gdb_test "compile print integers" " = \\{0, 0, 0, 0, 0, 0, 0, 0, 0, 0\\}" -gdb_test "compile print strings" " = \\{$hex \"hello\", $hex \"hello\", \ -$hex \"hello\", $hex \"hello\", $hex \"hello\", $hex \"hello\", \ -$hex \"hello\", $hex \"hello\", $hex \"hello\", $hex \"hello\"\\}" +gdb_test "compile print strings" " = \\{$hex \"hello\", $hex \"hello\",\ + $hex \"hello\", $hex \"hello\", $hex \"hello\", $hex \"hello\",\ + $hex \"hello\", $hex \"hello\", $hex \"hello\", $hex \"hello\"\\}"