2 https://bugzilla.redhat.com/show_bug.cgi?id=466222
3 (for the first / customer recommended fix)
5 http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html
6 [rfc] Do not make up line information
7 http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html
10 +++ b/gdb/testsuite/gdb.base/lineno-makeup-func.c
12 +/* This testcase is part of GDB, the GNU debugger.
14 + Copyright 2009 Free Software Foundation, Inc.
16 + This program is free software; you can redistribute it and/or modify
17 + it under the terms of the GNU General Public License as published by
18 + the Free Software Foundation; either version 3 of the License, or
19 + (at your option) any later version.
21 + This program is distributed in the hope that it will be useful,
22 + but WITHOUT ANY WARRANTY; without even the implied warranty of
23 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 + GNU General Public License for more details.
26 + You should have received a copy of the GNU General Public License
27 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
34 +++ b/gdb/testsuite/gdb.base/lineno-makeup.c
36 +/* This testcase is part of GDB, the GNU debugger.
38 + Copyright 2009 Free Software Foundation, Inc.
40 + This program is free software; you can redistribute it and/or modify
41 + it under the terms of the GNU General Public License as published by
42 + the Free Software Foundation; either version 3 of the License, or
43 + (at your option) any later version.
45 + This program is distributed in the hope that it will be useful,
46 + but WITHOUT ANY WARRANTY; without even the implied warranty of
47 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 + GNU General Public License for more details.
50 + You should have received a copy of the GNU General Public License
51 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
53 +/* DW_AT_low_pc-DW_AT_high_pc should cover the function without line number
54 + information (.debug_line) so we cannot use an external object file.
56 + It must not be just a label as it would alias on the next function even for
57 + correct GDB. Therefore some stub data must be placed there.
59 + We need to provide a real stub function body as at least s390
60 + (s390_analyze_prologue) would skip the whole body till reaching `main'. */
62 +extern void func (void);
63 +asm ("func: .incbin \"gdb.base/lineno-makeup-func.bin\"");
72 +++ b/gdb/testsuite/gdb.base/lineno-makeup.exp
74 +# Copyright 2009 Free Software Foundation, Inc.
76 +# This program is free software; you can redistribute it and/or modify
77 +# it under the terms of the GNU General Public License as published by
78 +# the Free Software Foundation; either version 3 of the License, or
79 +# (at your option) any later version.
81 +# This program is distributed in the hope that it will be useful,
82 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
83 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84 +# GNU General Public License for more details.
86 +# You should have received a copy of the GNU General Public License
87 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
89 +set testfile "lineno-makeup"
90 +set srcfuncfile ${testfile}-func.c
91 +set srcfile ${testfile}.c
92 +set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
93 +set binfuncfile ${objdir}/${subdir}/${testfile}-func.bin
94 +set binfile ${objdir}/${subdir}/${testfile}
96 +if { [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" "${objfuncfile}" object {}] != "" } {
97 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
100 +set objcopy [catch "exec objcopy -O binary --only-section .text ${objfuncfile} ${binfuncfile}" output]
101 +verbose -log "objcopy=$objcopy: $output"
102 +if { $objcopy != 0 } {
103 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
105 +set binfuncfilesize [file size $binfuncfile]
106 +verbose -log "file size $binfuncfile = $binfuncfilesize"
108 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
109 + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
114 +gdb_reinitialize_dir $srcdir/$subdir
118 +set test "break func"
119 +gdb_test_multiple $test $test {
120 + -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
121 + set b_addr $expect_out(1,string)
124 + -re "Breakpoint \[0-9\]+ at (0x\[0-9a-f\]+): .*\r\n$gdb_prompt $" {
125 + set b_addr $expect_out(1,string)
129 +verbose -log "b_addr=<$b_addr>"
132 +set test "print func"
133 +gdb_test_multiple $test $test {
134 + -re "\\$\[0-9\]+ = {<text variable, no debug info>} (0x\[0-9a-f\]+) <func>\r\n$gdb_prompt $" {
135 + set p_addr $expect_out(1,string)
139 +verbose -log "p_addr=<$p_addr>"
141 +set test "break address belongs to func"
142 +if {$b_addr == $p_addr} {
143 + pass "$test (exact match)"
145 + set skip [expr $b_addr - $p_addr]
146 + if {$skip > 0 && $skip < $binfuncfilesize} {
147 + pass "$test (prologue skip by $skip bytes)"