summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.ada/mi_interface.exp4
-rw-r--r--gdb/testsuite/gdb.ada/mi_var_array.exp2
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch.exp83
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb25
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/pck.adb44
-rw-r--r--gdb/testsuite/gdb.ada/scoped_watch/pck.ads21
-rw-r--r--gdb/testsuite/gdb.ada/watch_arg.exp13
8 files changed, 195 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 63492599177..15c0caf8532 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2017-11-08 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.ada/scoped_watch: New testcase.
+ * gdb.ada/watch_arg.exp: Adjust expected behavior to the behavior
+ which is actually correct.
+ * gdb.ada/mi_interface.exp: Add missing thread-id in expected varobj.
+ * gdb.ada/mi_var_array.exp: Add missing thread-id in expected varobj.
+
2017-11-08 Pedro Alves <palves@redhat.com>
* gdb.gdb/complaints.exp (test_initial_complaints)
diff --git a/gdb/testsuite/gdb.ada/mi_interface.exp b/gdb/testsuite/gdb.ada/mi_interface.exp
index 65d516a9cac..ecbe2f3541f 100644
--- a/gdb/testsuite/gdb.ada/mi_interface.exp
+++ b/gdb/testsuite/gdb.ada/mi_interface.exp
@@ -44,9 +44,9 @@ mi_continue_to_line \
"stop at start of main Ada procedure"
mi_gdb_test "-var-create ggg1 * ggg1" \
- "\\^done,name=\"ggg1\",numchild=\"1\",value=\"{...}\",type=\"<ref> pck.gadatatype\",has_more=\"0\"" \
+ "\\^done,name=\"ggg1\",numchild=\"1\",value=\"{...}\",type=\"<ref> pck.gadatatype\",thread-id=\"$decimal\",has_more=\"0\"" \
"create ggg1 varobj"
mi_gdb_test "-var-list-children 1 ggg1" \
- "\\^done,numchild=\"1\",children=\\\[child={name=\"ggg1.i\",exp=\"i\",numchild=\"0\",value=\"42\",type=\"integer\"}\\\],has_more=\"0\"" \
+ "\\^done,numchild=\"1\",children=\\\[child={name=\"ggg1.i\",exp=\"i\",numchild=\"0\",value=\"42\",type=\"integer\",thread-id=\"$decimal\"}\\\],has_more=\"0\"" \
"list ggg1's children"
diff --git a/gdb/testsuite/gdb.ada/mi_var_array.exp b/gdb/testsuite/gdb.ada/mi_var_array.exp
index aab9109766d..056ee884e81 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_array.exp
@@ -48,5 +48,5 @@ mi_gdb_test "-var-create vta * vta" \
"create bt varobj"
mi_gdb_test "-var-list-children vta" \
- "\\^done,numchild=\"2\",children=\\\[child={name=\"vta.n\",exp=\"n\",numchild=\"0\",type=\"bar\\.int\"},child={name=\"vta.f\",exp=\"f\",numchild=\"0\",type=\"array \\(1 .. n\\) of character\"}\\\],.*" \
+ "\\^done,numchild=\"2\",children=\\\[child={name=\"vta.n\",exp=\"n\",numchild=\"0\",type=\"bar\\.int\",thread-id=\"$decimal\"},child={name=\"vta.f\",exp=\"f\",numchild=\"0\",type=\"array \\(1 .. n\\) of character\",thread-id=\"$decimal\"}\\\],.*" \
"list vta's children"
diff --git a/gdb/testsuite/gdb.ada/scoped_watch.exp b/gdb/testsuite/gdb.ada/scoped_watch.exp
new file mode 100644
index 00000000000..51f6c41fdab
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/scoped_watch.exp
@@ -0,0 +1,83 @@
+# Copyright 2017 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+if { [skip_ada_tests] } { return -1 }
+
+standard_ada_testfile foo_p708_025
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable {debug}] != ""} {
+ return -1
+}
+
+clean_restart ${testfile}
+
+set bp_location [gdb_get_line_number "START" ${testdir}/pck.adb]
+runto "pck.adb:$bp_location"
+
+# Insert a watchpoint on local variable "result"
+
+gdb_test "watch result" \
+ ".*atchpoint \[0-9\]+: result"
+
+# Insert a breakpoint we'll reach after returning from the current
+# function.
+
+set bp_location [gdb_get_line_number "Do_Nothing" ${testdir}/foo_p708_025.adb]
+gdb_test "break foo_p708_025.adb:$bp_location" \
+ "Breakpoint \[0-9\]+ at.*: file .*foo_p708_025.adb, line \[0-9\]+."
+
+# This breakpoint will be there to stop us after we test what happens
+# during a continue (see below...)
+
+gdb_test "break pck.increment" \
+ "Breakpoint \[0-9\]+ at.*: file .*pck.adb, line \[0-9\]+."
+
+# Continue until we reach our watchpoint. It isn't strictly necessary
+# for our purpose that the watchpoint actually triggers, but this shows
+# that the watchpoint exists and is active.
+gdb_test "cont" \
+ ".*atchpoint \[0-9\]+: result.*Old value = 8.*New value = 64.*" \
+ "continuing to watchpoint hit"
+
+# Continue again. We should be stopped at the (internal) breakpoint
+# that we setup to delete the watchpoint as soon as the program leaves
+# the current scope.
+
+gdb_test \
+ "cont" \
+ ".*atchpoint \[0-9\]+ deleted because the program has left the block.*" \
+ "continuing until watchpoint automatic deletion"
+
+# Continue one more time. We should be reaching one of the breakpoints
+# (on the call to Do_Nothing) we set earlier.
+
+gdb_test "cont" \
+ "Breakpoint \[0-9\]+.*Do_Nothing.*" \
+ "continuing to breakpoint on call to Do_Nothing"
+
+# Do a next, to verify that it works...
+
+gdb_test "next" \
+ ".* Call_Me;" \
+ "next to call to Call_Me"
+
+# And finally, one more continue.
+
+
+gdb_test "cont" \
+ "Breakpoint \[0-9\]+.*pck\\.increment.*" \
+ "continuing to breakpoint in pck.increment"
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb b/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb
new file mode 100644
index 00000000000..d7d1cdfd47e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/scoped_watch/foo_p708_025.adb
@@ -0,0 +1,25 @@
+-- Copyright 2017 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+with Pck; use Pck;
+
+procedure Foo_P708_025 is
+ Val : Integer;
+begin
+ Val := Get_Val (8, False);
+ Do_Nothing (Val);
+ Call_Me;
+ Increment (Val);
+end Foo_P708_025;
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/pck.adb b/gdb/testsuite/gdb.ada/scoped_watch/pck.adb
new file mode 100644
index 00000000000..075bc618c99
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/scoped_watch/pck.adb
@@ -0,0 +1,44 @@
+-- Copyright 2017 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package body Pck is
+ function Get_Val (Seed: Integer; Off_By_One: Boolean) return Integer is
+ Result : Integer := Seed;
+ begin
+ if Off_By_One then -- START
+ Result := Result - 1;
+ end if;
+ Result := Result * 8;
+ if Off_By_One then
+ Result := Result + 1;
+ end if;
+ return Result;
+ end Get_Val;
+
+ procedure Do_Nothing (Val: in out Integer) is
+ begin
+ null;
+ end Do_Nothing;
+
+ procedure Call_Me is
+ begin
+ null;
+ end Call_Me;
+
+ procedure Increment (Val : in out Integer) is
+ begin
+ Val := Val + 1;
+ end Increment;
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/scoped_watch/pck.ads b/gdb/testsuite/gdb.ada/scoped_watch/pck.ads
new file mode 100644
index 00000000000..f58558205cf
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/scoped_watch/pck.ads
@@ -0,0 +1,21 @@
+-- Copyright 2017 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
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Pck is
+ function Get_Val (Seed: Integer; Off_By_One: Boolean) return Integer;
+ procedure Do_Nothing (Val: in out Integer);
+ procedure Call_Me;
+ procedure Increment (Val : in out Integer);
+end Pck;
diff --git a/gdb/testsuite/gdb.ada/watch_arg.exp b/gdb/testsuite/gdb.ada/watch_arg.exp
index 047ed3415cf..f50bbb95455 100644
--- a/gdb/testsuite/gdb.ada/watch_arg.exp
+++ b/gdb/testsuite/gdb.ada/watch_arg.exp
@@ -40,8 +40,17 @@ gdb_test "break watch.adb:$bp_location" \
"Breakpoint \[0-9\]+ at.*: file .*watch.adb, line \[0-9\]+." \
"insert second breakpoint in watch.adb"
-# Then continue to that breakpoint, and verify that the watchpoint
-# did not interfere with that.
+# Continue again. We should be stopped at the (internal) breakpoint
+# that we setup to delete the watchpoint as soon as the program leaves
+# the watchpoint scope.
+
+gdb_test \
+ "cont" \
+ ".*atchpoint \[0-9\]+ deleted because the program has left the block.*" \
+ "continuing until watchpoint automatic deletion"
+
+# Continue one more time, and verify that we land at the second breakpoint
+# we inserted.
gdb_test "cont" \
"Breakpoint \[0-9\]+, watch \\(\\).*" \