2017-12-08 04:31:26 +00:00
|
|
|
From efa504a63f3e9ec2fa0ec3f38e525122030e4111 Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
|
|
|
Subject: gdb-lineno-makeup-test.patch
|
|
|
|
|
|
|
|
FileName: gdb-lineno-makeup-test.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Testcase for "Do not make up line information" fix by Daniel Jacobowitz.
|
|
|
|
;;=fedoratest
|
2017-12-04 19:24:00 +00:00
|
|
|
|
2010-01-16 22:32:10 +00:00
|
|
|
New testcase for:
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=466222
|
|
|
|
(for the first / customer recommended fix)
|
|
|
|
and the upstream fix:
|
|
|
|
http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
|
|
|
|
[rfc] Do not make up line information
|
|
|
|
http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
|
2017-12-08 04:31:26 +00:00
|
|
|
---
|
|
|
|
gdb/testsuite/gdb.base/lineno-makeup-func.c | 21 ++++++++
|
|
|
|
gdb/testsuite/gdb.base/lineno-makeup.c | 35 +++++++++++++
|
|
|
|
gdb/testsuite/gdb.base/lineno-makeup.exp | 78 +++++++++++++++++++++++++++++
|
|
|
|
3 files changed, 134 insertions(+)
|
|
|
|
create mode 100644 gdb/testsuite/gdb.base/lineno-makeup-func.c
|
|
|
|
create mode 100644 gdb/testsuite/gdb.base/lineno-makeup.c
|
|
|
|
create mode 100644 gdb/testsuite/gdb.base/lineno-makeup.exp
|
2010-01-16 22:32:10 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000..1a0220ea52
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
|
2010-01-16 22:32:10 +00:00
|
|
|
@@ -0,0 +1,21 @@
|
|
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
+
|
|
|
|
+ Copyright 2009 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/>. */
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+func (void)
|
|
|
|
+{
|
|
|
|
+}
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.c b/gdb/testsuite/gdb.base/lineno-makeup.c
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000..5d4be90999
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.base/lineno-makeup.c
|
2010-01-16 22:32:10 +00:00
|
|
|
@@ -0,0 +1,35 @@
|
|
|
|
+/* This testcase is part of GDB, the GNU debugger.
|
|
|
|
+
|
|
|
|
+ Copyright 2009 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/>. */
|
|
|
|
+
|
|
|
|
+/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
|
|
|
|
+ information (.debug_line) so we cannot use an external object file.
|
|
|
|
+
|
|
|
|
+ It must not be just a label as it would alias on the next function even for
|
|
|
|
+ correct GDB. Therefore some stub data must be placed there.
|
|
|
|
+
|
|
|
|
+ We need to provide a real stub function body as at least s390
|
|
|
|
+ (s390_analyze_prologue) would skip the whole body till reaching `main'. */
|
|
|
|
+
|
|
|
|
+extern void func (void);
|
2016-02-16 09:54:56 +00:00
|
|
|
+asm ("func: .incbin \"" BINFILENAME "\"");
|
2010-01-16 22:32:10 +00:00
|
|
|
+
|
|
|
|
+int
|
|
|
|
+main (void)
|
|
|
|
+{
|
|
|
|
+ func ();
|
|
|
|
+ return 0;
|
|
|
|
+}
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/testsuite/gdb.base/lineno-makeup.exp b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000000..9e11d78bf9
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
|
2010-01-16 22:32:10 +00:00
|
|
|
@@ -0,0 +1,78 @@
|
|
|
|
+# Copyright 2009 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/>.
|
|
|
|
+
|
|
|
|
+set testfile "lineno-makeup"
|
|
|
|
+set srcfuncfile ${testfile}-func.c
|
|
|
|
+set srcfile ${testfile}.c
|
2016-02-16 09:54:56 +00:00
|
|
|
+set objfuncfile [standard_output_file ${testfile}-func.o]
|
|
|
|
+set binfuncfile [standard_output_file ${testfile}-func.bin]
|
|
|
|
+set binfile [standard_output_file ${testfile}]
|
2010-01-16 22:32:10 +00:00
|
|
|
+
|
|
|
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
|
|
|
|
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
|
|
|
|
+verbose -log "objcopy=$objcopy: $output"
|
|
|
|
+if { $objcopy != 0 } {
|
|
|
|
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
|
|
+}
|
|
|
|
+set binfuncfilesize [file size $binfuncfile]
|
|
|
|
+verbose -log "file size $binfuncfile = $binfuncfilesize"
|
|
|
|
+
|
2016-02-16 09:54:56 +00:00
|
|
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug additional_flags=-DBINFILENAME=\"$binfuncfile\"]] != "" } {
|
2010-01-16 22:32:10 +00:00
|
|
|
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+gdb_exit
|
|
|
|
+gdb_start
|
|
|
|
+gdb_reinitialize_dir $srcdir/$subdir
|
|
|
|
+gdb_load ${binfile}
|
|
|
|
+
|
|
|
|
+set b_addr ""
|
|
|
|
+set test "break func"
|
|
|
|
+gdb_test_multiple $test $test {
|
|
|
|
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
|
|
|
|
+ set b_addr $expect_out(1,string)
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+ -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
|
|
|
|
+ set b_addr $expect_out(1,string)
|
|
|
|
+ fail $test
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+verbose -log "b_addr=<$b_addr>"
|
|
|
|
+
|
|
|
|
+set p_addr ""
|
|
|
|
+set test "print func"
|
|
|
|
+gdb_test_multiple $test $test {
|
|
|
|
+ -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
|
|
|
|
+ set p_addr $expect_out(1,string)
|
|
|
|
+ pass $test
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+verbose -log "p_addr=<$p_addr>"
|
|
|
|
+
|
|
|
|
+set test "break address belongs to func"
|
|
|
|
+if {$b_addr == $p_addr} {
|
|
|
|
+ pass "$test (exact match)"
|
|
|
|
+} else {
|
|
|
|
+ set skip [expr $b_addr - $p_addr]
|
|
|
|
+ if {$skip > 0 && $skip < $binfuncfilesize} {
|
|
|
|
+ pass "$test (prologue skip by $skip bytes)"
|
|
|
|
+ } else {
|
|
|
|
+ fail $test
|
|
|
|
+ }
|
|
|
|
+}
|
2017-12-08 04:31:26 +00:00
|
|
|
--
|
|
|
|
2.14.3
|
|
|
|
|