Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.cp / m-static.exp
index ae4b2ad8ee2b94ff20b07d1039bcd7ac0ac464b7..8972aeb372390a97ba49b2a97b2ab5c6afb75184 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002-2013 Free Software Foundation, Inc.
+# Copyright 2002-2016 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -52,6 +52,11 @@ gdb_continue_to_breakpoint "end of constructors"
 
 # One.
 
+# simple object, static const int, accessing via 'class::method::variable'
+# Regression test for PR c++/15203 and PR c++/15210
+gdb_test "print 'gnu_obj_1::method()::sintvar'" "\\$\[0-9\]+ = 4" \
+    "simple object, static const int, accessing via 'class::method::variable"
+
 # simple object, static const bool
 gdb_test "print test1.test" "\\$\[0-9\]* = true" "simple object, static const bool"
 
@@ -64,13 +69,57 @@ gdb_test "print test1.key2" "\\$\[0-9\]* = 77" "simple object, static long"
 # simple object, static enum
 gdb_test "print test1.value" "\\$\[0-9\]* = oriental" "simple object, static enum"
 
-gdb_test "print test1.'~gnu_obj_1'" \
-    { = {void \(gnu_obj_1 \*( const)?, int\)} 0x[0-9a-f]+ <gnu_obj_1::~gnu_obj_1\(\)>} \
-    "simple object instance, print quoted destructor"
-
-gdb_test "ptype gnu_obj_1::'~gnu_obj_1'" \
-    {type = void \(gnu_obj_1 \* const\)} \
-    "simple object class, ptype quoted destructor"
+if { [istarget arm*-*-*] } {
+    gdb_test "print test5.single_constructor" \
+       { = {single_constructor \*\(single_constructor \* const\)} 0x[0-9a-f]+ <single_constructor::single_constructor\(\)>} \
+       "simple object instance, print constructor"
+    gdb_test "ptype test5.single_constructor" \
+       {type = class single_constructor {\r\n  public:\r\n    single_constructor\(void\);\r\n    ~single_constructor\(int\);\r\n} \*\(single_constructor \* const\)} \
+       "simple object instance, ptype constructor"
+    gdb_test "ptype single_constructor::single_constructor" \
+       {type = class single_constructor {\r\n  public:\r\n    single_constructor\(void\);\r\n    ~single_constructor\(int\);\r\n} \*\(single_constructor \* const\)} \
+       "simple object class, ptype constructor"
+
+    gdb_test "print test1.~gnu_obj_1" \
+       { = {void \*\(gnu_obj_1 \* const, int\)} 0x[0-9a-f]+ <gnu_obj_1::~gnu_obj_1\(\)>} \
+       "simple object instance, print destructor"
+    gdb_test "ptype test1.~gnu_obj_1" \
+       {type = void \*\(gnu_obj_1 \* const, int\)} \
+       "simple object instance, ptype destructor"
+
+    gdb_test "print test1.'~gnu_obj_1'" \
+       { = {void \*\(gnu_obj_1 \*( const)?, int\)} 0x[0-9a-f]+ <gnu_obj_1::~gnu_obj_1\(\)>} \
+       "simple object instance, print quoted destructor"
+
+    gdb_test "ptype gnu_obj_1::'~gnu_obj_1'" \
+       {type = void \*\(gnu_obj_1 \* const\)} \
+       "simple object class, ptype quoted destructor"
+} else {
+    gdb_test "print test5.single_constructor" \
+       { = {void \(single_constructor \* const\)} 0x[0-9a-f]+ <single_constructor::single_constructor\(\)>} \
+       "simple object instance, print constructor"
+    gdb_test "ptype test5.single_constructor" \
+       {type = void \(single_constructor \* const\)} \
+       "simple object instance, ptype constructor"
+    gdb_test "ptype single_constructor::single_constructor" \
+       {type = void \(single_constructor \* const\)} \
+       "simple object class, ptype constructor"
+
+    gdb_test "print test1.~gnu_obj_1" \
+       { = {void \(gnu_obj_1 \* const, int\)} 0x[0-9a-f]+ <gnu_obj_1::~gnu_obj_1\(\)>} \
+       "simple object instance, print destructor"
+    gdb_test "ptype test1.~gnu_obj_1" \
+       {type = void \(gnu_obj_1 \* const, int\)} \
+       "simple object instance, ptype destructor"
+
+    gdb_test "print test1.'~gnu_obj_1'" \
+       { = {void \(gnu_obj_1 \*( const)?, int\)} 0x[0-9a-f]+ <gnu_obj_1::~gnu_obj_1\(\)>} \
+       "simple object instance, print quoted destructor"
+
+    gdb_test "ptype gnu_obj_1::'~gnu_obj_1'" \
+       {type = void \(gnu_obj_1 \* const\)} \
+       "simple object class, ptype quoted destructor"
+}
 
 # Two.
 
@@ -120,7 +169,10 @@ if {[test_compiler_info {gcc-[0-3]-*}]
     # and DW_AT_MIPS_linkage_name = _ZN9gnu_obj_47nowhereE .
     setup_xfail *-*-*
 }
-gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimized out" "static const int initialized nowhere"
+gdb_test "print test4.nowhere" "<optimized out>" "static const int initialized nowhere (print field)"
+
+# Same, but print the whole struct.
+gdb_test "print test4" "static nowhere = <optimized out>.*" "static const int initialized nowhere (whole struct)"
 
 # static const initialized in the class definition, PR gdb/11702.
 if { $non_dwarf } { setup_xfail *-*-* }
This page took 0.024591 seconds and 4 git commands to generate.