This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] MI: add tests for breakpoints with multiple locations


2013-02-27  Mircea Gherzan  <mircea.gherzan@intel.com>

gdb/testsuite:
	* gdb.mi/overloaded.cc: New file.
	* gdb.mi/mi-breakpoint-multiple.exp: New file.

Signed-off-by: Mircea Gherzan <mircea.gherzan@intel.com>
---
 gdb/testsuite/gdb.mi/mi-breakpoint-multiple.exp |   46 +++++++++++++++++++++++
 gdb/testsuite/gdb.mi/overloaded.cc              |   40 ++++++++++++++++++++
 2 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 gdb/testsuite/gdb.mi/mi-breakpoint-multiple.exp
 create mode 100644 gdb/testsuite/gdb.mi/overloaded.cc

diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-multiple.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple.exp
new file mode 100644
index 0000000..bc0419f
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/mi-breakpoint-multiple.exp
@@ -0,0 +1,46 @@
+# Copyright 2012-2013 Free Software Foundation, Inc.
+#
+# Contributed by Intel Corp. <mircea.gherzan@intel.com>
+#
+# 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 mi-support.exp
+
+if {[skip_cplus_tests]} {
+    return -1
+}
+
+gdb_exit
+if [mi_gdb_start] {
+    continue
+}
+
+standard_testfile overloaded.cc
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
+    untested mi-breakpoint-multiple.exp
+    return -1
+}
+
+set line_foo_void_body  [gdb_get_line_number "foo_void_body"]
+set line_foo_int_body   [gdb_get_line_number "foo_int_body"]
+
+mi_run_to_main
+
+mi_gdb_test "11-break-insert foo" \
+    "11\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"<MULTIPLE>\",times=\"0\",original-location=\"foo\",locations=\\\[\{number=\"2\\.1\",enabled=\"y\",addr=\"$hex\",func=\"foo\\(\\)\",file=\".*overloaded.cc\",fullname=\".*overloaded.cc\",line=\"$line_foo_void_body\",thread-groups=\\\[\"i1\"\\\]\},\{number=\"2\\.2\",enabled=\"y\",addr=\"$hex\",func=\"foo\\(int\\)\",file=\".*overloaded.cc\",fullname=\".*overloaded.cc\",line=\"$line_foo_int_body\",thread-groups=\\\[\"i1\"\\\]\}\\\]\}"  \
+    "insert breakpoint on breakpoint with multiple locations"
+
+mi_gdb_exit
+
diff --git a/gdb/testsuite/gdb.mi/overloaded.cc b/gdb/testsuite/gdb.mi/overloaded.cc
new file mode 100644
index 0000000..52430d0
--- /dev/null
+++ b/gdb/testsuite/gdb.mi/overloaded.cc
@@ -0,0 +1,40 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+   Copyright 2012-2013 Free Software Foundation, Inc.
+
+   Contributed by Intel Corp. <mircea.gherzan@intel.com>
+
+   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/>.  */
+
+int
+foo (void)
+{
+  return 0; /* foo_void_body */
+}
+
+int
+foo (int bar)
+{
+  return 0; /* foo_int_body */
+}
+
+int
+main (void)
+{
+  int x = foo ();
+
+  foo (x);
+
+  return 0;
+}
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]