public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-tromey-ambiguous-linespec: add test cases for multi-location breakpoints
@ 2011-08-05 17:16 tromey
  0 siblings, 0 replies; only message in thread
From: tromey @ 2011-08-05 17:16 UTC (permalink / raw)
  To: archer-commits

The branch, archer-tromey-ambiguous-linespec has been updated
       via  7100f1170ff36ec2ce19365b0d09b97368b9e139 (commit)
       via  9b8ee5513e7756a417bf5c5de3ba8d1e67b7f4d1 (commit)
      from  d206ed2de18262f33ad07d94c1240f0e323312d5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 7100f1170ff36ec2ce19365b0d09b97368b9e139
Author: Tom Tromey <tromey@redhat.com>
Date:   Fri Aug 5 11:15:53 2011 -0600

    add test cases for multi-location breakpoints

commit 9b8ee5513e7756a417bf5c5de3ba8d1e67b7f4d1
Author: Tom Tromey <tromey@redhat.com>
Date:   Fri Aug 5 10:09:45 2011 -0600

    change what is printed when breakpoint is set

-----------------------------------------------------------------------

Summary of changes:
 gdb/breakpoint.c                              |    7 ++-
 gdb/testsuite/Makefile.in                     |    2 +-
 gdb/testsuite/configure                       |    3 +-
 gdb/testsuite/configure.ac                    |    2 +-
 gdb/testsuite/gdb.linespec/Makefile.in        |   14 ++++++
 gdb/testsuite/gdb.linespec/base/one/thefile.c |   12 +++++
 gdb/testsuite/gdb.linespec/base/two/thefile.c |   12 +++++
 gdb/testsuite/gdb.linespec/linespec.exp       |   61 +++++++++++++++++++++++++
 gdb/testsuite/gdb.linespec/lspec.c            |    9 ++++
 9 files changed, 116 insertions(+), 6 deletions(-)
 create mode 100644 gdb/testsuite/gdb.linespec/Makefile.in
 create mode 100644 gdb/testsuite/gdb.linespec/base/one/thefile.c
 create mode 100644 gdb/testsuite/gdb.linespec/base/two/thefile.c
 create mode 100644 gdb/testsuite/gdb.linespec/linespec.exp
 create mode 100644 gdb/testsuite/gdb.linespec/lspec.c

First 500 lines of diff:
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 385258f..76c9d17 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -10643,10 +10643,11 @@ say_where (struct breakpoint *b)
 	  fputs_filtered (paddress (b->loc->gdbarch, b->loc->address),
 			  gdb_stdout);
 	}
-      /* FIXME */
       if (b->loc->source_file)
-	printf_filtered (": file %s, line %d.",
-			 b->loc->source_file, b->loc->line_number);
+	/* This is not ideal, but each location may have a different
+	   file name, and this at least reflects the real situation
+	   somewhat.  */
+	printf_filtered (": %s.", b->addr_string);
 
       if (b->loc->next)
 	{
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 8b22324..d3c9cfc 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -35,7 +35,7 @@ SUBDIRS = @subdirs@
 RPATH_ENVVAR = @RPATH_ENVVAR@
 ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cell gdb.cp gdb.disasm \
 	gdb.dwarf2 gdb.fortran gdb.gdb gdb.hp \
-	gdb.java gdb.mi gdb.modula2 gdb.multi \
+	gdb.java gdb.linespec gdb.mi gdb.modula2 gdb.multi \
 	gdb.objc gdb.opencl gdb.opt gdb.pascal gdb.python gdb.server \
 	gdb.stabs gdb.reverse gdb.threads gdb.trace gdb.xml \
 	$(SUBDIRS)
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index 82206b3..6d94633 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -3448,7 +3448,7 @@ done
 
 
 
-ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
+ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -4166,6 +4166,7 @@ do
     "gdb.hp/gdb.aCC/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.aCC/Makefile" ;;
     "gdb.hp/gdb.compat/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.compat/Makefile" ;;
     "gdb.hp/gdb.defects/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.defects/Makefile" ;;
+    "gdb.linespec") CONFIG_FILES="$CONFIG_FILES gdb.linespec" ;;
     "gdb.mi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;;
     "gdb.modula2/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.modula2/Makefile" ;;
     "gdb.multi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.multi/Makefile" ;;
diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac
index 8631442..2213e40 100644
--- a/gdb/testsuite/configure.ac
+++ b/gdb/testsuite/configure.ac
@@ -95,7 +95,7 @@ AC_OUTPUT([Makefile \
   gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \
   gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile \
   gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \
-  gdb.hp/gdb.defects/Makefile \
+  gdb.hp/gdb.defects/Makefile gdb.linespec \
   gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \
   gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \
   gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \
diff --git a/gdb/testsuite/gdb.linespec/Makefile.in b/gdb/testsuite/gdb.linespec/Makefile.in
new file mode 100644
index 0000000..2658a24
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/Makefile.in
@@ -0,0 +1,14 @@
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+EXECUTABLES = lspec
+
+all info install-info dvi install uninstall installcheck check:
+	@echo "Nothing to be done for $@..."
+
+clean mostlyclean:
+	-rm -f *~ *.o *.ci
+	-rm -f core $(EXECUTABLES)
+
+distclean maintainer-clean realclean: clean
+	-rm -f Makefile config.status config.log gdb.log gdb.sum
diff --git a/gdb/testsuite/gdb.linespec/base/one/thefile.c b/gdb/testsuite/gdb.linespec/base/one/thefile.c
new file mode 100644
index 0000000..ad203a2
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/base/one/thefile.c
@@ -0,0 +1,12 @@
+/* The commented line must have the same line number in the other
+   "thefile.c".  */
+
+
+
+
+
+
+int m(int x)
+{
+  return x + 23;		/* thefile breakpoint */
+}
diff --git a/gdb/testsuite/gdb.linespec/base/two/thefile.c b/gdb/testsuite/gdb.linespec/base/two/thefile.c
new file mode 100644
index 0000000..bab260a
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/base/two/thefile.c
@@ -0,0 +1,12 @@
+/* The commented line must have the same line number in the other
+   "thefile.c".  */
+
+static int dupname(int y)
+{
+  return y;
+}
+
+int n(int y)
+{
+  return dupname(y) - 23;	/* thefile breakpoint */
+}
diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp
new file mode 100644
index 0000000..ea13bec
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/linespec.exp
@@ -0,0 +1,61 @@
+# Copyright 2011 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/>.
+
+# Tests of ambiguous linespecs.
+
+set testfile linespec
+
+set exefile lspec
+set binfile ${objdir}/${subdir}/${exefile}
+
+set baseone base/one/thefile.c
+set basetwo base/two/thefile.c
+
+set hex {0x[0-9a-fA-F]+}
+
+if {[prepare_for_testing ${testfile}.exp $exefile \
+	 [list lspec.c $baseone $basetwo] \
+	 {debug nowarnings}]} {
+    return -1
+}
+
+gdb_test_no_output "set multiple-symbols all" \
+    "set multiple-symbols to all for linespec tests"
+
+set l1 [gdb_get_line_number "thefile breakpoint" $baseone]
+set l2 [gdb_get_line_number "thefile breakpoint" $basetwo]
+
+if {$l1 != $l2} {
+    error "somebody incompatibly modified the source files needed by linespec.exp"
+}
+
+gdb_test "break thefile.c:$l1" \
+    "Breakpoint 1 at $hex: thefile.c:$l1. \[(\]2 locations\[)\]" \
+    "multi-location break using file:line"
+
+# We'd like this to work, but it currently does not.
+# gdb_test "break one/thefile.c:$l1"
+
+gdb_test "break dupname" \
+    "Breakpoint 2 at $hex: dupname. \[(\]2 locations\[)\]" \
+    "multi-location break using duplicate function name"
+
+gdb_test_no_output "set breakpoint pending off" \
+    "disable pending breakpoints for linespec tests"
+
+# This is PR breakpoints/12856.
+gdb_test "break lspec.c:nosuchfunction" \
+    "Function \"nosuchfunction\" not defined in \"lspec.c\"." \
+    "set breakpoint on non-existent function"
diff --git a/gdb/testsuite/gdb.linespec/lspec.c b/gdb/testsuite/gdb.linespec/lspec.c
new file mode 100644
index 0000000..ab2cd0f
--- /dev/null
+++ b/gdb/testsuite/gdb.linespec/lspec.c
@@ -0,0 +1,9 @@
+extern int m(int x);
+extern int n(int y);
+
+static int dupname (int x) { return x; }
+
+int main()
+{
+  return dupname(0) + m(0) + n(0);
+}


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-08-05 17:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05 17:16 [SCM] archer-tromey-ambiguous-linespec: add test cases for multi-location breakpoints tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).