]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
New cplus_add_input.
authorKeith Seitz <keiths@redhat.com>
Tue, 11 Apr 2017 20:10:28 +0000 (13:10 -0700)
committerKeith Seitz <keiths@redhat.com>
Tue, 11 Apr 2017 20:10:28 +0000 (13:10 -0700)
gdb/compile/compile-c-support.c
gdb/compile/compile-cplus-types.c
gdb/compile/compile-object-load.c
gdb/testsuite/gdb.compile/cp-array-decay.exp

index 02421f054d59ae184be0c3ef0dd6b3dac2f0c4ad..bc25008408d62e84ee7f63f871c96b7d1dca1f2b 100644 (file)
@@ -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<std::remove_cv<decltype (%s)>::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.
index 5265524619987e235104071fe273c4bc883fcb58..151c35e2523dbca528e56dc8dbb86ef3f8dd3b7d 100644 (file)
@@ -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
index 8dbc7547afa133ba7eee51427c32c8cc4d951f6a..fd6661c396715bbd5a4cf9a9b4bfd46fffafe7fa 100644 (file)
@@ -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))
     {
index 8baeef4484a74b0fd53ba56dac3389d3a8f1a395..5a3ec521bdcc869dbc57f109f29a8d3ba1f631e9 100644 (file)
@@ -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\"\\}"