Blame SOURCES/gdb-lineno-makeup-test.patch

26bbde
New testcase for:
26bbde
https://bugzilla.redhat.com/show_bug.cgi?id=466222
26bbde
	(for the first / customer recommended fix)
26bbde
and the upstream fix:
26bbde
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
26bbde
	[rfc] Do not make up line information
26bbde
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
26bbde
be09dc
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup-func.c
be09dc
===================================================================
be09dc
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
be09dc
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup-func.c	2016-02-15 23:29:16.595161971 +0100
26bbde
@@ -0,0 +1,21 @@
26bbde
+/* This testcase is part of GDB, the GNU debugger.
26bbde
+
26bbde
+   Copyright 2009 Free Software Foundation, Inc.
26bbde
+
26bbde
+   This program is free software; you can redistribute it and/or modify
26bbde
+   it under the terms of the GNU General Public License as published by
26bbde
+   the Free Software Foundation; either version 3 of the License, or
26bbde
+   (at your option) any later version.
26bbde
+
26bbde
+   This program is distributed in the hope that it will be useful,
26bbde
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
26bbde
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26bbde
+   GNU General Public License for more details.
26bbde
+
26bbde
+   You should have received a copy of the GNU General Public License
26bbde
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
26bbde
+
26bbde
+void
26bbde
+func (void)
26bbde
+{
26bbde
+}
be09dc
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup.c
be09dc
===================================================================
be09dc
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
be09dc
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup.c	2016-02-15 23:29:23.873213646 +0100
26bbde
@@ -0,0 +1,35 @@
26bbde
+/* This testcase is part of GDB, the GNU debugger.
26bbde
+
26bbde
+   Copyright 2009 Free Software Foundation, Inc.
26bbde
+
26bbde
+   This program is free software; you can redistribute it and/or modify
26bbde
+   it under the terms of the GNU General Public License as published by
26bbde
+   the Free Software Foundation; either version 3 of the License, or
26bbde
+   (at your option) any later version.
26bbde
+
26bbde
+   This program is distributed in the hope that it will be useful,
26bbde
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
26bbde
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26bbde
+   GNU General Public License for more details.
26bbde
+
26bbde
+   You should have received a copy of the GNU General Public License
26bbde
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
26bbde
+
26bbde
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
26bbde
+   information (.debug_line) so we cannot use an external object file.
26bbde
+   
26bbde
+   It must not be just a label as it would alias on the next function even for
26bbde
+   correct GDB.  Therefore some stub data must be placed there.
26bbde
+   
26bbde
+   We need to provide a real stub function body as at least s390
26bbde
+   (s390_analyze_prologue) would skip the whole body till reaching `main'.  */
26bbde
+
26bbde
+extern void func (void);
be09dc
+asm ("func: .incbin \"" BINFILENAME "\"");
26bbde
+
26bbde
+int
26bbde
+main (void)
26bbde
+{
26bbde
+  func ();
26bbde
+  return 0;
26bbde
+}
be09dc
Index: gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup.exp
be09dc
===================================================================
be09dc
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
be09dc
+++ gdb-7.10.90.20160211/gdb/testsuite/gdb.base/lineno-makeup.exp	2016-02-15 23:29:23.873213646 +0100
26bbde
@@ -0,0 +1,78 @@
26bbde
+# Copyright 2009 Free Software Foundation, Inc.
26bbde
+
26bbde
+# This program is free software; you can redistribute it and/or modify
26bbde
+# it under the terms of the GNU General Public License as published by
26bbde
+# the Free Software Foundation; either version 3 of the License, or
26bbde
+# (at your option) any later version.
26bbde
+#
26bbde
+# This program is distributed in the hope that it will be useful,
26bbde
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
26bbde
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26bbde
+# GNU General Public License for more details.
26bbde
+#
26bbde
+# You should have received a copy of the GNU General Public License
26bbde
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
26bbde
+
26bbde
+set testfile "lineno-makeup"
26bbde
+set srcfuncfile ${testfile}-func.c
26bbde
+set srcfile ${testfile}.c
be09dc
+set objfuncfile [standard_output_file ${testfile}-func.o]
be09dc
+set binfuncfile [standard_output_file ${testfile}-func.bin]
be09dc
+set binfile [standard_output_file ${testfile}]
26bbde
+
26bbde
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
26bbde
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
26bbde
+}
26bbde
+
26bbde
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
26bbde
+verbose -log "objcopy=$objcopy: $output"
26bbde
+if { $objcopy != 0 } {
26bbde
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
26bbde
+}
26bbde
+set binfuncfilesize [file size $binfuncfile]
26bbde
+verbose -log "file size $binfuncfile = $binfuncfilesize"
26bbde
+
be09dc
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } {
26bbde
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
26bbde
+}
26bbde
+
26bbde
+gdb_exit
26bbde
+gdb_start
26bbde
+gdb_reinitialize_dir $srcdir/$subdir
26bbde
+gdb_load ${binfile}
26bbde
+
26bbde
+set b_addr ""
26bbde
+set test "break func"
26bbde
+gdb_test_multiple $test $test {
26bbde
+    -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
26bbde
+	set b_addr $expect_out(1,string)
26bbde
+	pass $test
26bbde
+    }
26bbde
+    -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
26bbde
+	set b_addr $expect_out(1,string)
26bbde
+	fail $test
26bbde
+    }
26bbde
+}
26bbde
+verbose -log "b_addr=<$b_addr>"
26bbde
+
26bbde
+set p_addr ""
26bbde
+set test "print func"
26bbde
+gdb_test_multiple $test $test {
26bbde
+    -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
26bbde
+	set p_addr $expect_out(1,string)
26bbde
+	pass $test
26bbde
+    }
26bbde
+}
26bbde
+verbose -log "p_addr=<$p_addr>"
26bbde
+
26bbde
+set test "break address belongs to func"
26bbde
+if {$b_addr == $p_addr} {
26bbde
+    pass "$test (exact match)"
26bbde
+} else {
26bbde
+    set skip [expr $b_addr - $p_addr]
26bbde
+    if {$skip > 0 && $skip < $binfuncfilesize} {
26bbde
+	pass "$test (prologue skip by $skip bytes)"
26bbde
+    } else {
26bbde
+	fail $test
26bbde
+    }
26bbde
+}