OLD | NEW |
1 # Copyright 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2007-2012 Free Software Foundation, Inc. |
2 # | 2 # |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program; if not, write to the Free Software | 14 # along with this program; if not, write to the Free Software |
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
16 # | 16 # |
17 # This file is part of the gdb testsuite. | 17 # This file is part of the gdb testsuite. |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 # It's possible to have a program that contains two compilation units | 19 # It's possible to have a program that contains two compilation units |
24 # for the same source file name, that have code at different lines. | 20 # for the same source file name, that have code at different lines. |
25 # For example, in this test, we compile expand-psymtabs.c twice with | 21 # For example, in this test, we compile expand-psymtabs.c twice with |
26 # different preprocessor symbols #defined; the first .o only has | 22 # different preprocessor symbols #defined; the first .o only has |
27 # 'main' at some earlier source lines, while the second .o only has | 23 # 'main' at some earlier source lines, while the second .o only has |
28 # 'foo' at later source lines. So when setting breakpoints by line | 24 # 'foo' at later source lines. So when setting breakpoints by line |
29 # number, which full symtab we need depends on the line number in | 25 # number, which full symtab we need depends on the line number in |
30 # question. | 26 # question. |
31 # | 27 # |
32 # This test is meant to verify that, even with lazy partial symtab | 28 # This test is meant to verify that, even with lazy partial symtab |
33 # reading in effect, GDB can set breakpoints by line number | 29 # reading in effect, GDB can set breakpoints by line number |
34 # successfully in either compilation unit. | 30 # successfully in either compilation unit. |
35 | 31 |
36 set testfile expand-psymtabs | 32 set testfile expand-psymtabs |
37 set srcfile ${testfile}.c | 33 set srcfile ${testfile}.c |
38 set binfile ${objdir}/${subdir}/${testfile} | 34 set binfile ${objdir}/${subdir}/${testfile} |
39 set binfile_1 ${objdir}/${subdir}/${testfile}_1.o | 35 set binfile_1 ${objdir}/${subdir}/${testfile}_1.o |
40 set binfile_2 ${objdir}/${subdir}/${testfile}_2.o | 36 set binfile_2 ${objdir}/${subdir}/${testfile}_2.o |
41 | 37 |
42 # What compiler are we using? | 38 # What compiler are we using? |
43 if [get_compiler_info ${binfile}] { | 39 if [get_compiler_info] { |
44 return -1 | 40 return -1 |
45 } | 41 } |
46 | 42 |
47 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_1}" object {debug
additional_flags=-DFIRST} ] != "" } { | 43 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_1}" object {debug
additional_flags=-DFIRST} ] != "" } { |
48 untested expand-psymtabs.exp | 44 untested expand-psymtabs.exp |
49 return -1 | 45 return -1 |
50 } | 46 } |
51 | 47 |
52 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_2}" object {debug
}] != "" } { | 48 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_2}" object {debug
}] != "" } { |
53 untested expand-psymtabs.exp | 49 untested expand-psymtabs.exp |
54 return -1 | 50 return -1 |
55 } | 51 } |
56 | 52 |
57 if { [gdb_compile "${binfile_1} ${binfile_2}" "${binfile}" executable {debug}]
!= "" } { | 53 if { [gdb_compile "${binfile_1} ${binfile_2}" "${binfile}" executable {debug}]
!= "" } { |
58 untested expand-psymtabs.exp | 54 untested expand-psymtabs.exp |
59 return -1 | 55 return -1 |
60 } | 56 } |
61 | 57 |
62 gdb_exit | 58 gdb_exit |
63 gdb_start | 59 gdb_start |
64 gdb_reinitialize_dir $srcdir/$subdir | 60 gdb_reinitialize_dir $srcdir/$subdir |
65 gdb_load ${binfile} | 61 gdb_load ${binfile} |
66 | 62 |
67 set foo_bp [gdb_get_line_number "Break here"] | 63 set foo_bp [gdb_get_line_number "Break here"] |
68 gdb_test "break $foo_bp" "Breakpoint.*" "Expand psymtabs" | 64 gdb_test "break $foo_bp" "Breakpoint.*" "Expand psymtabs" |
69 | 65 |
OLD | NEW |