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