gdb: make get_dyn_prop a method of struct type
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / call_pn.exp
index 6e256043f4165ee01a83f49de29cfc876b8e6985..1fe133fe7b59ee6a700f274cb72c6b8c161f24ba 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2010, 2011 Free Software Foundation, Inc.
+# Copyright 2010-2020 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-if $tracelevel then {
-    strace $tracelevel
-}
-
 load_lib "ada.exp"
 
-set testdir "call_pn"
-set testfile "${testdir}/foo"
-set srcfile ${srcdir}/${subdir}/${testfile}.adb
-set binfile ${objdir}/${subdir}/${testfile}
+standard_ada_testfile foo
 
-file mkdir ${objdir}/${subdir}/${testdir}
 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
   return -1
 }
@@ -37,14 +29,58 @@ if ![runto "foo.adb:$bp_location" ] then {
   return
 }
 
+# The xfail mentioned below triggers for the "after" print, but may not
+# trigger for the "before" print, though it will for -readnow.  This is
+# related to PR25764 - "LOC_UNRESOLVED symbol missing from partial symtab".
+# Stabilize test results by ensuring that the xfail triggers for the "before"
+# print.
+gdb_test_no_output "maint expand-symtabs"
+
+# The xfail is for PR gcc/94469, which occurs with target board
+# unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects and gcc-8 and later.
+# Note: We don't check for the filename in xfail_re because it might be
+# wrong, filed as gdb PR25771.
+set xfail_re \
+    [multi_line \
+        "Multiple matches for last_node_id" \
+        "\\\[0\\\] cancel" \
+        "\\\[1\\\] pck\.last_node_id at .*.adb:17" \
+        "\\\[2\\\] pck\.last_node_id at .*.adb:17" \
+        "> $"]
+
 # Make sure that last_node_id is set to zero...
-gdb_test "print last_node_id" "= 0" "print last_node_id before calling pn"
+gdb_test_multiple "print last_node_id" "print last_node_id before calling pn" {
+    -re $xfail_re {
+       xfail $gdb_test_name
+       # One of the choices will print the correct value, the other one
+       # <optimized out>.  Since we don't known which one to choose to get
+       # the correct value, cancel.
+       gdb_test_multiple "0" "cancel after xfail 1" {
+           -re -wrap "cancelled" {
+           }
+       }
+    }
+    -re -wrap "= 0" {
+       pass $gdb_test_name
+    }
+}
 
 # Now, call procedure Pn, which should set Last_Node_Id to the value
 # of the parameter used in the function call.  Verify that we can print
 # the returned value correctly, while we're at it.
-gdb_test "print pn (4321)" "= 4321" "print pn (4321)"
+gdb_test "print pn (4321)" "= 4321"
 
 # Make sure that last_node_id now has the correct value...
-gdb_test "print last_node_id" "= 4321" "print last_node_id after calling pn"
-
+gdb_test_multiple "print last_node_id" "print last_node_id after calling pn" {
+    -re $xfail_re {
+       xfail $gdb_test_name
+       # Cancel
+       gdb_test_multiple "0" "cancel after xfail 2" {
+           -re -wrap "cancelled" {
+           }
+       }
+    }
+    -re -wrap "= 4321" {
+       pass $gdb_test_name
+    }
+}
This page took 0.027632 seconds and 4 git commands to generate.